summaryrefslogtreecommitdiff
path: root/gdb/symtab.h
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-07-28 11:48:15 -0600
committerTom Tromey <tromey@adacore.com>2020-07-28 11:48:15 -0600
commitf75a069335831a4f375923b5ab815ce0b6b2ebdf (patch)
treef9788692981cbb95e60b1e1bd5cc3be34a301326 /gdb/symtab.h
parent16f3242c055e2a740dfc42b65cc3509b6ccf71e8 (diff)
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.
Diffstat (limited to 'gdb/symtab.h')
-rw-r--r--gdb/symtab.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 0b186554ea..026ffcaa01 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1769,6 +1769,14 @@ extern bool find_pc_partial_function (CORE_ADDR pc, const char **name,
CORE_ADDR *address, CORE_ADDR *endaddr,
const struct block **block = nullptr);
+/* Like find_pc_partial_function, above, but returns the underlying
+ general_symbol_info (rather than the name) as an out parameter. */
+
+extern bool find_pc_partial_function_sym
+ (CORE_ADDR pc, const general_symbol_info **sym,
+ CORE_ADDR *address, CORE_ADDR *endaddr,
+ const struct block **block = nullptr);
+
/* Like find_pc_partial_function, above, but *ADDRESS and *ENDADDR are
set to start and end addresses of the range containing the entry pc.