This is the mail archive of the
mailing list for the GDB project.
Re: GDB isn't finding a typedef
>>>>> "Paul" == <Paul_Koning@Dell.com> 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> 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
The bad news is that this probably isn't exhaustive. It is where I
would start if I were debugging it myself though.