[PATCH] Fix ptype problem printing typedefs defined differently in different compilation units

Fred Fish fnf@specifix.com
Tue Jan 3 20:17:00 GMT 2006


When examining an executable (but not running it) if you have a
typedef in two different compilation units, with the same name but
different types, the ptype command will print the type for the first
one it finds in a scan of all the loaded symtabs, regardless of any
source context you may have selected.

Of course the wisdom of having writing this sort of code in the first
place is somewhat suspect...  :-)

Attached is a patch that adds a test to the ptype.exp test for this
case, by alternately listing functions from different compilation
units (thus setting gdb's idea of the current source context) and
verifying that ptype prints the type correctly based on the context.

The patch also adds a proposed fix for the problem, which is to look
in the current source symtab for the name, before scanning all the
symtabs.

-Fred



-------------- next part --------------
A non-text attachment was scrubbed...
Name: symtab.patch2
Type: text/x-diff
Size: 7183 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20060103/9f298b10/attachment.bin>


More information about the Gdb-patches mailing list