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

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

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

glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=17992

            Bug ID: 17992
           Summary: "set demangle none" doesn't work
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com

[hjl@gnu-6 tmp]$ cat f.cc
int
foo (int x)
{
  return x;
}
[hjl@gnu-6 tmp]$ gcc -fpic -g f.cc -shared  
[hjl@gnu-6 tmp]$ gdb a.out
GNU gdb (GDB) Fedora 7.7.1-21.fc20
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.out...done.
(gdb) disass foo
Dump of assembler code for function foo(int):
   0x0000000000000605 <+0>:    push   %rbp
   0x0000000000000606 <+1>:    mov    %rsp,%rbp
   0x0000000000000609 <+4>:    mov    %edi,-0x4(%rbp)
   0x000000000000060c <+7>:    mov    -0x4(%rbp),%eax
   0x000000000000060f <+10>:    pop    %rbp
   0x0000000000000610 <+11>:    retq  
End of assembler dump.
(gdb) set demangle none
(gdb) show demangle
The current C++ demangling style is "none".
(gdb) disass foo
Dump of assembler code for function foo(int):
   0x0000000000000605 <+0>:    push   %rbp
   0x0000000000000606 <+1>:    mov    %rsp,%rbp
   0x0000000000000609 <+4>:    mov    %edi,-0x4(%rbp)
   0x000000000000060c <+7>:    mov    -0x4(%rbp),%eax
   0x000000000000060f <+10>:    pop    %rbp
   0x0000000000000610 <+11>:    retq  
End of assembler dump.
(gdb)

I am expecting

Dump of assembler code for function _Z3fooi:

instead of

Dump of assembler code for function foo(int):

"objdump -d" handles it properly.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

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

glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=17992

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |7.8

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

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

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=17992

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|7.8                         |HEAD

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
gdb should call cplus_demangle_set_style for "set demangle xxx".

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

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

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=17992

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
"set demangle none" works only if it is issued before any "disass".

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

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

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=17992

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
Result of "disass xxx" seems to be cached by gdb.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

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

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de
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.
Reply | Threaded
Open this post in threaded view
|

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

Sourceware - gdb-prs mailing list
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=17992

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED
                 CC|                            |tromey at sourceware dot org

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
Most of the underlying problems have been fixed here,
except there is bug 26270.
Note that for "disassemble" in particular you have
to use "set print asm-demangle", not other settings;
and that is what is broken in that PR.
I'm closing this as a dup.

*** This bug has been marked as a duplicate of bug 26270 ***

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