From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3686 invoked by alias); 16 Nov 2012 19:51:37 -0000 Received: (qmail 3678 invoked by uid 22791); 16 Nov 2012 19:51:36 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_BJ 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, 16 Nov 2012 19:51:25 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qAGJpOfA008238 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 16 Nov 2012 14:51:24 -0500 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qAGJpMuF004971 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 16 Nov 2012 14:51:23 -0500 From: Tom Tromey To: Pedro Alves Cc: Doug Evans , gdb-patches@sourceware.org Subject: Re: RFA: handle "MiniDebuginfo" section References: <87wqxuel5k.fsf@fleche.redhat.com> <87zk2mbym3.fsf@fleche.redhat.com> <877gpp8i67.fsf@fleche.redhat.com> <50A29B8B.7050606@redhat.com> <87r4nx5ih1.fsf@fleche.redhat.com> <87390c40ys.fsf@fleche.redhat.com> <20643.62177.106208.211209@ruffy2.mtv.corp.google.com> <50A4CF6D.40207@redhat.com> Date: Fri, 16 Nov 2012 19:51:00 -0000 In-Reply-To: <50A4CF6D.40207@redhat.com> (Pedro Alves's message of "Thu, 15 Nov 2012 11:18:05 +0000") Message-ID: <87r4nttjgl.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: 2012-11/txt/msg00474.txt.bz2 >>>>> "Pedro" == Pedro Alves writes: Pedro> I disagree with artificially making this ELF only. What you find Pedro> stuffed in a .gnu_debugdata section is just another file that Pedro> would otherwise be loadable by gdb if it was separate on the Pedro> filesystem. IOW, stuffing the file as compressed binary blob Pedro> into .gnu_debugdata is just a replacement for making the file Pedro> really separate on the file system. There's really nothing Pedro> container-specific (coff/elf,whatnot) in this. What if we require the contents to have the same BFD flavour as the container? Like the appended. I think this might address Doug's critique -- not sure -- while retaining both some flexibility and some sanity. Really, though, nobody is going to use this outside of ELF. I think it mildly unlikely, though not impossible, that any distros outside the Fedora universe will even pick it up. Tom diff --git a/gdb/minidebug.c b/gdb/minidebug.c index 8e1362f..1b75ead 100644 --- a/gdb/minidebug.c +++ b/gdb/minidebug.c @@ -259,6 +259,9 @@ find_separate_debug_file_in_section (struct objfile *objfile) asection *section; bfd *abfd; + if (objfile->obfd == NULL) + return NULL; + section = bfd_get_section_by_name (objfile->obfd, ".gnu_debugdata"); if (section == NULL) return NULL; @@ -271,6 +274,14 @@ find_separate_debug_file_in_section (struct objfile *objfile) if (!bfd_check_format (abfd, bfd_object)) { + warning (_("Cannot parse .gnu_debugdata section; not a BFD object")); + gdb_bfd_unref (abfd); + return NULL; + } + + if (bfd_get_flavour (objfile->obfd) != bfd_get_flavour (abfd)) + { + warning (_("Cannot parse .gnu_debugdata section; wrong file format")); gdb_bfd_unref (abfd); return NULL; }