forked from Imagelibrary/binutils-gdb
Demangle function names when disassembling
Andrew Burgess pointed out a regression, which he described in
PR symtab/26270:
================
After commit:
commit bcfe6157ca (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.
This commit is contained in:
committed by
Tom Tromey
parent
16f3242c05
commit
f75a069335
@@ -1482,6 +1482,7 @@ disassemble_command (const char *arg, int from_tty)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_current_arch ();
|
||||
CORE_ADDR low, high;
|
||||
const general_symbol_info *symbol = nullptr;
|
||||
const char *name;
|
||||
CORE_ADDR pc;
|
||||
gdb_disassembly_flags flags;
|
||||
@@ -1537,8 +1538,14 @@ disassemble_command (const char *arg, int from_tty)
|
||||
if (p[0] == '\0')
|
||||
{
|
||||
/* One argument. */
|
||||
if (find_pc_partial_function (pc, &name, &low, &high, &block) == 0)
|
||||
if (!find_pc_partial_function_sym (pc, &symbol, &low, &high, &block))
|
||||
error (_("No function contains specified address."));
|
||||
|
||||
if (asm_demangle)
|
||||
name = symbol->print_name ();
|
||||
else
|
||||
name = symbol->linkage_name ();
|
||||
|
||||
#if defined(TUI)
|
||||
/* NOTE: cagney/2003-02-13 The `tui_active' was previously
|
||||
`tui_version'. */
|
||||
|
||||
Reference in New Issue
Block a user