public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/17992] New: "set demangle none" doesn't work
@ 2015-02-17 17:20 hjl.tools at gmail dot com
  2015-02-17 17:36 ` [Bug gdb/17992] " hjl.tools at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2015-02-17 17:20 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug gdb/17992] "set demangle none" doesn't work
  2015-02-17 17:20 [Bug gdb/17992] New: "set demangle none" doesn't work hjl.tools at gmail dot com
@ 2015-02-17 17:36 ` hjl.tools at gmail dot com
  2015-02-17 17:45 ` hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2015-02-17 17:36 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug gdb/17992] "set demangle none" doesn't work
  2015-02-17 17:20 [Bug gdb/17992] New: "set demangle none" doesn't work hjl.tools at gmail dot com
  2015-02-17 17:36 ` [Bug gdb/17992] " hjl.tools at gmail dot com
@ 2015-02-17 17:45 ` hjl.tools at gmail dot com
  2015-02-17 17:48 ` hjl.tools at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2015-02-17 17:45 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug gdb/17992] "set demangle none" doesn't work
  2015-02-17 17:20 [Bug gdb/17992] New: "set demangle none" doesn't work hjl.tools at gmail dot com
  2015-02-17 17:36 ` [Bug gdb/17992] " hjl.tools at gmail dot com
  2015-02-17 17:45 ` hjl.tools at gmail dot com
@ 2015-02-17 17:48 ` hjl.tools at gmail dot com
  2015-02-17 18:45 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2015-02-17 17:48 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug gdb/17992] "set demangle none" doesn't work
  2015-02-17 17:20 [Bug gdb/17992] New: "set demangle none" doesn't work hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2015-02-17 17:48 ` hjl.tools at gmail dot com
@ 2015-02-17 18:45 ` hjl.tools at gmail dot com
  2015-02-20  3:01 ` keiths at redhat dot com
  2020-07-23 16:47 ` tromey at sourceware dot org
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2015-02-17 18:45 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug gdb/17992] "set demangle none" doesn't work
  2015-02-17 17:20 [Bug gdb/17992] New: "set demangle none" doesn't work hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2015-02-17 18:45 ` hjl.tools at gmail dot com
@ 2015-02-20  3:01 ` keiths at redhat dot com
  2020-07-23 16:47 ` tromey at sourceware dot org
  5 siblings, 0 replies; 7+ messages in thread
From: keiths at redhat dot com @ 2015-02-20  3:01 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug gdb/17992] "set demangle none" doesn't work
  2015-02-17 17:20 [Bug gdb/17992] New: "set demangle none" doesn't work hjl.tools at gmail dot com
                   ` (4 preceding siblings ...)
  2015-02-20  3:01 ` keiths at redhat dot com
@ 2020-07-23 16:47 ` tromey at sourceware dot org
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at sourceware dot org @ 2020-07-23 16:47 UTC (permalink / raw)
  To: gdb-prs

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-07-23 16:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-17 17:20 [Bug gdb/17992] New: "set demangle none" doesn't work hjl.tools at gmail dot com
2015-02-17 17:36 ` [Bug gdb/17992] " hjl.tools at gmail dot com
2015-02-17 17:45 ` hjl.tools at gmail dot com
2015-02-17 17:48 ` hjl.tools at gmail dot com
2015-02-17 18:45 ` hjl.tools at gmail dot com
2015-02-20  3:01 ` keiths at redhat dot com
2020-07-23 16:47 ` tromey at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).