From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 0D20E3854167 for ; Wed, 26 Oct 2022 14:57:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0D20E3854167 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from tarox.wildebeest.org (83-87-18-245.cable.dynamic.v4.ziggo.nl [83.87.18.245]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id C63E43000D9F; Wed, 26 Oct 2022 16:57:36 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id D2EF64129581; Wed, 26 Oct 2022 16:57:35 +0200 (CEST) Message-ID: <812188fca24baaa4a14e2cb15dcf2c50cef198c9.camel@klomp.org> Subject: Re: [PATCH] debuginfod: Support queries for ELF/DWARF sections From: Mark Wielaard To: "Frank Ch. Eigler" , Aaron Merey Cc: elfutils-devel@sourceware.org Date: Wed, 26 Oct 2022 16:57:35 +0200 In-Reply-To: <20221024183809.GB16441@redhat.com> References: <20221021000651.413015-1-amerey@redhat.com> <20221022000916.58609-1-amerey@redhat.com> <20221024183809.GB16441@redhat.com> 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-Spam-Status: No, score=-3033.3 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, On Mon, 2022-10-24 at 14:38 -0400, Frank Ch. Eigler via Elfutils-devel wrote: > - not sure I understand why the code worries about dots in or not in > section names. Why not just pass them verbatim throughout the code > base, and not worry about whether or not there's a dot? Does the > ELF standard even require a dot? I agree that just passing them through as is might be better. The ELF standard doesn't say much about section names, just: Section names with a dot (.) prefix are reserved for the system, although applications may use these sections if their existing meanings are satisfactory. Applications may use names without the prefix to avoid conflicts with system sections. Is/should the section name be URL-encoded? I would drop the maybe_debuginfo_section heuristics. There are some sections like .strtab/.symtab that are probably in the debug file, but might be in the executable. I would assume that a named section can normally be found in the debugfile and only use the executable as fallback. So see if you can find the .debug file, if you can, then look for the section by name. If it isn't SHT_NOBITS you found it. If it is SHT_NOBITS the section should be in the exe. If the section cannot be found by name (in the .debug file) you can stop searching, it also won't be in the exe. If you cannot find the .debug file, or the section was in the .debug file, but had type SHT_NOBITS then search for the exe file and the named section in there. Finally, if the section comes from a file in the cache or if we have to download it in full anyway, then extracting the section into its own file seems slightly wasteful. It would be great if we could just report back "here is the full exe/debug file which does contain the requested section name". But that might make the interface a little ugly. int debuginfod_find_section (debuginfod_client *client, const unsigned char *build_id, int build_id_len, const char *section, char **path, bool *file_is_elf) Maybe that is over-designed to avoid a little bit of disk waste? Cheers, Mark