[Ltrace-devel] [PATCH] Early support for libdl in ltrace

Joe Damato ice799 at gmail.com
Thu Sep 17 17:31:03 UTC 2009


forgot to CC the list when I replied..

On Thu, Sep 17, 2009 at 10:21 AM, Steve Fink <sphink at gmail.com> wrote:
> I have nothing useful to add other than "cool, thanks!" I really
> wanted this a while back, and will doubtless have need of it in the
> future.

Thanks very much for reading! As I said before, this is still a work
in progress. More work needs to be done so that ltrace can notice new
dlsym events. Should be done soon-ish.

> But now that I took the trouble to write this, I also glanced at the
> patch. I didn't actually try to follow any of the complex logic, so
> this is just lint:
>
> -#define MAX_LIBRARIES 30
> +#define MAX_LIBRARIES (200)
> +#define ELF_MAX_SEGMENTS  (50)
> +#define ELF_SYMTAB_MAX    (5000)
>
> Why the parens? When would they matter?

They don't matter. I'll remove them, it was just a force of habit.

> -       memset(lte, 0, sizeof(*lte));
>
> Why? (I didn't read the code to know what's going on here, but it just
> looks odd.)

I removed the memset because I'm setting some values in the lte before
this memset gets hit. If I leave this in, it will wipe out some data
I'm stuffing in there. I should probably move this memset (instead of
remove it) and have it happen earlier before I start stuffing values
into the lte.

> --- a/sysdeps/linux-gnu/trace.c
> +++ b/sysdeps/linux-gnu/trace.c
>
> Pointless whitespace addition.

Oops.

> What's the connection between dlsym support and the --no-plt flag?

No real connection, but the --no-plt flag helps to quiet things down.
I found that when I wanted to trace dlsym symbols, I didn't want to
see all the other symbols appearing on my screen (and slowing down my
process). It shouldn't be required, although I may have combined the
patches together accidentally.

> +size_t
> +umovebytes(Process *proc, void *src, void *dest, size_t count) {
>
> That seems odd. I thought I had implemented exactly the same thing for
> my point and structure displaying patch, that I thought went in a few
> years back. I guess I should look through the history. But sure
> enough, it's not there now. Maybe I ended up not needing it for some
> reason?
>
> Oh, sure enough. I have it lying around as a separate diff, so I must
> have split it out. I called mine 'umove', and my code looks a little
> simpler, which probably means mine is wrong. It's been too long, so
> I'm attaching mine to see if you can make sense of it. I also have an
> identical diff in the ia64 directory, so apparently it must've worked
> there too. (I was testing on x86 and ia64).

Cool, thanks for sending over the diff, I'll take a look.

Thanks,
Joe



More information about the Ltrace-devel mailing list