From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12848 invoked by alias); 18 Mar 2014 13:22:12 -0000 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 Received: (qmail 12832 invoked by uid 89); 18 Mar 2014 13:22:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Mar 2014 13:22:10 +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 s2IDM67r017145 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 18 Mar 2014 09:22:06 -0400 Received: from [10.36.116.47] (ovpn-116-47.ams2.redhat.com [10.36.116.47]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s2IDM5E5013551; Tue, 18 Mar 2014 09:22:05 -0400 Subject: Re: New feature "source-id" From: Mark Wielaard To: Gerhard Gappmeier Cc: gdb-patches@sourceware.org In-Reply-To: <7365721.BnaR1nHazz@lt-gergap> References: <7365721.BnaR1nHazz@lt-gergap> Content-Type: text/plain; charset="UTF-8" Date: Tue, 18 Mar 2014 13:22:00 -0000 Message-ID: <1395148924.27876.20.camel@bordewijk.wildebeest.org> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-03/txt/msg00412.txt.bz2 Hi Gerhard, On Sat, 2014-03-15 at 11:49 +0100, Gerhard Gappmeier wrote: > The idea is that when you need to debug an executable or opening a coredump of > an executable that was built with "source-id" and "build-id" enabled it just > works. You don't need to care about how and where to get debug symbols and the > correct sources. I was wondering how this would work together with what distros like Fedora do right now to solve this same issue of finding the corresponding source files. Distros, at least those based on rpm, rely on the build-id and DWARF debug information. For each executable/library they record the build-id and strip the symbol table and debug information in a separate .debug file. The debug Compile Unit and DWARF line table reference the source files used to build the executable file. These files are collected and put under /usr/src/debug//.... Then they run debugedit [1] on the .debug files to replace all file references to the files under /usr/src/debug/... Both the .debug files (placed under /usr/lib/debug/) and the source files are then bundled together in the -debuginfo.rpm (including the necessary build-id directories). That way you can use the build-id from the ELF note section to retrieve both the separate .debug files and the corresponding source files. And on my distro gdb even helpfully suggests how to do this: Missing separate debuginfos, use: debuginfo-install at-3.1.13-14.fc20.x86_64 Which will then fetch the debuginfo package and all dependencies so gdb can find the .debug files and the corresponding source code those .debug files refer to. I don't know if the debuginfo-install suggestion is upstream or only in the distro package of gdb. > * We need to make the new section ".note.gnu.source-id" official. I don't know > who maintains this and this needs to be registered somewhere. > [...] > * adding file hashes (SHA1) for each source file to the debug info. This way > we can completely remove the mtime check and replace it with a check of the > SHA1 sum. When we can replace the existing warning with a message like "The > source file does not match the executable." For DWARF5 there is a proposal to add the MD5 digest to debug-line file table: http://dwarfstd.org/ShowIssue.php?issue=130701.1 Would that be a good alternative location to store the hash of the source file? Cheers, Mark [1] http://rpm.org/gitweb?p=rpm.git;a=blob;f=tools/debugedit.c;hb=HEAD