From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31826 invoked by alias); 9 Aug 2009 21:37:25 -0000 Received: (qmail 31737 invoked by uid 22791); 9 Aug 2009 21:37:24 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 09 Aug 2009 21:37:17 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n79LbFiV008651 for ; Sun, 9 Aug 2009 17:37:15 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n79LbE7f022570 for ; Sun, 9 Aug 2009 17:37:14 -0400 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n79LbC30023179 for ; Sun, 9 Aug 2009 17:37:14 -0400 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 n79LbCMe014592; Sun, 9 Aug 2009 23:37:12 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id n79LbBre014586; Sun, 9 Aug 2009 23:37:11 +0200 Date: Sun, 09 Aug 2009 21:46:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Cc: Paul Pluzhnikov Subject: [patch] Assertion for a regression by gdb_bfd_unref Message-ID: <20090809213710.GA14354@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) 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: 2009-08/txt/msg00132.txt.bz2 Hi, since Re: Solibs and objfile BFD ownership ownership http://sourceware.org/ml/gdb/2009-08/msg00020.html http://sourceware.org/ml/gdb-cvs/2009-08/msg00013.html there is a regression: CFLAGS=-g ./configure --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=powerpc64-unknown-linux-gnu --enable-targets=i386-unknown-go32 make echo 'main(){}' >1.c;gcc -o 1 1.c -g;./gdb/gdb -nx -ex 'set confirm no' -ex 'file ./1' -ex 'b main' -ex file GNU gdb (GDB) 6.8.50.20090809-cvs Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=powerpc64-unknown-linux-gnu". For bug reporting instructions, please see: . Breakpoint 1 at 0x400480: file 1.c, line 1. Don't know how to run. Try "help target". objfiles.c:1029: internal-error: gdb_bfd_unref: Assertion `p_refcount == NULL || *p_refcount == 1 || *p_refcount == 2' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Aborted With the attached patch the reason is: symfile.c:1642: internal-error: symfile_bfd_open: Assertion `bfd_usrdata (sym_bfd) == NULL' failed. (found it while using --enable-targets=all) Going to post now patches to binutils for bfd/ to fix the bfd_usrdata initialization. Thanks, Jan gdb/ 2009-08-09 Jan Kratochvil * objfiles.c (gdb_bfd_unref): Use the bfd_usrdata accessor. * solib.c (symbol_add_stub): Likewise. * symfile.c (symfile_bfd_open): Assert BFD_USRDATA is NULL. --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -1022,7 +1022,7 @@ gdb_bfd_unref (struct bfd *abfd) if (abfd == NULL) return; - p_refcount = abfd->usrdata; + p_refcount = bfd_usrdata (abfd); /* Valid range for p_refcount: NULL (single owner), or a pointer to int counter, which has a value of 1 (single owner) or 2 (shared). */ @@ -1035,7 +1035,7 @@ gdb_bfd_unref (struct bfd *abfd) return; } xfree (p_refcount); - abfd->usrdata = NULL; /* Paranoia. */ + bfd_usrdata (abfd) = NULL; /* Paranoia. */ name = bfd_get_filename (abfd); if (!bfd_close (abfd)) --- a/gdb/solib.c +++ b/gdb/solib.c @@ -459,7 +459,7 @@ symbol_add_stub (struct so_list *so, int flags) so->objfile = symbol_file_add_from_bfd (so->abfd, flags, sap, OBJF_SHARED); p_refcount = xmalloc (sizeof (*p_refcount)); *p_refcount = 2; /* Both solib and objfile refer to this abfd. */ - so->abfd->usrdata = p_refcount; + bfd_usrdata (so->abfd) = p_refcount; free_section_addr_info (sap); --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1638,6 +1638,9 @@ symfile_bfd_open (char *name) bfd_errmsg (bfd_get_error ())); } + /* bfd_usrdata exists for applications and libbfd must not touch it. + gdb_assert (bfd_usrdata (sym_bfd) == NULL); + return sym_bfd; }