From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23742 invoked by alias); 28 Jul 2009 15:40:15 -0000 Received: (qmail 23733 invoked by uid 22791); 28 Jul 2009 15:40:14 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Jul 2009 15:40:07 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 9FE7D109FD; Tue, 28 Jul 2009 15:40:04 +0000 (GMT) Received: from caradoc.them.org (209.195.188.212.nauticom.net [209.195.188.212]) by nan.false.org (Postfix) with ESMTP id 4EEEE105BB; Tue, 28 Jul 2009 15:40:04 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1MVomX-00057G-9x; Tue, 28 Jul 2009 11:40:01 -0400 Date: Tue, 28 Jul 2009 15:40:00 -0000 From: Daniel Jacobowitz To: Paul Pluzhnikov , gdb@sourceware.org Subject: Solibs and objfile BFD ownership Message-ID: <20090728154001.GA19451@caradoc.them.org> Mail-Followup-To: Paul Pluzhnikov , gdb@sourceware.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-07/txt/msg00220.txt.bz2 I'm seeing ARM test failures caused by this patch: 2009-03-05 Paul Pluzhnikov * printcmd.c (do_one_display): Reparse exp_string. (display_uses_solib_p): New function. (clear_dangling_display_expressions): New function. (_initialize_printcmd): Add observer. * solib.c (no_shared_libraries): Swap order of calls to clear_solib and objfile_purge_solibs. Specifically this bit: /* The order of the two routines below is important: clear_solib notifies the solib_unloaded observers, and some of these observers might need access to their associated objfiles. Therefore, we can not purge the solibs' objfiles before clear_solib has been called. */ clear_solib (); objfile_purge_solibs (); The problem with doing things in this order is that both the solib and the objfile have a reference to the same BFD. The solib is responsible for releasing it (OBJF_KEEPBFD). arm_objfile_data_cleanup accesses objfile->obfd during free_objfile, to find the number of sections; at that point it's already been free'd. Any thoughts? I could change the ARM code to work around this, but that means banning access to objfile->obfd during a not well specified range of functions. Handing off the ownership of the BFD seems like it would be messy. -- Daniel Jacobowitz CodeSourcery