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 a symbol_file_clear crash regression


Hi,

there is a recent regression

 PASS: gdb.python/py-value.exp: kill the inferior
-PASS: gdb.python/py-value.exp: Discard the symbols
-PASS: gdb.python/py-value.exp: cast arg0 to PTR
-PASS: gdb.python/py-value.exp: delete PTR type
-PASS: gdb.python/py-value.exp: print value's type
+ERROR: Process no longer exists
+UNRESOLVED: gdb.python/py-value.exp: Discard the symbols
+ERROR: Couldn't send python castval = arg0.cast(ptrtype.pointer()) to GDB.
+UNRESOLVED: gdb.python/py-value.exp: cast arg0 to PTR
+ERROR: Couldn't send python ptrtype = None to GDB.
+UNRESOLVED: gdb.python/py-value.exp: delete PTR type
+ERROR: Couldn't send python print castval.type to GDB.
+UNRESOLVED: gdb.python/py-value.exp: print value's type
 PASS: gdb.python/py-value.exp: continue to breakpoint: break to inspect pointer by reference

by my
	Re: [patch] Fix dangling displays in separate debug
	http://sourceware.org/ml/gdb-patches/2010-04/msg00772.html

as reported by Phil Muldoon.

While I have regression tested it my script is ignoring various flipping
results and unfortunately the ignore rules were too vague and have not caught
this regression.

This bug was mostly unrelated to my dangling-displays patch and it mostly was
not a bug before as nobody was dereferencing objfile pointer that time.

No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu, checked without
the ignore rules.  There is just some problem with gdb.pascal/gdb11492.exp but
that is unrelated to this patch.

Added also a sanity check in free_all_objfiles.  The other possibility would be
to clear objfile from master_so_list when being freed by free_objfile (but that
would be quadratic).


Sorry,
Jan


2010-04-26  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* objfiles.c: Include solist.h.
	(free_all_objfiles): New variable so.  Check stale solist objfiles.
	* symfile.c (symbol_file_clear): Swap the order of free_all_objfiles
	and no_shared_libraries.

--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -53,6 +53,7 @@
 #include "observer.h"
 #include "complaints.h"
 #include "psymtab.h"
+#include "solist.h"
 
 /* Prototypes for local functions */
 
@@ -688,6 +689,11 @@ void
 free_all_objfiles (void)
 {
   struct objfile *objfile, *temp;
+  struct so_list *so;
+
+  /* Any objfile referencewould become stale.  */
+  for (so = master_so_list (); so; so = so->next)
+    gdb_assert (so->objfile == NULL);
 
   ALL_OBJFILES_SAFE (objfile, temp)
   {
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1228,13 +1228,12 @@ symbol_file_clear (int from_tty)
 	  : !query (_("Discard symbol table? "))))
     error (_("Not confirmed."));
 
-  free_all_objfiles ();
-
-  /* solib descriptors may have handles to objfiles.  Since their
-     storage has just been released, we'd better wipe the solib
-     descriptors as well.  */
+  /* solib descriptors may have handles to objfiles.  Wipe them before their
+     objfiles get stale by free_all_objfiles.  */
   no_shared_libraries (NULL, from_tty);
 
+  free_all_objfiles ();
+
   gdb_assert (symfile_objfile == NULL);
   if (from_tty)
     printf_unfiltered (_("No symbol file now.\n"));


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