From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id pt0oFM0qsV90QgAAWB0awg (envelope-from ) for ; Sun, 15 Nov 2020 08:19:09 -0500 Received: by simark.ca (Postfix, from userid 112) id 463C81F08B; Sun, 15 Nov 2020 08:19:09 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI,RDNS_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id EE9DF1E552 for ; Sun, 15 Nov 2020 08:19:08 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2E9EF3857815; Sun, 15 Nov 2020 13:19:08 +0000 (GMT) Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id E8AC43857C7D for ; Sun, 15 Nov 2020 13:19:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E8AC43857C7D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mark@klomp.org Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 9DE52302BBED; Sun, 15 Nov 2020 14:19:03 +0100 (CET) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 54C1E40007C3; Sun, 15 Nov 2020 14:19:03 +0100 (CET) Message-ID: Subject: Re: [PATCH] Search for DWZ files in debug-file-directories as well From: Mark Wielaard To: Sergio Durigan Junior , gdb-patches@sourceware.org Date: Sun, 15 Nov 2020 14:19:03 +0100 In-Reply-To: <20201114234842.2334396-1-sergiodj@sergiodj.net> References: <20201114234842.2334396-1-sergiodj@sergiodj.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.28.5 (3.28.5-10.el7) Mime-Version: 1.0 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Hi Sergio, On Sat, 2020-11-14 at 18:48 -0500, Sergio Durigan Junior wrote: > Separate debug info file: /usr/lib/debug/.dwz/x86_64-linux-gnu/coreutils.= debug > [...] > It occurred to me that a good way to workaround this problem is to > actually try to locate the DWZ alt debug file inside the > debug-file-directories (that were likely provided by the user). So > this is what the proposed patch does. >=20 > The idea here is simple: get the filename extracted from the > .gnu_debugaltlink section, and manipulate it in order to replace the > initial part of the path (everything before "/.dwz/") by whatever > debug-file-directories the user might have provided. >=20 > I talked with Mark Wielaard and he agrees this is a sensible > approach. > In fact, apparently this is something that eu-readelf also does. I double checked what elfutils libdw (the dwfl interface) does for alt files. In general it tries to find them similar to how .debug files are found described in libdwfl.h under *** Standard callbacks ***: https://sourceware.org/git/?p=3Delfutils.git;a=3Dblob;f=3Dlibdwfl/libdwfl.h= ;hb=3DHEAD#l242 Then for alt files it also looks for a .dwz subdir to find the basename of the alt file. Which is close to what you are proposing. But your version would also find alt files in (arch) subdirs of the .dwz dir. Which seems to be an extension of Debian/Ubuntu. In Fedora/CentOS the arch is part of the basename (e.g. the elfutils supplemental file is called elfutils-0.179-1.fc32.i386 or elfutils-0.182-1.fc33.x86_64). It might make sense to match what you are doing if the alt file path contains /.dwz/ and has any directories after it (presumably representing the arch). Cheers, Mark