This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB 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]

[Bug gdb/17992] "set demangle none" doesn't work


https://sourceware.org/bugzilla/show_bug.cgi?id=17992

Keith Seitz <keiths at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |keiths at redhat dot com

--- Comment #4 from Keith Seitz <keiths at redhat dot com> ---
(In reply to H.J. Lu from comment #3)
> Result of "disass xxx" seems to be cached by gdb.

Actually it is even more insidious than this. This problem occurs because of
the representation mess that currently infects gdb (see symtab/12707).

What's really happening here is that when debug info is read for foo(), the
name that gets recorded in the symbol table is *dependent on the setting of
demangle-style*! [I actually did not even know about this until looking at this
bug!]

Example:
$ ./gdb -nx -q a.out -batch -ex "set demangle-style none" -ex "inf func" \
  -ex "maint print symbols sym"; grep foo sym
 int foo(int); block object 0x39fa850, 0x690..0x69c
    block #002, object at 0x39fa850 under 0x39fa910, 1 syms/buckets in
0x690..0x69c, function _Z3fooi, foo(int)

$ ./gdb -nx -q a.out -batch -ex "set demangle-style auto" -ex "inf func" \
  -ex "maint print symbols sym"; grep foo sym
 int foo(int); block object 0x2d33850, 0x690..0x69c
    block #002, object at 0x2d33850 under 0x2d33910, 1 syms/buckets in
0x690..0x69c, function foo(int)

The "function XXX" bit uses SYMBOL_LINKAGE_NAME. In the above two commands, you
can see that the setting of demangle-style changed the meaning of
SYMBOL_LINKAGE_NAME.

[[[
Even more grotesque example:
$ gdb -nx -q
(gdb) set demangle-style none
(gdb) file testsuite/gdb.cp/cpexprs
Reading symbols from testsuite/gdb.cp/cpexprs...done.
(gdb) inf func test_function
All functions matching regular expression "test_function":

File ../../../src/gdb/testsuite/gdb.cp/cpexprs.cc:
int _Z13test_functioniPPc(int, char **);
(gdb) q
$ gdb -nx -q testsuite/gdb.cp/cpexprs
(gdb) inf func test_function
All functions matching regular expression "test_function":

File ../../../src/gdb/testsuite/gdb.cp/cpexprs.cc:
int test_function(int, char**);
]]]

Our symbol tables are in desperate need of a rewrite!

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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