This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Fix gdb segv in dw2_find_pc_sect_symtab


Hi.

While testing my search_symbols speedup patch I hit a gdb segv,
and traced it to the fact that addresses of minsyms can appear
in psymtabs_addrmap but not appear in the symtab blockvectors.

This patch fixes this by using the symtab found from
psymtabs_addrmap if a symtab isn't found in the blockvectors.

Ok to check in?

2012-05-25  Doug Evans  <dje@google.com>

	* dwarf2read.c (dw2_find_pc_sect_symtab): If symtab isn't found in
	blockvector, use symtab from psymtabs_addrmap.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.655
diff -u -p -r1.655 dwarf2read.c
--- dwarf2read.c	22 May 2012 18:45:22 -0000	1.655
+++ dwarf2read.c	25 May 2012 07:13:41 -0000
@@ -3029,7 +3029,7 @@ dw2_find_pc_sect_symtab (struct objfile 
 			 int warn_if_readin)
 {
   struct dwarf2_per_cu_data *data;
-  struct symtab *result;
+  struct symtab *bv_symtab, *addrmap_symtab;
 
   dw2_setup (objfile);
 
@@ -3044,9 +3044,14 @@ dw2_find_pc_sect_symtab (struct objfile 
     warning (_("(Internal error: pc %s in read in CU, but not in symtab.)"),
 	     paddress (get_objfile_arch (objfile), pc));
 
-  result = recursively_find_pc_sect_symtab (dw2_instantiate_symtab (data), pc);
-  gdb_assert (result != NULL);
-  return result;
+  /* This is the symtab recorded in psymtabs_addrmap.
+     If we don't find a more specific symtab via the blockvector,
+     use this one.  */
+  addrmap_symtab = dw2_instantiate_symtab (data);
+  bv_symtab = recursively_find_pc_sect_symtab (addrmap_symtab, pc);
+  if (bv_symtab != NULL)
+    return bv_symtab;
+  return addrmap_symtab;
 }
 
 static void


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]