Bug 26270 - Disassembler no longer showing demangled symbol names
Summary: Disassembler no longer showing demangled symbol names
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: symtab (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 10.1
Assignee: Tom Tromey
URL:
Keywords:
: 17992 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-07-20 22:42 UTC by Andrew Burgess
Modified: 2020-07-28 17:53 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Test case. (1.53 KB, patch)
2020-07-20 22:42 UTC, Andrew Burgess
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Burgess 2020-07-20 22:42:13 UTC
Created attachment 12714 [details]
Test case.

After commit:
    
      commit bcfe6157ca288efed127c5efe21ad7924e0d98cf (refs/bisect/bad)
      Date:   Fri Apr 24 15:35:01 2020 -0600
    
          Use the linkage name if it exists
    
The disassembler no longer demangles function names in its output.  So
we see things like this:
    
      (gdb) disassemble tree_insert
      Dump of assembler code for function _Z11tree_insertP4nodei:
        ....
    
Instead of this:
    
      (gdb) disassemble tree_insert
      Dump of assembler code for function tree_insert(node*, int):
        ....
    
This is because find_pc_partial_function now returns the linkage name
rather than the demangled name.
Comment 1 Andrew Burgess 2020-07-20 22:43:10 UTC
I've added 10.1 milestone for this bug as this is a regression from previous releases.
Comment 2 Tom Tromey 2020-07-23 15:17:46 UTC
The test needed "set print asm-demangle on".
That doesn't affect the current output, but will after
the bug is fixed.
Comment 4 Tom Tromey 2020-07-23 16:47:30 UTC
*** Bug 17992 has been marked as a duplicate of this bug. ***
Comment 5 Sourceware Commits 2020-07-28 17:51:52 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f75a069335831a4f375923b5ab815ce0b6b2ebdf

commit f75a069335831a4f375923b5ab815ce0b6b2ebdf
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Tue Jul 28 11:48:15 2020 -0600

    Demangle function names when disassembling
    
    Andrew Burgess pointed out a regression, which he described in
    PR symtab/26270:
    
    ================
    After commit:
    
      commit bcfe6157ca288efed127c5efe21ad7924e0d98cf (refs/bisect/bad)
      Date:   Fri Apr 24 15:35:01 2020 -0600
    
          Use the linkage name if it exists
    
    The disassembler no longer demangles function names in its output.  So
    we see things like this:
    
      (gdb) disassemble tree_insert
      Dump of assembler code for function _Z11tree_insertP4nodei:
        ....
    
    Instead of this:
    
      (gdb) disassemble tree_insert
      Dump of assembler code for function tree_insert(node*, int):
        ....
    
    This is because find_pc_partial_function now returns the linkage name
    rather than the demangled name.
    ================
    
    This patch fixes the problem by introducing a new "overload" of
    find_pc_partial_function, which returns the general_symbol_info rather
    than simply the name.  This lets the disassemble command choose which
    name to show.
    
    Regression tested on x86-64 Fedora 32.
    
    gdb/ChangeLog
    2020-07-28  Tom Tromey  <tromey@adacore.com>
    
            PR symtab/26270:
            * symtab.h (find_pc_partial_function_sym): Declare.
            * cli/cli-cmds.c (disassemble_command): Use
            find_pc_partial_function_sym.  Check asm_demangle.
            * blockframe.c (cache_pc_function_sym): New global.
            (cache_pc_function_name): Remove.
            (clear_pc_function_cache): Update.
            (find_pc_partial_function_sym): New function, from
            find_pc_partial_function.
            (find_pc_partial_function): Rewrite using
            find_pc_partial_function_sym.
    
    gdb/testsuite/ChangeLog
    2020-07-28  Andrew Burgess  <andrew.burgess@embecosm.com>
    
            PR symtab/26270:
            * gdb.cp/disasm-func-name.cc: New file.
            * gdb.cp/disasm-func-name.exp: New file.
Comment 6 Tom Tromey 2020-07-28 17:53:56 UTC
Fixed.