This is the mail archive of the archer@sourceware.org mailing list for the Archer 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 and typedefs


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


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