It's sometimes useful to know what the linkage name is for a function,
either for C++ programs or on any target which can decorate symbols in
various ways, such as optionally prepending an underscore.
This patch adds two commands: "show display-linkname" and "set display-linkname".
When set, the linkname is displayed whenever the function is displayed in
in breakpoint command or when the frame is displayed.
The following shows a small C++ program hitting a breakpoint and running
a backtrace, with and without the linkage name.
$ gdb tpp
GNU gdb (GDB) 7.6.50.20130313-cvs
...
(gdb) show display-linkname
Whether to display linkage name for functions is off.
(gdb) b foo
Breakpoint 1 at 0x400a0c: file t.cpp, line 6.
(gdb) run
Starting program: /tmp/tpp
Breakpoint 1, foo (msg=...) at t.cpp:6
6 cout << msg;
(gdb) bt
#0 foo (msg=...) at t.cpp:6
#1 0x0000000000400a55 in main () at t.cpp:11
(gdb) set display-linkname on
(gdb) show display-linkname
Whether to display linkage name for functions is on.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /tmp/tpp
Breakpoint 1, foo [_Z3fooSs] (msg=...) at t.cpp:6
6 cout << msg;
(gdb) bt
#0 foo [_Z3fooSs] (msg=...) at t.cpp:6
#1 0x0000000000400a55 in main [main] () at t.cpp:11
(gdb) quit
ChangeLog:
* 2013-03-18 Michael Eager <eager@eagercon.com>
* ada-lang.c (is_known_support_routine): Add linkname to find_frame_funname() call.
* defs.h (build_address_symbolic): Add linkname arg.
* disasm.c (dump_insns): Add linkname to find_frame_funname() call.
* printcmd.c (top.h): Include.
(MAX_LINKNAME_LEN): Define as 20.
(print_address_symbolic): Add linkname to build_address_symbolic() call, print
linkname if display-linkname set.
(build_address_symbolic): Add linkname arg, set if different from symbol name.
* stack.c (top.h): Include.
(MAX_LINKNAME_LEN): Define as 20.
(find_frame_funname): Add linkname arg, set if different from symbol name.
(print_frame): Add linkname to find_frame_funname() call, print linkname if
display-linkname set.
* stack.h (find_frame_funname): Add linkname arg.
* top.c (disp_linkname): Define.
(show_disp_linkname): New.
(init_main): Add 'display-linkname' set/show command.
* top.h (disp_linkname): Declare.
* python/py-frame.c(frapy_name): Add linkname to find_frame_funname() call.