public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] Fix a symbol_file_clear crash regression
Date: Mon, 26 Apr 2010 14:51:00 -0000	[thread overview]
Message-ID: <20100426145108.GA9357@host0.dyn.jankratochvil.net> (raw)

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"));

             reply	other threads:[~2010-04-26 14:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-26 14:51 Jan Kratochvil [this message]
2010-04-27 17:33 ` Tom Tromey
2010-04-27 20:07   ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100426145108.GA9357@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).