From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id A0D39382DE3A for ; Wed, 26 Oct 2022 17:57:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A0D39382DE3A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666807036; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YT/W1+WmxATAjuj2fF/I+fxMmlKY7ENwUBn5A9l75WA=; b=Q5/8bdCrmwa1cDhskFT7sKOCuAjWsQty0UWb7QzTf15Sz+h/E9JoDyUnGPVp2Phbd4te5N BMkos9fjuEjv+BypUYbSZeOTjx8pDie6QDwtlZ0CzepGvg53xMl7MFiH0C//SOLPW9WTR+ sTekEGlIrZsNql+fr9xRzhOOhCSvMBM= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-321-OCvuyZeZM860NNRGrU0DwQ-1; Wed, 26 Oct 2022 13:57:15 -0400 X-MC-Unique: OCvuyZeZM860NNRGrU0DwQ-1 Received: by mail-wm1-f70.google.com with SMTP id v191-20020a1cacc8000000b003bdf7b78dccso6484216wme.3 for ; Wed, 26 Oct 2022 10:57:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YT/W1+WmxATAjuj2fF/I+fxMmlKY7ENwUBn5A9l75WA=; b=sJUCejaTWiH/DbsZJolItuAYztkEyeO+rsr7UVEUsPnSo2hp0T+aKZNo6dCKpECesZ IgTgMY58K6QFhNMHVtzpUHcOYSPg46KQDp7Cy61R37uTE9edozOdWvTTFIzMj6MFPZh2 AAXtVo090jDliz6PLcbm2Hva4Zp/EOAZbk4qNtfs90UmnK02eEf7AVnTOdNhWMLW/Ccg Ie010Z6XsiLny1hyfXFOvCtk6Uz6x37zI0gSb8jmuRy1jkTEZryd9+2uaHIuAHjxOUM6 UB2zStssKo0BLs5mHoX2ES2jFtMWUcrnGIlqLf1OvTRyTHlv2F91hLo51PqUR0PMHgLQ AZVg== X-Gm-Message-State: ACrzQf3cRgpIS11fzanpr+Ao8TkKlA6IiudiDO4gMTBITb50+Hyfrc0M +Dm7ns39fh6zSm2WMVoq2yOBUb/FvLFO+AWK9fqK1SqdddECW1kF5ACEoKMUoR+IA2oy41R2WCc Z9XBA1sJHUWD8MzoTU8wBXsOB1ytBpKZ3yolRdo/u X-Received: by 2002:a05:600c:1c08:b0:3c6:e398:64e0 with SMTP id j8-20020a05600c1c0800b003c6e39864e0mr3385549wms.2.1666807033842; Wed, 26 Oct 2022 10:57:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5eIY9HkJMOIKpbwOYhgY4rw9wR7YnSGpT2x/WTVurvc+IzeYEHliejmWBk26rntHZmKfPo6EBgdD2UgjS6RxI= X-Received: by 2002:a05:600c:1c08:b0:3c6:e398:64e0 with SMTP id j8-20020a05600c1c0800b003c6e39864e0mr3385539wms.2.1666807033685; Wed, 26 Oct 2022 10:57:13 -0700 (PDT) MIME-Version: 1.0 References: <20221021000651.413015-1-amerey@redhat.com> <20221022000916.58609-1-amerey@redhat.com> <20221024183809.GB16441@redhat.com> <812188fca24baaa4a14e2cb15dcf2c50cef198c9.camel@klomp.org> In-Reply-To: <812188fca24baaa4a14e2cb15dcf2c50cef198c9.camel@klomp.org> From: Aaron Merey Date: Wed, 26 Oct 2022 13:57:02 -0400 Message-ID: Subject: Re: [PATCH] debuginfod: Support queries for ELF/DWARF sections To: Mark Wielaard Cc: "Frank Ch. Eigler" , elfutils-devel@sourceware.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham 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 Mark, On Wed, Oct 26, 2022 at 11:06 AM Mark Wielaard wrote: > 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. Agreed, will fix. > 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. I like this heuristic. It's simpler and we don't have to update anything if/when a new section becomes common. > 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? We'd save a bit of disk space but complicate the API and often cause client tools to have to do more work to get at the section contents. In the case of .gdb_index, gdb already knows how to read the index from a separate file. Of course it can read the section from an ELF file too but I suspect there might need to be some changes to teach it how to handle "unusual" ELF files that only contain a single section. > Since debuginfod-client.c already includes system.h it can use: > > static inline ssize_t > write_retry (int fd, const void *buf, size_t len) > > Which takes care of partial and/or interrupted write calls. Thanks that's exactly what I'm looking for. Aaron