binutils-gdb/gdb/cli
Andrew Burgess f75a069335 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.
2020-07-28 11:48:15 -06:00
..
cli-cmds.c Demangle function names when disassembling 2020-07-28 11:48:15 -06:00
cli-cmds.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
cli-decode.c Remove "cmd_type" function 2020-06-28 10:33:07 -06:00
cli-decode.h Remove "cmd_type" function 2020-06-28 10:33:07 -06:00
cli-dump.c Replace most calls to help_list and cmd_show_list 2020-04-17 15:13:41 -06:00
cli-interp.c gdb: add back declarations for _initialize functions 2020-01-13 14:01:38 -05:00
cli-interp.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
cli-logging.c Update more calls to add_prefix_cmd 2020-05-03 11:31:20 -06:00
cli-option.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
cli-option.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
cli-script.c default-args: allow to define default arguments for aliases 2020-06-22 21:14:13 +02:00
cli-script.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
cli-setshow.c Fix inconsistent output of prefix and bugs in 'show' command 2020-05-15 22:17:45 +02:00
cli-setshow.h Fix inconsistent output of prefix and bugs in 'show' command 2020-05-15 22:17:45 +02:00
cli-style.c Revert "Add completion styling" 2020-05-24 20:27:48 -06:00
cli-style.h Revert "Add completion styling" 2020-05-24 20:27:48 -06:00
cli-utils.c gdb: remove TYPE_CODE macro 2020-05-14 13:46:38 -04:00
cli-utils.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00