Blame SOURCES/gdb-rhbz1228556-bpt-inlined-func-name-1of2.patch

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