This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GDB isn't finding a typedef

>>>>> "Paul" ==   <> writes:

Paul> I have a large executable (compiled and linked with -g2) in which some
Paul> of the typedefs and structs are not found by gdb. Others it finds
Paul> without trouble. I can find all of them in the output from readelf
Paul> -debug-dump=info.

Paul> I tried to make a small test case on the theory that perhaps it
Paul> matters that the missing type is - probably - only used in casts. But
Paul> that didn't pan out, the small test case shows all the structs.

Paul> Gdb is 7.2, gcc is 4.5.1 if it matters.

First, gdb CVS HEAD.  I don't recall specifically but there may well
have been fixes in this area since 7.2.

Second, there are a couple ways to try to find this bug.

One way would be to put a breakpoint at the appropriate symbol table
entry point and then 'ptype whatever' and step through it.  This may let
you track down the problem if it is of the type "the info is in the
symtab but lookup is failing".  This kind of bug happens with C++
sometimes, IIRC there are a few open PRs.

Another way would be to put a conditional breakpoint in
dwarf2read.c:process_die.  Use readelf to find the DIE number for the
missing typedef and use that as the condition -- this will be fast.
Then, step through new_symbol to see what happens.  Sometimes new_symbol
decides to drop a symbol -- this would be the bug.  If it instead
registers the type, then you are back to the other method.

I would probably start with the second one, since it is easier to see
what is going on.

Another option is that the DWARF is wrong and gdb is ignoring it on this
basis (or more usually because properly interpreting the bad DWARF is
too hard).

The bad news is that this probably isn't exhaustive.  It is where I
would start if I were debugging it myself though.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]