From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13337 invoked by alias); 4 Dec 2008 15:39:27 -0000 Received: (qmail 13325 invoked by uid 22791); 4 Dec 2008 15:39:27 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate4.de.ibm.com (HELO mtagate4.de.ibm.com) (195.212.29.153) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Dec 2008 15:38:29 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate4.de.ibm.com (8.13.8/8.13.8) with ESMTP id mB4FcRZr113462 for ; Thu, 4 Dec 2008 15:38:27 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id mB4FcQuB4034614 for ; Thu, 4 Dec 2008 16:38:26 +0100 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id mB4FcQGR007138 for ; Thu, 4 Dec 2008 16:38:26 +0100 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id mB4FcQsB007133; Thu, 4 Dec 2008 16:38:26 +0100 Message-Id: <200812041538.mB4FcQsB007133@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Thu, 4 Dec 2008 16:38:26 +0100 Subject: Re: [RFC] solib for darwin To: gingold@adacore.com (Tristan Gingold) Date: Thu, 04 Dec 2008 15:39:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <32200CDA-AAC3-49CE-BD9C-AE51738DAAF1@adacore.com> from "Tristan Gingold" at Dec 03, 2008 01:53:58 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: 2008-12/txt/msg00069.txt.bz2 Tristan Gingold wrote: > solib.c:solib_bfd_open explicitly checked that the format is a > bfd_object. As this might not be true > on Darwin, I added a new solib target which does the check. On > Darwin, it may also extract the right > binary from the fat binary. > > As it is not easy to retrieve the right member from a filename, > solib.c:symbol_add_stub calls > symbol_file_add_from_bfd instead of symbol_file_add. I think this is > still a good idea not to have > 2 bfd for the same file. But this also implies that the bfd must be > closed only once. So I added a new > flag, OBJF_KEEPBFD that prevent objfile.c from bfd_close-ing the bfd > of an objfile. Interesting; I've been running into the same problem with supporting SPU contexts as libraries in the context of the multi-architecture Cell debugger. However, instead of just overriding the bfd_check_format call (which b.t.w. does a lot more than just checking the format, no matter its name :-/), I've allowed the solib implementation to override the whole solib_bfd_open call; this seems to provide more options for future changes ... I've been wondering about the two bfds as well; note that solib simply mirrors what is being done for the main executable file (where we have one bfd for the exec file and one for the symbol file). With my patch I've kept two bfds, but call the solib override implementation to open each of them. Maybe you can have a look at my patch: http://sourceware.org/ml/gdb-patches/2008-09/msg00136.html and see whether this would solve your problem as well (or if we can come up with a joint approach to solve both problems). Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com