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 BCFBD3858D33 for ; Thu, 9 Mar 2023 00:26:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BCFBD3858D33 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=1678321596; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mGQrumHXjiLyf+eRroUzyXB/MOD+WFQxI+OGw9BtCcY=; b=RHys1mcDHc1M1TaZiwlXtujHKW5iBnNabzMQhgTYyeljukdbuUSF820C+jF/e0rS6lB8x3 ySxSfy4Ivi6uNvFUgZ1w38qX+hA8QVQeojKeA/7YKAbg/MsHv3TgWgRFRHqJheREMCRi6c YQjlWujrE0rV0rheVmmlAAqteXxbSsA= Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-433-Te2xqrOVPtGJfgJuSb1Mtg-1; Wed, 08 Mar 2023 19:26:34 -0500 X-MC-Unique: Te2xqrOVPtGJfgJuSb1Mtg-1 Received: by mail-pf1-f198.google.com with SMTP id i7-20020a626d07000000b005d29737db06so266169pfc.15 for ; Wed, 08 Mar 2023 16:26:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678321593; h=content-transfer-encoding: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=mGQrumHXjiLyf+eRroUzyXB/MOD+WFQxI+OGw9BtCcY=; b=S/AYwbfm7MrYhIAuzaTEIIx6QsylVO9Z1dkMDPyryc2LT3K6ckQ0oocmGW8MfZQXB0 j06+1NvcX9y69Q3D73zZjoQv8gvfxwHsWjolSy99zolsD2RvzR6yRSZvzv73DirpZ9qT gvzGoOzgzkcz8X76hDgX7qqhmCM1b25AQTy9uCYzL+R8w9v7fZbtrsGG6wUQZCu0S0Ex FQj6R3JfriCcT7Wcl3rIgls64DScST16lnGiByoA5FQO4zWEnS08yTfIf5KmfRlc8zRM KxNyB950uw56cCIfZY/dfkdM3f8noDCqWV8zU7f3yJr+EOHi1aRoEmNR1ALtP1e6qyX2 aIFg== X-Gm-Message-State: AO0yUKUdSnyg5drMeJ/0Eh6PK4FHBhQ1DVM9KHbCYBp7149cTBJJDqCJ MVS/lPRD6Z92gWXQ7cbfyiOzlANlMgZ4yCadfbU72rDBCYa/q5we2p7sv41t5VN65aH4aO66TDc 5BeSl0tujybynwkUXnzFvmf93cX1YrdHfxryi X-Received: by 2002:a17:902:bd81:b0:19a:b98f:46a0 with SMTP id q1-20020a170902bd8100b0019ab98f46a0mr10251186pls.0.1678321593592; Wed, 08 Mar 2023 16:26:33 -0800 (PST) X-Google-Smtp-Source: AK7set/KBtdwTYmjlT3FXlQU9w8hXzfI1eZ6GAf/Q4EYsqI2p8regL7rCylZOTgrNiSzJSGJrVqC/wzcsKlGqMHxRfk= X-Received: by 2002:a17:902:bd81:b0:19a:b98f:46a0 with SMTP id q1-20020a170902bd8100b0019ab98f46a0mr10251176pls.0.1678321593272; Wed, 08 Mar 2023 16:26:33 -0800 (PST) MIME-Version: 1.0 References: <20230227194212.348003-1-amerey@redhat.com> <20230227194212.348003-7-amerey@redhat.com> <87ilfcqoxn.fsf@tromey.com> In-Reply-To: <87ilfcqoxn.fsf@tromey.com> From: Aaron Merey Date: Wed, 8 Mar 2023 19:26:22 -0500 Message-ID: Subject: Re: [PATCH 7/7] gdb/debuginfod: Add .debug_line downloading To: Tom Tromey Cc: Aaron Merey via Gdb-patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.0 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: On Tue, Mar 7, 2023 at 3:36=E2=80=AFPM Tom Tromey wrote: > > >>>>> "Aaron" =3D=3D Aaron Merey via Gdb-patches writes: > > Aaron> This patch adds functions read_formatted_entries_separate and > Aaron> dwarf_decode_line_header_separate. They are similar to > Aaron> read_formatted_entries and dwarf_decode_line_header except that th= ey are > Aaron> able to work with .debug_line sections originating from separately > Aaron> downloaded files. > > I think there has to be some other refactoring to avoid duplicating code > in this patch. Copying ~300 lines like that seems bad, especially > considering they'll need parallel updates whenever we find bugs, when > DWARF changes, etc. Will do. > > Aaron> + gdb::unique_xmalloc_ptr line_path; > Aaron> + scoped_fd line_fd =3D debuginfod_section_query (build_id->data, > Aaron> + build_id->size, > Aaron> + bfd_get_filename > Aaron> + (objfile->obfd.= get ()), > Aaron> + ".debug_line", > Aaron> + &line_path); > > For gdb's purposes, it's a shame debuginfod works explicitly on sections > and not as more of a locally-caching filesystem-like API. With the > latter we would perhaps have very little or nothing to do to make this > work, provided we were careful to keep the gdb-index code lazy about > reading sections. Also, inside gdb, all the sharing across inferiors > and such would automatically work. The cost would be whatever BFD > requests when identifying a file, not sure how much data that is. That's an interesting idea. Though I wonder if the extra latency from possibly many more small, frequent transfers outweighs the benefits over downloading just .gdb_index and maybe .debug_line and the full debuginfo. > > Anyway, back to current reality -- the DWARF reader already does try to > lazily map section data. So I think one big question is, why can't this > be the mechanism for all the sections with debuginfod? That is, stick > the debuginfod calls into dwarf2_section_info::read. I don't know what > the debuginfod client does under the hood, but if it doesn't cache this > data somewhere, perhaps gdb could. Debuginfod does cache sections. But before the full debuginfo is downloade= d gdb only knows about sections present in the solib binary. This won't include any .debug_* sections (otherwise gdb wouldn't be using debuginfod here). I think to make this work debuginfod would have to provide the section header table too? Since .debug_info is so connected to the other .debug_* sections do we have much to gain by downloading sections separately once we know we'll need the .debug_info? At that point we might as well just download the whole file. Thanks for reviewing these patches. Aaron