Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* user friendly symbol name
@ 2013-08-09  1:17 Shang Yu
  2013-08-09  3:22 ` Hatte John
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Shang Yu @ 2013-08-09  1:17 UTC (permalink / raw)
  To: gdb

Hi dear all,
How to display a user friendly symbol name in gdb ? For example , I
want gdb display the following symbol name _ZNSt14basic_iostreamIwSt
in its C++ equivalent format.
Many thanks!!!


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

* Re: user friendly symbol name
  2013-08-09  1:17 user friendly symbol name Shang Yu
@ 2013-08-09  3:22 ` Hatte John
  2013-08-09 10:22 ` Andreas Schwab
  2013-08-09 10:22 ` Jan Kratochvil
  2 siblings, 0 replies; 10+ messages in thread
From: Hatte John @ 2013-08-09  3:22 UTC (permalink / raw)
  To: gdb

hi:

c++filter do this work

Best Regard!

2013/8/9 Shang Yu <yusunn@gmail.com>:
> Hi dear all,
> How to display a user friendly symbol name in gdb ? For example , I
> want gdb display the following symbol name _ZNSt14basic_iostreamIwSt
> in its C++ equivalent format.
> Many thanks!!!


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

* Re: user friendly symbol name
  2013-08-09  1:17 user friendly symbol name Shang Yu
  2013-08-09  3:22 ` Hatte John
  2013-08-09 10:22 ` Andreas Schwab
@ 2013-08-09 10:22 ` Jan Kratochvil
  2013-08-09 14:14   ` Pedro Alves
  2013-08-09 17:58   ` Shang Yu
  2 siblings, 2 replies; 10+ messages in thread
From: Jan Kratochvil @ 2013-08-09 10:22 UTC (permalink / raw)
  To: Shang Yu; +Cc: gdb

On Fri, 09 Aug 2013 03:17:16 +0200, Shang Yu wrote:
> How to display a user friendly symbol name in gdb ? For example , I
> want gdb display the following symbol name _ZNSt14basic_iostreamIwSt
> in its C++ equivalent format.

Besides the other reply - in GDB you can:

(gdb) set cp-abi gnu-v3
(gdb) set language c++
(gdb) maintenance demangle _ZNSt14basic_iostreamIwSt
Can't demangle "_ZNSt14basic_iostreamIwSt"
(gdb) maintenance demangle _ZNSt16nested_exceptionD2Ev
std::nested_exception::~nested_exception()

You may want to check the documentation why your symbol is not recognized:
	http://mentorembedded.github.io/cxx-abi/abi.html#mangling


Jan


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

* Re: user friendly symbol name
  2013-08-09  1:17 user friendly symbol name Shang Yu
  2013-08-09  3:22 ` Hatte John
@ 2013-08-09 10:22 ` Andreas Schwab
  2013-08-09 10:22 ` Jan Kratochvil
  2 siblings, 0 replies; 10+ messages in thread
From: Andreas Schwab @ 2013-08-09 10:22 UTC (permalink / raw)
  To: Shang Yu; +Cc: gdb

Shang Yu <yusunn@gmail.com> writes:

> How to display a user friendly symbol name in gdb ? For example , I
> want gdb display the following symbol name _ZNSt14basic_iostreamIwSt
> in its C++ equivalent format.

(gdb) help maintenance demangle                                                 
Demangle a C++/ObjC mangled name.                                               
Call internal GDB demangler routine to demangle a C++ link name                 
and prints the result.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

* Re: user friendly symbol name
  2013-08-09 10:22 ` Jan Kratochvil
@ 2013-08-09 14:14   ` Pedro Alves
  2013-08-09 14:21     ` Eli Zaretskii
  2013-08-09 18:23     ` Tom Tromey
  2013-08-09 17:58   ` Shang Yu
  1 sibling, 2 replies; 10+ messages in thread
From: Pedro Alves @ 2013-08-09 14:14 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: Shang Yu, gdb

On 08/09/2013 11:22 AM, Jan Kratochvil wrote:
> (gdb) maintenance demangle _ZNSt16nested_exceptionD2Ev
> std::nested_exception::~nested_exception()

Interesting.  It seems a pity this is a maintenance
command.  Shouldn't we "upgrade" it to a regular user command?

-- 
Pedro Alves


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

* Re: user friendly symbol name
  2013-08-09 14:14   ` Pedro Alves
@ 2013-08-09 14:21     ` Eli Zaretskii
  2013-08-09 18:23     ` Tom Tromey
  1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2013-08-09 14:21 UTC (permalink / raw)
  To: Pedro Alves; +Cc: jan.kratochvil, yusunn, gdb

> Date: Fri, 09 Aug 2013 15:14:43 +0100
> From: Pedro Alves <palves@redhat.com>
> CC: Shang Yu <yusunn@gmail.com>, gdb@sourceware.org
> 
> On 08/09/2013 11:22 AM, Jan Kratochvil wrote:
> > (gdb) maintenance demangle _ZNSt16nested_exceptionD2Ev
> > std::nested_exception::~nested_exception()
> 
> Interesting.  It seems a pity this is a maintenance
> command.  Shouldn't we "upgrade" it to a regular user command?

My vote is YAY.

Thanks.


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

* Re: user friendly symbol name
  2013-08-09 10:22 ` Jan Kratochvil
  2013-08-09 14:14   ` Pedro Alves
@ 2013-08-09 17:58   ` Shang Yu
  2013-08-09 18:56     ` Jan Kratochvil
  1 sibling, 1 reply; 10+ messages in thread
From: Shang Yu @ 2013-08-09 17:58 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb

Thanks for reply . But how can I demangle the symbol name massively in
the output of disas command ? Many thanks !

2013/8/9 Jan Kratochvil <jan.kratochvil@redhat.com>:
> On Fri, 09 Aug 2013 03:17:16 +0200, Shang Yu wrote:
>> How to display a user friendly symbol name in gdb ? For example , I
>> want gdb display the following symbol name _ZNSt14basic_iostreamIwSt
>> in its C++ equivalent format.
>
> Besides the other reply - in GDB you can:
>
> (gdb) set cp-abi gnu-v3
> (gdb) set language c++
> (gdb) maintenance demangle _ZNSt14basic_iostreamIwSt
> Can't demangle "_ZNSt14basic_iostreamIwSt"
> (gdb) maintenance demangle _ZNSt16nested_exceptionD2Ev
> std::nested_exception::~nested_exception()
>
> You may want to check the documentation why your symbol is not recognized:
>         http://mentorembedded.github.io/cxx-abi/abi.html#mangling
>
>
> Jan


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

* Re: user friendly symbol name
  2013-08-09 14:14   ` Pedro Alves
  2013-08-09 14:21     ` Eli Zaretskii
@ 2013-08-09 18:23     ` Tom Tromey
  2013-08-12 16:39       ` Pedro Alves
  1 sibling, 1 reply; 10+ messages in thread
From: Tom Tromey @ 2013-08-09 18:23 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Jan Kratochvil, Shang Yu, gdb

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> On 08/09/2013 11:22 AM, Jan Kratochvil wrote:
>> (gdb) maintenance demangle _ZNSt16nested_exceptionD2Ev
>> std::nested_exception::~nested_exception()

Pedro> Interesting.  It seems a pity this is a maintenance
Pedro> command.  Shouldn't we "upgrade" it to a regular user command?

Yeah, though the command as currently formulated is a bit of a pain.  At
least, I usually forget to "set lang c++" first and then have to go
back.  Similarly, sometimes it would be nice to be able to specify the
language as an argument.

Tom


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

* Re: user friendly symbol name
  2013-08-09 17:58   ` Shang Yu
@ 2013-08-09 18:56     ` Jan Kratochvil
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Kratochvil @ 2013-08-09 18:56 UTC (permalink / raw)
  To: Shang Yu; +Cc: gdb

On Fri, 09 Aug 2013 19:58:32 +0200, Shang Yu wrote:
> Thanks for reply . But how can I demangle the symbol name massively in
> the output of disas command ? Many thanks !

They are demangled:

(gdb) disas 'std::istream::get()'
   0x0000003a4b07f252 <+34>:	cmpb   $0x0,0xf(%rsp)
   0x0000003a4b07f257 <+39>:	je     0x3a4b07f290 <std::istream::get()+96>

In some cases they are not:
   0x0000003a4b07f24d <+29>:	callq  0x3a4b05b3e0 <_ZNSi6sentryC1ERSib@plt>

but that is a bug in the GDB demangling logic (aware of it...).
Shell 'objdump -dC' will demangled it right:
  3a4b07f24d:   e8 8e c1 fd ff          callq  3a4b05b3e0 <std::istream::sentry::sentry(std::istream&, bool)@plt>



Jan


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

* Re: user friendly symbol name
  2013-08-09 18:23     ` Tom Tromey
@ 2013-08-12 16:39       ` Pedro Alves
  0 siblings, 0 replies; 10+ messages in thread
From: Pedro Alves @ 2013-08-12 16:39 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Jan Kratochvil, Shang Yu, gdb

On 08/09/2013 07:23 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
> 
> Pedro> On 08/09/2013 11:22 AM, Jan Kratochvil wrote:
>>> (gdb) maintenance demangle _ZNSt16nested_exceptionD2Ev
>>> std::nested_exception::~nested_exception()
> 
> Pedro> Interesting.  It seems a pity this is a maintenance
> Pedro> command.  Shouldn't we "upgrade" it to a regular user command?
> 
> Yeah, though the command as currently formulated is a bit of a pain.  At
> least, I usually forget to "set lang c++" first and then have to go
> back.  Similarly, sometimes it would be nice to be able to specify the
> language as an argument.

Thanks.  FYI, this is now PR gdb/15830

http://sourceware.org/bugzilla/show_bug.cgi?id=15830

-- 
Pedro Alves


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

end of thread, other threads:[~2013-08-12 16:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-09  1:17 user friendly symbol name Shang Yu
2013-08-09  3:22 ` Hatte John
2013-08-09 10:22 ` Andreas Schwab
2013-08-09 10:22 ` Jan Kratochvil
2013-08-09 14:14   ` Pedro Alves
2013-08-09 14:21     ` Eli Zaretskii
2013-08-09 18:23     ` Tom Tromey
2013-08-12 16:39       ` Pedro Alves
2013-08-09 17:58   ` Shang Yu
2013-08-09 18:56     ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox