How to make gdb show the original non-mangling function name on disassembly model?

You could do maint demangle _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc at the (gdb) prompt.

The manual says:

`set print asm-demangle'
`set print asm-demangle on'
     Print C++ names in their source form rather than their mangled
     form, even in assembler code printouts such as instruction
     disassemblies.  The default is off.

Unfortunately, it doesn't appear to work:

(gdb) set print asm-demangle on
(gdb) disas
Dump of assembler code for function _Z12outputStringPKc:
0x00000000004009c4 <outputString(char const*)+0>:   push   %rbp
0x00000000004009c5 <outputString(char const*)+1>:   mov    %rsp,%rbp
0x00000000004009c8 <outputString(char const*)+4>:   sub    $0x10,%rsp
0x00000000004009cc <outputString(char const*)+8>:   mov    %rdi,-0x8(%rbp)
0x00000000004009d0 <outputString(char const*)+12>:  mov    $0x400bb0,%esi
0x00000000004009d5 <outputString(char const*)+17>:  mov    $0x6012a0,%edi
0x00000000004009da <outputString(char const*)+22>:  callq  0x400798 <_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@plt>
0x00000000004009df <outputString(char const*)+27>:  mov    %rax,%rdi
0x00000000004009e2 <outputString(char const*)+30>:  mov    -0x8(%rbp),%rsi
0x00000000004009e6 <outputString(char const*)+34>:  callq  0x400798 <_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@plt>
0x00000000004009eb <outputString(char const*)+39>:  mov    %rax,%rdi
0x00000000004009ee <outputString(char const*)+42>:  mov    $0x4007c8,%esi
0x00000000004009f3 <outputString(char const*)+47>:  callq  0x4007b8 <_ZNSolsEPFRSoS_E@plt>
0x00000000004009f8 <outputString(char const*)+52>:  leaveq 
0x00000000004009f9 <outputString(char const*)+53>:  retq   
End of assembler dump.

The setting changed how the current function is printed, but not how the functions it calls are printed (which is what I assume you are after).

I think that is a bug in GDB, please file a bug in bugzilla.


I don't remember ever finding an automatic way for gdb to do it. I always just copied and pasted the symbol and ran it through the Linux c++filt utility to demangle.


gdb show the original non-mangling function name on disassembly model ::

you have to do this steps every time whenever you are going to debug. 1. set print demangle on 2. set print asm-demangle on

Else you can create vim ~/.gdbinit file like ~/.vimrc file and set following steps so you no need to do every time on . 1 set print pretty on 2 set print demangle on 3 set print asm-demangle on