From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13729 invoked by alias); 9 Apr 2010 20:01:28 -0000 Received: (qmail 12879 invoked by uid 22791); 9 Apr 2010 20:01:26 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=BAYES_00,KAM_STOCKGEN,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; Fri, 09 Apr 2010 20:01:20 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o39K0pHJ029603 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 9 Apr 2010 16:00:51 -0400 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o39K0lYO019687 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 9 Apr 2010 16:00:49 -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 o39K0lP7022781; Fri, 9 Apr 2010 22:00:47 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o39K0kEw022780; Fri, 9 Apr 2010 22:00:46 +0200 Date: Fri, 09 Apr 2010 20:01:00 -0000 From: Jan Kratochvil To: Pedro Alves Cc: gdb-patches@sourceware.org, Tom Tromey Subject: Re: [patch] Fix dangling displays in separate debug Message-ID: <20100409200046.GA22709@host0.dyn.jankratochvil.net> References: <20100403095558.GA22520@host0.dyn.jankratochvil.net> <201004091634.01221.pedro@codesourcery.com> <20100409155249.GA11583@host0.dyn.jankratochvil.net> <201004091747.50536.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201004091747.50536.pedro@codesourcery.com> 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/msg00280.txt.bz2 On Fri, 09 Apr 2010 18:47:50 +0200, Pedro Alves wrote: > On Friday 09 April 2010 16:52:49, Jan Kratochvil wrote: > > - if (SYMBOL_SYMTAB (symbol)->objfile == solib->objfile) > > + symbol_objfile = SYMBOL_SYMTAB (symbol)->objfile; > > + if (symbol_objfile == solib->objfile > > + || symbol_objfile->separate_debug_objfile_backlink > > + == solib->objfile) > > return 1; > > Can't both `symbol_objfile->separate_debug_objfile_backlink' (because > symbol_objfile is the main objfile already) Yes, it can be NULL. > and `solib->objfile' > (because GDB didn't find any symbols for the shared library) be NULL, I was convinced due to some invalid reasons solib->objfile cannot be NULL. > and hence this returns false positives? Yes, there was a regression, thanks for catching it. No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu. Thanks, Jan gdb/ 2010-04-09 Jan Kratochvil Tom Tromey Pedro Alves * printcmd.c (display_uses_solib_p): Check also SEPARATE_DEBUG_OBJFILE_BACKLINK. New variable symbol_objfile. * solist.h (struct so_list) : New comment. * symtab.h (struct general_symbol_info) : Extend the comment. gdb/testsuite/ 2010-04-09 Jan Kratochvil * gdb.base/solib-display.exp (split solib): New. --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1888,6 +1888,7 @@ 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; + struct objfile *symbol_objfile; if (block != NULL && solib_contains_address_p (solib, @@ -1895,7 +1896,11 @@ display_uses_solib_p (const struct display *d, return 1; /* SYMBOL_OBJ_SECTION (symbol) may be NULL. */ - if (SYMBOL_SYMTAB (symbol)->objfile == solib->objfile) + symbol_objfile = SYMBOL_SYMTAB (symbol)->objfile; + if (solib->objfile + && (symbol_objfile == solib->objfile + || symbol_objfile->separate_debug_objfile_backlink + == solib->objfile)) return 1; } endpos -= oplen; --- a/gdb/solist.h +++ b/gdb/solist.h @@ -64,7 +64,12 @@ struct so_list bfd *abfd; char symbols_loaded; /* flag: symbols read in yet? */ char from_tty; /* flag: print msgs? */ - struct objfile *objfile; /* objfile for loaded lib */ + + /* objfile with symbols for a loaded library. Target memory is read from + ABFD. OBJFILE may be NULL either before symbols have been loaded or if + the file cannot be found. */ + struct objfile *objfile; + struct target_section *sections; struct target_section *sections_end; --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -148,7 +148,7 @@ struct general_symbol_info short section; - /* The section associated with this symbol. */ + /* The section associated with this symbol. It can be NULL. */ struct obj_section *obj_section; }; --- a/gdb/testsuite/gdb.base/solib-display.exp +++ b/gdb/testsuite/gdb.base/solib-display.exp @@ -53,6 +53,13 @@ if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != "" return -1 } +set test "split solib" +if {[gdb_gnu_strip_debug $binfile_lib] != 0} { + fail $test +} else { + pass $test +} + gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir