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