From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32664 invoked by alias); 26 Apr 2010 14:51:20 -0000 Received: (qmail 32640 invoked by uid 22791); 26 Apr 2010 14:51:18 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 26 Apr 2010 14:51:13 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o3QEpBEa023783 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 26 Apr 2010 10:51:11 -0400 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3QEp9Ds009950 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 26 Apr 2010 10:51:11 -0400 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o3QEp9fR009910 for ; Mon, 26 Apr 2010 16:51:09 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o3QEp8F1009909 for gdb-patches@sourceware.org; Mon, 26 Apr 2010 16:51:08 +0200 Date: Mon, 26 Apr 2010 14:51:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Fix a symbol_file_clear crash regression Message-ID: <20100426145108.GA9357@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-08-17) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-04/txt/msg00871.txt.bz2 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 * 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"));