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]

[patch] Fix solib-display.exp crash


Hi,

it is a testsuite regression against gdb-7.0 although the bug was probably
present even in gdb-7.0 (it started to reproduce since one completely
unrelated Daniel J.'s patch).  This patch fixes (-lmcheck may be required):

 PASS: gdb.base/solib-display.exp: display a_global
 PASS: gdb.base/solib-display.exp: display b_global
 PASS: gdb.base/solib-display.exp: display c_global
-ERROR: Process no longer exists
-UNRESOLVED: gdb.base/solib-display.exp: after rerun
-WARNING: remote_expect statement without a default case?!
-FAIL: gdb.base/solib-display.exp: Can't run to main (3)
+PASS: gdb.base/solib-display.exp: after rerun
+PASS: gdb.base/solib-display.exp: after rerun
+PASS: gdb.base/solib-display.exp: break 25
+PASS: gdb.base/solib-display.exp: continue
+PASS: gdb.base/solib-display.exp: display main_global
+PASS: gdb.base/solib-display.exp: display a_local
+PASS: gdb.base/solib-display.exp: display a_static
+PASS: gdb.base/solib-display.exp: break 25
+PASS: gdb.base/solib-display.exp: continue

No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.

The question is whether SYMBOL_SYMTAB (symbol) can be ever NULL at this point.
IMO not, it can be NULL only temporarily during reading symbols.


Thanks,
Jan


2010-01-20  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* printcmd.c (display_uses_solib_p): Remove variable section.  Access
	objfile via SYMBOL_SYMTAB.

--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1888,15 +1888,14 @@ display_uses_solib_p (const struct display *d,
 	{
 	  const struct block *const block = elts[i + 1].block;
 	  const struct symbol *const symbol = elts[i + 2].symbol;
-	  const struct obj_section *const section =
-	    SYMBOL_OBJ_SECTION (symbol);
 
 	  if (block != NULL
 	      && solib_contains_address_p (solib,
 					   block->startaddr))
 	    return 1;
 
-	  if (section && section->objfile == solib->objfile)
+	  /* SYMBOL_OBJ_SECTION (symbol) may be NULL.  */
+	  if (SYMBOL_SYMTAB (symbol)->objfile == solib->objfile)
 	    return 1;
 	}
       endpos -= oplen;


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