[Ltrace-devel] Getting prototypes from debug information

Dima Kogan lists at dima.secretsauce.net
Mon Apr 28 00:27:41 UTC 2014


Petr Machata <pmachata at redhat.com> writes:

> Dima Kogan <lists at dima.secretsauce.net> writes:
>
>> - If I define the type in libwhatever.so.conf then it works. If I
>>   define the type in .ltrace.conf, it doesn't work (DWARF definition
>>   used). If I define it in both, the it STILL doesn't work. Not sure why
>>   yet
>
> Hmm, if I recall, .ltrace.conf works as an implicit import to all
> imported libraries (so that you can put there whatever and it just gets
> picked up by default).
>
> So this is the result of my advice to only look to immediate protolib
> when looking up prototypes.  It seems you need to look recursively after
> all.  (Which should just mean passing true to
> protolib_lookup_prototypes.)

Passing true to protolib_lookup_type() makes it work the way one would
expect. Passing true to protolib_lookup_prototypes() doesn't make it
work. This isn't surprising, I think. Should I commit this change
(passing true to both), or was this just a suggestion for testing? I'm a
bit concerned about this treating the type namespace as global, even
though it isn't. What would happen if two different DSOs define an
identically-named type that isn't actually the same? Can looking for
exports get confused by this?


> Does it by any change give you these "Redefinition of typedef" messages?

Yes.


>> - With things like FILE*, I might want it to be printed as a pointer,
>>   but I don't see an obvious way to do that. I can define a lens
>>   'typedef FILE = hex(int)', but this says that FILE is an integer, not
>>   FILE*. Am I missing something? Thoughts about this?
>
> This should be either "addr" or "void*".

I don't think I was clear (or I didn't fully grok your suggestion).
Ideally I want to be able to define a FILE as something that always has
its pointer printed. So for instance in my little tst library I have
this in the header:

 void FILEtest( FILE* a, const FILE* b );

A lens that does what I want is

 void FILEtest( void*, void* );

But I'd like to achieve this with some sort of lens typedef on FILE. Is
this possible? Or more to the point, what would be the most useful
ltrace output for a FILEtest() call, and how should it be implemented?

I think this all works sufficiently now for me to get the details ironed
out (memory, error handling), so I'm going to be looking at that next.

dima



More information about the Ltrace-devel mailing list