[PATCH 0/2] Make "list ambiguous" show symbol names too

Pedro Alves
2017-09-04T18:47:46Z

This series makes "list ambiguous" a bit clearer by printing the
symbol name for each of the ambiguous locations as well:

(gdb) list bar,main
Specified first line 'bar' is ambiguous:
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)"
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)"
^^^^^^^^^^^^^^^^^

(gdb) list bar
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)"
96
97 int bar (A) { return 11; }
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)"
97 int bar (A) { return 11; }
98 int bar (B) { return 22; }
^^^^^^^^^^^^^^^^^

The "symbol: ..." parts above are new. That's patch #2.

While working on that, I decided to test also the case of "list
ambiguous_global_variable", which exposed the fact that that doesn't
really work... So I fixed it too. That's patch #1.

Tested on x86-64 Fedora 23.

Pedro Alves (2):
Fix "list ambiguous_variable"
Make "list ambiguous" show symbol names too

gdb/cli/cli-cmds.c | 29 ++++++++++----
gdb/linespec.c | 63 +++++++++++++++++++------------
gdb/symtab.c | 2 +
gdb/symtab.h | 1 +
gdb/testsuite/gdb.base/list-ambiguous.exp | 41 +++++++++++---------
gdb/testsuite/gdb.base/list-ambiguous0.c | 5 ++-
gdb/testsuite/gdb.base/list-ambiguous1.c | 5 ++-
gdb/testsuite/gdb.cp/overload.exp | 4 +-
8 files changed, 93 insertions(+), 57 deletions(-)

--
2.5.5