From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125588 invoked by alias); 28 Jan 2019 18:53:53 -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 125578 invoked by uid 89); 28 Jan 2019 18:53:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=yes!, D*ca X-HELO: mx2.freebsd.org Received: from mx2.freebsd.org (HELO mx2.freebsd.org) (8.8.178.116) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 28 Jan 2019 18:53:51 +0000 Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 0498F77C83; Mon, 28 Jan 2019 18:53:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3E9927284F; Mon, 28 Jan 2019 18:53:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-3.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 9B7DF7A84; Mon, 28 Jan 2019 18:53:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: [PATCH 1/2] Look for separate debug files in debug directories under a sysroot. To: Simon Marchi Cc: gdb-patches@sourceware.org References: <14397d0976052cba984ffbe8e0a54e37@polymtl.ca> <96b4fb01-d703-ad1b-5ea5-d7e5366f5f6b@polymtl.ca> From: John Baldwin Openpgp: preference=signencrypt Message-ID: <91c7cefc-e186-a82d-d0cf-02975a0306a9@FreeBSD.org> Date: Mon, 28 Jan 2019 18:53:00 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <96b4fb01-d703-ad1b-5ea5-d7e5366f5f6b@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3E9927284F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.994,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US] X-IsSubscribed: yes X-SW-Source: 2019-01/txt/msg00585.txt.bz2 On 1/26/19 9:12 AM, Simon Marchi wrote: > On 2019-01-26 12:16 a.m., Simon Marchi wrote: >> As discussed on IRC, we should probably add the same behavior for >> build-id-based separate debug files. > > I gave a shot to this, here's what I have: > > From 377ef615ad6e2c57966c8853c61cbce95ea6c2b3 Mon Sep 17 00:00:00 2001 > From: Simon Marchi > Date: Sat, 26 Jan 2019 11:34:45 -0500 > Subject: [PATCH] Look for build-id-based separate debug files under the > sysroot > > When looking for a separate debug file that matches a given build-id, > GDB only looks in the host's debug dir (typically /usr/lib/debug). This > patch makes it look in the sysroot as well. This is to match the > behavior of GDB when using debuglink-based separate debug files. > > In the following example, my sysroot is "/tmp/sysroot" and I am trying > to load symbols for > /tmp/sysroot/usr/lib/arm-linux-gnueabihf/gconv/EBCDIC-AT-DE.so. This is > the current behavior: > > (gdb) file /tmp/sysroot/usr/lib/arm-linux-gnueabihf/gconv/EBCDIC-AT-DE.so > Reading symbols from /tmp/sysroot/usr/lib/arm-linux-gnueabihf/gconv/EBCDIC-AT-DE.so... > > Looking for separate debug info (build-id) for /tmp/sysroot/usr/lib/arm-linux-gnueabihf/gconv/EBCDIC-AT-DE.so > Trying /usr/lib/debug/.build-id/f3/d6594d2600e985812cd4ba2ad083ac2aceae22.debug... no, unable to compute real path > > > (No debugging symbols found in /tmp/sysroot/usr/lib/arm-linux-gnueabihf/gconv/EBCDIC-AT-DE.so) > > With this patch: > > (gdb) file /tmp/sysroot/usr/lib/arm-linux-gnueabihf/gconv/EBCDIC-AT-DE.so > Reading symbols from /tmp/sysroot/usr/lib/arm-linux-gnueabihf/gconv/EBCDIC-AT-DE.so... > > Looking for separate debug info (build-id) for /tmp/sysroot/usr/lib/arm-linux-gnueabihf/gconv/EBCDIC-AT-DE.so > Trying /usr/lib/debug/.build-id/f3/d6594d2600e985812cd4ba2ad083ac2aceae22.debug... no, unable to compute real path > Trying /tmp/sysroot/usr/lib/debug/.build-id/f3/d6594d2600e985812cd4ba2ad083ac2aceae22.debug... yes! > Reading symbols from /tmp/sysroot/usr/lib/debug/.build-id/f3/d6594d2600e985812cd4ba2ad083ac2aceae22.debug... > > In the original code, there is a suspicious "abfd.release ()" in > build_id_to_debug_bfd, that I don't understand. If a file with the > right name exists but its build-id note doesn't match, we release (leak) > our reference, meaning the file will stay open? I removed it in the new > code, so that the reference is dropped if we end up not using that file. > I tested briefly by corrupting a separate debug file to trigger this > code, nothing exploded. I think this looks good to me. I think the .release () should have been abfd.reset (nullptr) instead as you noted. I think this isn't the first time we've seen release () used when reset (nullptr) should have been used instead unfortunately. The name of that method is a bit ambiguous unfortunately. Do you want me to pull this into my series or just push it after I push the final version of mine? -- John Baldwin                                                                            Â