amitshah / rpms / gdb

Forked from rpms/gdb 2 years ago
Clone
Blob Blame History Raw
http://sourceware.org/ml/gdb-patches/2010-01/msg00485.html
Subject: [patch] Fix solib-display.exp crash

[ Made more safe for downstream patch + ported for VLA.  ]

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.

Index: gdb-7.0.50.20100121/gdb/parse.c
===================================================================
--- gdb-7.0.50.20100121.orig/gdb/parse.c	2010-01-21 15:16:15.000000000 +0100
+++ gdb-7.0.50.20100121/gdb/parse.c	2010-01-21 15:21:45.000000000 +0100
@@ -1425,6 +1425,10 @@ operator_check_standard (struct expressi
 	if (section && objfile_func && (*objfile_func) (section->objfile, data))
 	  return 1;
 
+	/* SYMBOL_OBJ_SECTION (symbol) may be NULL.  */
+	if (SYMBOL_SYMTAB (symbol) && objfile_func && (*objfile_func) (SYMBOL_SYMTAB (symbol)->objfile, data))
+	  return 1;
+
 	/* Check objfile where is placed the code touching the variable.  */
 	objfile = block_objfile (block);