|
|
dc7ef9 |
commit 06871ae84096ed1672eb76f44cea4d5dbe79ae24
|
|
|
dc7ef9 |
Author: Pedro Alves <palves@redhat.com>
|
|
|
dc7ef9 |
Date: Wed Sep 20 16:12:54 2017 +0100
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
Make "list ambiguous" show symbol names too
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
Currently, with an ambiguous "list first,last", we get:
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
(gdb) list bar,main
|
|
|
dc7ef9 |
Specified first line 'bar' is ambiguous:
|
|
|
dc7ef9 |
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97
|
|
|
dc7ef9 |
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
This commit makes gdb's output above a bit clearer by printing the
|
|
|
dc7ef9 |
symbol name as well:
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
(gdb) list bar,main
|
|
|
dc7ef9 |
Specified first line 'bar' is ambiguous:
|
|
|
dc7ef9 |
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)"
|
|
|
dc7ef9 |
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)"
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
And while at it, makes gdb print the symbol name when actually listing
|
|
|
dc7ef9 |
multiple locations too. I.e., before (with "set listsize 2"):
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
(gdb) list bar
|
|
|
dc7ef9 |
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97
|
|
|
dc7ef9 |
96
|
|
|
dc7ef9 |
97 int bar (A) { return 11; }
|
|
|
dc7ef9 |
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98
|
|
|
dc7ef9 |
97 int bar (A) { return 11; }
|
|
|
dc7ef9 |
98 int bar (B) { return 22; }
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
After:
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
(gdb) list bar
|
|
|
dc7ef9 |
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)"
|
|
|
dc7ef9 |
96
|
|
|
dc7ef9 |
97 int bar (A) { return 11; }
|
|
|
dc7ef9 |
file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)"
|
|
|
dc7ef9 |
97 int bar (A) { return 11; }
|
|
|
dc7ef9 |
98 int bar (B) { return 22; }
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
Currently, the result of decoding a linespec loses information about
|
|
|
dc7ef9 |
the original symbol that was found. All we end up with is an address.
|
|
|
dc7ef9 |
This makes it difficult to find the original symbol again to get at
|
|
|
dc7ef9 |
its print name. Fix that by storing a pointer to the symbol in the
|
|
|
dc7ef9 |
sal. We already store the symtab and obj_section, so it feels like a
|
|
|
dc7ef9 |
natural progression to me. This avoids having to do any extra symbol
|
|
|
dc7ef9 |
lookup too.
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
gdb/ChangeLog:
|
|
|
dc7ef9 |
2017-09-20 Pedro Alves <palves@redhat.com>
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
* cli/cli-cmds.c (list_command): Use print_sal_location.
|
|
|
dc7ef9 |
(print_sal_location): New function.
|
|
|
dc7ef9 |
(ambiguous_line_spec): Use print_sal_location.
|
|
|
dc7ef9 |
* linespec.c (symbol_to_sal): Record the symbol in the sal.
|
|
|
dc7ef9 |
* symtab.c (find_function_start_sal): Likewise.
|
|
|
dc7ef9 |
* symtab.h (symtab_and_line::symbol): New field.
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
gdb/testsuite/ChangeLog:
|
|
|
dc7ef9 |
2017-09-20 Pedro Alves <palves@redhat.com>
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
* gdb.base/list-ambiguous.exp (test_list_ambiguous_symbol): Expect
|
|
|
dc7ef9 |
symbol names in gdb's output.
|
|
|
dc7ef9 |
* gdb.cp/overload.exp ("list all overloads"): Likewise.
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
### a/gdb/ChangeLog
|
|
|
dc7ef9 |
### b/gdb/ChangeLog
|
|
|
dc7ef9 |
## -1,5 +1,14 @@
|
|
|
dc7ef9 |
2017-09-20 Pedro Alves <palves@redhat.com>
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
+ * cli/cli-cmds.c (list_command): Use print_sal_location.
|
|
|
dc7ef9 |
+ (print_sal_location): New function.
|
|
|
dc7ef9 |
+ (ambiguous_line_spec): Use print_sal_location.
|
|
|
dc7ef9 |
+ * linespec.c (symbol_to_sal): Record the symbol in the sal.
|
|
|
dc7ef9 |
+ * symtab.c (find_function_start_sal): Likewise.
|
|
|
dc7ef9 |
+ * symtab.h (symtab_and_line::symbol): New field.
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
+2017-09-20 Pedro Alves <palves@redhat.com>
|
|
|
dc7ef9 |
+
|
|
|
dc7ef9 |
* linespec.c (minsym_found): Handle non-text minsyms.
|
|
|
dc7ef9 |
(symbol_to_sal): Record a sal.pc for non-block, non-label symbols.
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
Index: gdb-7.6.1/gdb/linespec.c
|
|
|
dc7ef9 |
===================================================================
|
|
|
dc7ef9 |
--- gdb-7.6.1.orig/gdb/linespec.c 2017-10-27 20:44:32.493790183 +0200
|
|
|
dc7ef9 |
+++ gdb-7.6.1/gdb/linespec.c 2017-10-27 20:49:52.460307350 +0200
|
|
|
dc7ef9 |
@@ -3648,6 +3648,7 @@
|
|
|
dc7ef9 |
{
|
|
|
dc7ef9 |
init_sal (result);
|
|
|
dc7ef9 |
result->symtab = SYMBOL_SYMTAB (sym);
|
|
|
dc7ef9 |
+ result->symbol = sym;
|
|
|
dc7ef9 |
result->line = SYMBOL_LINE (sym);
|
|
|
dc7ef9 |
result->pc = SYMBOL_VALUE_ADDRESS (sym);
|
|
|
dc7ef9 |
result->pspace = SYMTAB_PSPACE (SYMBOL_SYMTAB (sym));
|
|
|
dc7ef9 |
@@ -3663,6 +3664,7 @@
|
|
|
dc7ef9 |
/* We know its line number. */
|
|
|
dc7ef9 |
init_sal (result);
|
|
|
dc7ef9 |
result->symtab = SYMBOL_SYMTAB (sym);
|
|
|
dc7ef9 |
+ result->symbol = sym;
|
|
|
dc7ef9 |
result->line = SYMBOL_LINE (sym);
|
|
|
dc7ef9 |
result->pspace = SYMTAB_PSPACE (SYMBOL_SYMTAB (sym));
|
|
|
dc7ef9 |
return 1;
|
|
|
dc7ef9 |
Index: gdb-7.6.1/gdb/symtab.c
|
|
|
dc7ef9 |
===================================================================
|
|
|
dc7ef9 |
--- gdb-7.6.1.orig/gdb/symtab.c 2017-10-27 20:44:32.493790183 +0200
|
|
|
dc7ef9 |
+++ gdb-7.6.1/gdb/symtab.c 2017-10-27 21:02:02.162058159 +0200
|
|
|
dc7ef9 |
@@ -872,6 +872,7 @@
|
|
|
dc7ef9 |
{
|
|
|
dc7ef9 |
sal->pspace = NULL;
|
|
|
dc7ef9 |
sal->symtab = 0;
|
|
|
dc7ef9 |
+ sal->symbol = NULL;
|
|
|
dc7ef9 |
sal->section = 0;
|
|
|
dc7ef9 |
sal->line = 0;
|
|
|
dc7ef9 |
sal->pc = 0;
|
|
|
dc7ef9 |
@@ -2774,6 +2775,7 @@
|
|
|
dc7ef9 |
fixup_symbol_section (sym, NULL);
|
|
|
dc7ef9 |
sal = find_pc_sect_line (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)),
|
|
|
dc7ef9 |
SYMBOL_OBJ_SECTION (sym), 0);
|
|
|
dc7ef9 |
+ sal.symbol = sym;
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
if (funfirstline && sal.symtab != NULL
|
|
|
dc7ef9 |
&& (sal.symtab->locations_valid
|
|
|
dc7ef9 |
@@ -2797,6 +2799,7 @@
|
|
|
dc7ef9 |
sal.pspace = current_program_space;
|
|
|
dc7ef9 |
sal.pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
|
|
|
dc7ef9 |
sal.section = SYMBOL_OBJ_SECTION (sym);
|
|
|
dc7ef9 |
+ sal.symbol = sym;
|
|
|
dc7ef9 |
}
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
if (funfirstline)
|
|
|
dc7ef9 |
Index: gdb-7.6.1/gdb/symtab.h
|
|
|
dc7ef9 |
===================================================================
|
|
|
dc7ef9 |
--- gdb-7.6.1.orig/gdb/symtab.h 2017-10-27 20:44:32.493790183 +0200
|
|
|
dc7ef9 |
+++ gdb-7.6.1/gdb/symtab.h 2017-10-27 21:01:41.522895501 +0200
|
|
|
dc7ef9 |
@@ -1105,6 +1105,7 @@
|
|
|
dc7ef9 |
struct program_space *pspace;
|
|
|
dc7ef9 |
|
|
|
dc7ef9 |
struct symtab *symtab;
|
|
|
dc7ef9 |
+ struct symbol *symbol;
|
|
|
dc7ef9 |
struct obj_section *section;
|
|
|
dc7ef9 |
/* Line number. Line numbers start at 1 and proceed through symtab->nlines.
|
|
|
dc7ef9 |
0 is never a valid line number; it is used to indicate that line number
|