public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* GDB isn't finding a typedef
@ 2012-02-15 21:35 Paul_Koning
  2012-02-15 21:48 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Paul_Koning @ 2012-02-15 21:35 UTC (permalink / raw)
  To: gdb

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

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

Gdb is 7.2, gcc is 4.5.1 if it matters.

               paul

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: GDB isn't finding a typedef
  2012-02-15 21:35 GDB isn't finding a typedef Paul_Koning
@ 2012-02-15 21:48 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2012-02-15 21:48 UTC (permalink / raw)
  To: Paul_Koning; +Cc: gdb

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

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-15 21:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-15 21:35 GDB isn't finding a typedef Paul_Koning
2012-02-15 21:48 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).