From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10453 invoked by alias); 24 Aug 2007 18:20:39 -0000 Received: (qmail 10283 invoked by uid 22791); 24 Aug 2007 18:20:38 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 24 Aug 2007 18:20:31 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id ABAF39810C; Fri, 24 Aug 2007 18:20:31 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 5E9A39810B; Fri, 24 Aug 2007 18:20:31 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.67) (envelope-from ) id 1IOdlk-0005CT-O1; Fri, 24 Aug 2007 14:20:28 -0400 Date: Fri, 24 Aug 2007 18:20:00 -0000 From: Daniel Jacobowitz To: Jan Kratochvil Cc: gdb-patches@sourceware.org, Roland McGrath Subject: Re: [patch] build-id .debug files load (like .gnu_debuglink) Message-ID: <20070824182028.GA19512@caradoc.them.org> Mail-Followup-To: Jan Kratochvil , gdb-patches@sourceware.org, Roland McGrath References: <20070824180450.GA4216@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070824180450.GA4216@host0.dyn.jankratochvil.net> User-Agent: Mutt/1.5.15 (2007-04-09) 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: 2007-08/txt/msg00466.txt.bz2 On Fri, Aug 24, 2007 at 08:04:50PM +0200, Jan Kratochvil wrote: > Hi, > > Patch improves performance of the separate debug info files verification as it > does not need to read and checksum the whole .debug file, it only reads its id. > > This part may be questionable: > - debugfile = find_separate_debug_file (objfile); > + /* If the file has its own symbol tables it has no separate debug info. */ > + if (objfile->psymtabs == NULL) > + debugfile = find_separate_debug_file (objfile); > > So far .gnu_debuglink existed only in the main file (not the .debug file) and > it existed only if the debug info was stripped to a separate file from it. > debug-id exists always and even both in the main file and the .debug file, > therefore the former code above would deadlock in a loop. Not sure if > `PSYMTABS == NULL' is the right condition. According to my experiments on > GNU/Linux it should be correct. In some cases a library will be left with .symtab but not .debug_info; sometimes elfutils does this, also sometimes it is done deliberately for ld.so / libpthread.so so that the separate debug file is not necessary for minimal debugging to work. We should either pass a flag down so that we know we're already looking at the separate debug file (more efficient, saves us the second search, more work to implement) or else have find_separate_debug_file fail if it finds objfile again. > +/* Locate NT_GNU_BUILD_ID and return its content. > + Separate debuginfo files have corrupted PHDR but SHDR is correct there. */ > + > +static struct build_id * > +build_id_bfd_shdr_get (bfd *abfd) > +{ > + struct build_id *retval; > + > + if (!bfd_check_format (abfd, bfd_object) > + || bfd_get_flavour (abfd) != bfd_target_elf_flavour > + || elf_tdata (abfd)->build_id == NULL) > + return NULL; > + > + retval = xmalloc (sizeof *retval - 1 + elf_tdata (abfd)->build_id_size); > + retval->size = elf_tdata (abfd)->build_id_size; > + memcpy (retval->data, elf_tdata (abfd)->build_id, retval->size); > + > + return retval; > +} This function isn't doing anything with program headers or section headers now, maybe it should be renamed (and the comment doesn't need to talk about corrupted phdrs in that case). I believe the manual needs an update to mention the new search path. -- Daniel Jacobowitz CodeSourcery