From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27341 invoked by alias); 19 Jan 2010 23:40:12 -0000 Received: (qmail 27333 invoked by uid 22791); 19 Jan 2010 23:40:11 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,SPF_HELO_PASS,SPF_PASS 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; Tue, 19 Jan 2010 23:40:06 +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 o0JNe4LE028496 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 19 Jan 2010 18:40:04 -0500 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 o0JNe2hJ014602 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 19 Jan 2010 18:40:03 -0500 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id o0JNe1UP009265 for ; Wed, 20 Jan 2010 00:40:01 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id o0JNe1me009244 for gdb-patches@sourceware.org; Wed, 20 Jan 2010 00:40:01 +0100 Date: Tue, 19 Jan 2010 23:40:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Fix solib-display.exp crash Message-ID: <20100119234001.GA9151@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-01/txt/msg00485.txt.bz2 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 * 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;