[Ltrace-devel] Getting prototypes from debug information

Petr Machata pmachata at redhat.com
Thu Apr 24 11:04:19 UTC 2014


Dima Kogan <lists at dima.secretsauce.net> writes:

> Dima Kogan <lists at dima.secretsauce.net> writes:
>
>> OK. My near-term todo list:
>>
>> - Try to get prototypes from both DWARF and conf files.
>
> I ran some tests, and pushed some new patches to that same tree. Some
> joint .conf/DWARF prototyping now works!

That's cool!

> - 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.)

The reason why this doesn't work might be that when it's in both, the
following code triggers (in read_config_file.c):

static int
parse_typedef(struct protolib *plib, struct locus *loc, char **str)
{
        [... snip ...]
	struct named_type *forward = protolib_lookup_type(plib, name, true);
	if (forward != NULL [... snip ...])
		report_error(loc->filename, loc->line_no,
			     "Redefinition of typedef '%s'", name);

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

This code might be too eager looking into imports.  A local definition
of a typedef should likely take precedence over whatever happens to be
in one of the imports.

> - 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*".

Thanks,
PM



More information about the Ltrace-devel mailing list