From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16976 invoked by alias); 5 Jan 2010 11:32:41 -0000 Received: (qmail 16967 invoked by uid 22791); 5 Jan 2010 11:32:40 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 05 Jan 2010 11:32:34 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 8DFE0290008 for ; Tue, 5 Jan 2010 12:32:32 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WOBTaRYLWBsN for ; Tue, 5 Jan 2010 12:32:32 +0100 (CET) Received: from chinon.act-europe.fr (chinon.act-europe.fr [10.10.0.182]) by mel.act-europe.fr (Postfix) with ESMTP id 7D4F8290001 for ; Tue, 5 Jan 2010 12:32:32 +0100 (CET) Received: by chinon.act-europe.fr (Postfix, from userid 1038) id 5E746D8B88; Tue, 5 Jan 2010 12:32:32 +0100 (CET) Date: Tue, 05 Jan 2010 11:32:00 -0000 From: Tristan Gingold To: gdb-patches@sourceware.org Subject: [RFC] Darwin: add OSO as separate debug files Message-ID: <20100105113232.GA11052@chinon.act-europe.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.9i 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/msg00078.txt.bz2 Hi, in order to correctly handle Darwin OSO files, they are now added as separate debug objfile. This is the Darwin specific use of the previous patch. Tristan. 2009-12-23 Tristan Gingold * machoread.c (macho_add_oso_symfile): Add symfile_flags parameter. Call xstrdup for abfd->filename. Pass symfile_flags and objfile flags to symbol_file_add_from_bfd. Add OSO as separate objfile. (macho_oso_symfile): Add symfile_flags parameter. Pass it to macho_add_oso_symfile. (macho_symfile_read): Pass symfile_flags to macho_oso_symfile. --- gdb/machoread.c | 24 ++++++++++++++++++------ 1 files changed, 18 insertions(+), 6 deletions(-) diff --git a/gdb/machoread.c b/gdb/machoread.c index 81f60ec..534fc94 100644 --- a/gdb/machoread.c +++ b/gdb/machoread.c @@ -292,8 +292,10 @@ oso_el_compare_name (const void *vl, const void *vr) /* Add an oso file as a symbol file. */ static void -macho_add_oso_symfile (oso_el *oso, bfd *abfd, struct objfile *main_objfile) +macho_add_oso_symfile (oso_el *oso, bfd *abfd, + struct objfile *main_objfile, int symfile_flags) { + struct objfile *objfile; struct section_addr_info *addrs; int len; int i; @@ -363,13 +365,22 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd, struct objfile *main_objfile) addrs->other[j].name); } - symbol_file_add_from_bfd (abfd, 0, addrs, 0); + /* Make sure that the filename was malloc'ed. The current filename comes + either from an OSO symbol name or from an archive name. Memory for both + is not managed by gdb. */ + abfd->filename = xstrdup (abfd->filename); + + objfile = symbol_file_add_from_bfd + (abfd, symfile_flags, addrs, + main_objfile->flags & (OBJF_REORDERED | OBJF_SHARED + | OBJF_READNOW | OBJF_USERLOADED)); + add_separate_debug_objfile (objfile, main_objfile); } /* Read symbols from the vector of oso files. */ static void -macho_oso_symfile (struct objfile *main_objfile) +macho_oso_symfile (struct objfile *main_objfile, int symfile_flags) { int ix; VEC (oso_el) *vec; @@ -453,7 +464,8 @@ macho_oso_symfile (struct objfile *main_objfile) && !memcmp (member_name, oso2->name + pfx_len + 1, member_len)) { - macho_add_oso_symfile (oso2, member_bfd, main_objfile); + macho_add_oso_symfile (oso2, member_bfd, + main_objfile, symfile_flags); oso2->name = NULL; break; } @@ -486,7 +498,7 @@ macho_oso_symfile (struct objfile *main_objfile) warning (_("`%s': can't open to read symbols: %s."), oso->name, bfd_errmsg (bfd_get_error ())); else - macho_add_oso_symfile (oso, abfd, main_objfile); + macho_add_oso_symfile (oso, abfd, main_objfile, symfile_flags); ix++; } @@ -670,7 +682,7 @@ macho_symfile_read (struct objfile *objfile, int symfile_flags) /* Then the oso. */ if (oso_vector != NULL) - macho_oso_symfile (objfile); + macho_oso_symfile (objfile, symfile_flags); } static void -- 1.6.5.rc2