This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: GDB and typedefs
- From: Tom Tromey <tromey at redhat dot com>
- To: Jim Blandy <jimb at red-bean dot com>
- Cc: archer at sourceware dot org
- Date: Wed, 04 Feb 2009 10:59:07 -0700
- Subject: Re: GDB and typedefs
- References: <8f2776cb0902040829r18f47ed7lc8612721ce4441a8@mail.gmail.com>
- Reply-to: Tom Tromey <tromey at redhat dot com>
>>>>> "Jim" == Jim Blandy <jimb@red-bean.com> writes:
Jim> Here's the odd part. If one prints a variable or the value of a
Jim> function declared to have type 'jsval', this works fine. But if one
Jim> casts a value to 'jsval' in GDB, say:
Jim> (gdb) print (jsval) 16
Just FYI -- Phil is working on changing the printer lookup code so
that we don't look at type names any more. Instead, we'll just call a
sequence functions with the Value, and the first function to return a
printer will win. A function is still free to look at the type name,
but it could also look at other things -- this will let us solve the
problem of pretty-printing tagless structs, and also the problem of
having a single printer work for all subclasses of a given class.
Jim> When the DWARF 2 reader processes a DW_TAG_typedef die, it
Jim> creates a symbol whose name is the typedef name (jsval), but
Jim> whose type is the definition type (jsword). It will later create
Jim> a typedef type named jsval, but that's not what gets associated
Jim> with the jsval symbol.
Funnily enough, I already wrote a patch for this. Tell me what you
think, it is at the end of:
http://sourceware.org/ml/gdb-patches/2009-01/msg00363.html
This patch also solves the 'whatis' problem, albeit in a somewhat
weird way. I couldn't think of anything better...
Note that this patch helps but does not completely solve the problem.
Casts in gdb still strip typedefs, because value_cast calls
check_typedef. This will require a separate patch.
Tom