how canonical are template names?
Stan Shebs
shebs@apple.com
Fri Jan 10 23:34:00 GMT 2003
David Carlton wrote:
>I'm testing a patch on my branch that tries to figure out when a class
>lives inside a namespace by looking at the demangled names of the
>methods of the classes.
>
>When I tested the patch, I saw some regressions in
>gdb.c++/templates.exp. But, on looking at the situation further, I'm
>not sure that they qualify as regressions. Basically, there are
>different ways to write the same types; it turns out that G++'s debug
>info and the demangler choose different ways in some circumstances.
>
>In an ideal world, maybe GDB would always print types in one canonical
>way and allow users as much flexibility as possible in how they input
>types. But, for now, it seems quite reasonable to allow GDB to print
>types however it wishes and to require users to input types the same
>way that GDB outputs them in some circumstances. Usually, users can
>figure out what name GDB thinks a templated class has by calling
>'ptype' on a variable of the appropriate type.
>
One goal for all GDB expression and type evaluation is to pass
the cut-n-paste test - the debugger should be able to take anything
in the source code and come up with the same interpretation as the
compiler. Anything less is a quick trip to user hell - manually
expanding macros, trying to guess how to phrase a cast, executing
function bodies line by line because function calls don't work.
Of course, we'll always fall short of the ideal. In the specific
cases you mention, it sounds like some parser smartening is in
order, and all the faults should be PRs.
Stan
More information about the Gdb
mailing list