From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ZMZyHhQvf2purSUAWB0awg (envelope-from ) for ; Fri, 14 Aug 2026 11:07:00 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fkUfnipw; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 662A81E09B; Fri, 14 Aug 2026 11:07:00 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id F362A1E09B for ; Fri, 14 Aug 2026 11:06:58 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C8B3E4BA9037 for ; Fri, 14 Aug 2026 15:06:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C8B3E4BA9037 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fkUfnipw Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id A02544BA7983 for ; Fri, 14 Aug 2026 15:06:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A02544BA7983 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A02544BA7983 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786719985; cv=none; b=aI1P7LTyq4AAIxdrDmplA2edRmSYut4eqB67qrL3pJ2ryJzpMuP9C1+Nqn650dqfrxViBeMXTYe9JdY1z/XNzL0eLUosF6fahRgPOzw3KTJhd3cJdFZk0rcnc7ZK6+ugYI4d8eenxbP+noUM3nLYa3YewQjSrgCtHYnJLHsKDok= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786719985; c=relaxed/simple; bh=slhOn87gcrXcCHEjZBIaYdINl+rd319gc3XwnAEbNnc=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=igzTwWPd+VJlSCRO+kxt7FhtsktSI3fWcNP2i0FDBewDsE+myHZApn12nDtmXeCJj1NRaBc3zUNBbkSvv53gkdYRro0HpvJg+CZqgDNsRT9w2O7uq/ysWvUyDnDmV8tcH3cfUdi6S2z22FSl3dqZb9Uy1o4Q+/ndHvKpGZVA+rA= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fkUfnipw DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A02544BA7983 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786719985; 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; bh=SYdYk7lgmJLbQ+K2IxcP+u6bAQ+ruN3sm7UcycZzOOs=; b=fkUfnipwNFZcCmm7JUYOw23JOXYxm4CCmd68hlxMKu19Ppe8RiHqCuOt3edivpVpusFD8W 97l91A+k29g4YpQB6uIPAq7pXnw6KMJ6lt4M8BtA9l7+APbscb1JctyzpVJOdIkNB6qXF5 eDXHaRI8BX11I6MUntZi4A2aNLqhQYk= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-227-o8Cai1b_PPaUonZrhlB2kw-1; Fri, 14 Aug 2026 11:06:21 -0400 X-MC-Unique: o8Cai1b_PPaUonZrhlB2kw-1 X-Mimecast-MFC-AGG-ID: o8Cai1b_PPaUonZrhlB2kw_1786719980 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4956c1655c3so5423585e9.0 for ; Fri, 14 Aug 2026 08:06:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786719980; x=1787324780; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=SYdYk7lgmJLbQ+K2IxcP+u6bAQ+ruN3sm7UcycZzOOs=; b=Ld8vhhc84XAEYYq1SdCNXA18Mg1C1SWN2s2FdLueBMsJHx970a/ftIxRmuF8Ny65wZ 4VrNGUFw274ivj5CiyKKycUJHL6pzVUrNw200E8KfcQ0V1Jp8P0DqhMl66H/t4Dpu/ww FXpMDCQYJDVFEMBqrqvj65oDac1uBwkzgRvdfFM7OulTxtWm/X3tbwmKfF/0TbPwzoH/ o227VqcHIZf86aoJiVl0ARkFdNicpeNCibSoL1X4bQ/XRs2iLE3YSM0mOl7mFPiquT44 i8j/q5Av6dGBobZHydG5fzjJNDd5C0+CcblEYbX2zJ3ZOs+PHMzOTIgMBhYikyXEYlqS udWA== X-Gm-Message-State: AOJu0YyC6Ht/heDAEq6YbS0NsLgi/Umnkb5Yit0fd5iXXVj6WOo8Yn1U AzjLuuwIkdBlcLbogv6HnyUc3zmYKdD46oPi9uNtuJWonu+XLT+9htvhiklr9PIZvPvqvTHzIG0 coiELyDhSIzDZLRw8M4b8PEMyaHC6QErwwlWeIm4TzaIlEuye+5uNmtin7xnZ8DgjNRNK3zc+Mr gzwXcPVPMlz10TPK2nKtleYfH71aZGfccaKHRrLm4oSVtRY4Q= X-Gm-Gg: AR+sD1246pcsJm7L/JAhE/MmkeeQSzSyzxTs1J7ySe9R9qv5bw6Tn5tOTLZaNi4MtnD avEKQA2sOHNIjIU6U25k4VAt6fue/oH35/JaOqtEuc8oR3g/HvS10ZvuVmig2bGlu9OKoIqEoY9 17FL54EZc3COtZ75ePJn064+bkgh98T3NsT1w/ooMeujRlABLneFVhrJ9XU+5fU8kg/WsrHl9jM 4gBM7nSyyIscZ/55LXthECe9Ey0ytXGCi5vmtCZgdD0T8A6m7aAEqvYrE2jTcTqJ4egOXNLfD/M 6IjxHncHCEVClgqGaoVgNNXr5nJz8IcTRt48XoVOAaL2rfoajd4GRBr6KsnX1k6W4vB27l27JGq b8QJP9HDi7+k1V2V6JXk= X-Received: by 2002:a05:600c:4f09:b0:499:8af5:d97b with SMTP id 5b1f17b1804b1-4998af5d9famr26900815e9.10.1786719980052; Fri, 14 Aug 2026 08:06:20 -0700 (PDT) X-Received: by 2002:a05:600c:4f09:b0:499:8af5:d97b with SMTP id 5b1f17b1804b1-4998af5d9famr26899025e9.10.1786719979351; Fri, 14 Aug 2026 08:06:19 -0700 (PDT) Received: from localhost (67.72.115.87.dyn.plus.net. [87.115.72.67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4998ca63e5csm102245e9.2.2026.08.14.08.06.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2026 08:06:18 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [RFC 0/3] Deferred, or on-demand, debuginfod downloading Date: Fri, 14 Aug 2026 16:06:05 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: -Cmv9cO3guiKGORKtrJC4xsY_GbHMQTVmbuczECS_eE_1786719980 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Hi! A while ago some patches were posted that added deferred debug info downloading to GDB. The latest iteration of these patches can be found here: https://inbox.sourceware.org/gdb-patches/20250124152858.2085187-1-amerey@redhat.com There was some great work done in the first cut of this work, however, the series never really got much review attention, and the work ended up on hold. I've spent some time recently trying to move these patches forward to a place where they might be ready to merge. Progress seemed to be going OK, except for one issue which, right now, seems like a truely nasty problem, my current fix for which does not feel good. So I wanted to share the current work with the community to see if anyone has any ideas for a better solution. But before we get into the problems, a quick summary of what changed since the previous version. The biggest change is testing. The original series has a single test which checked the standard basic use case. That test was fine, but there were a lot of changes in the patch which were not covered by that test. So I worked through the patch trying to ensure that every single change was covered by a test. I cannot guarantee 100% coverage, but I do think that most stuff is now covered by a test case. Doing this meant I found some small pieces which were not needed, probably left overs from earlier iterations. Having written all the tests it was much easier to do some minor refactoring to move checks into better locations, which allowed some redundancy to be removed. But these were all pretty minor clean ups. The core idea behind the patch remains unchanged. When we find a objfile without debug information we ask debuginfod for the .gdb_index section from the debug info file. If the section arrives then we attach this to the original objfile and treat this as a debug index. Later when we get a "hit" in this .gdb_index we download the full debug info file, attach this new objfile to GDB, and then repeat the lookup within the new objfile, this can then find the full debug info entry (if possible). Finally, we remove the .gdb_index quick function lookup from the original objfile, any future lookups will naturally be serviced by the debug info objfile that was just added. The original series also included a third patch that made is possible for GDB to do an early download of .debug_line too, this could be used for creating file/line breakpoints without the need for the full debug info. I have not yet incorporated those changes into this series. So, what's the problem? The issue is when the debug info objfile is added to GDB. Adding a new objfile triggers the Python new_objfile event listener, which can then run user code. User code can easily trigger a frame cache flush. This is a problem because the deferred debug info downloading almost always happens while GDB is building the backtrace. That is where patch #1 of this series comes from. It's an initial attempt at allowing GDB to handle frame cache flushes while building the backtrace. This works by wrapping a bunch of functions with a loop. The functions all take a frame_info_ptr object. If while executing the body of the function the frame cache is flushed then GDB will spot this and go back around the loop. The hope is that any new debug info will be added in the first iteration, triggering cache flushes, then on the second iteration there will be no new debug info added, so GDB will manage to exit the loop. Clearly we don't want GDB looping forever, so if the frame cache does end up being flushed a second time, triggering a third loop iteration, then GDB will throw an error. This approach works well enough, but something about it doesn't "feel" right with me. For one thing, it feels like there are likely other places in GDB where this sort of bug might reside, but we'll likely not find them until some random point in the future where we encounter the right combination of deferred debug download and new objfile observer. What feedback do I want? I'd love people to give their thoughts on the general appraoch taken, both in patch #1, and in patch #3. Also, do people have any ideas for better approaches? Basically, all feedback is welcome. Thanks, Andrew --- Aaron Merey (2): gdb: use basic_safe_range to iterate over objfile::qf gdb/debuginfod: support on-demand debuginfo downloading Andrew Burgess (1): gdb: limited support for frame cache flushing while building stack gdb/ctfread.c | 4 +- gdb/dwarf2/index-cache.c | 22 +- gdb/dwarf2/index-cache.h | 11 + gdb/dwarf2/public.h | 12 + gdb/dwarf2/read-gdb-index.c | 185 +++++++++++++ gdb/dwarf2/read-gdb-index.h | 9 + gdb/dwarf2/read.c | 185 ++++++++++++- gdb/dwarf2/read.h | 9 + gdb/elfread.c | 3 +- gdb/frame.c | 176 ++++++++++--- gdb/jit.c | 4 +- gdb/objfile-flags.h | 4 + gdb/objfiles.h | 51 +++- gdb/symfile-debug.c | 43 +-- gdb/symfile.c | 4 +- .../gdb.debuginfod/deferred-auto-load-lib.c | 26 ++ .../deferred-auto-load-py-script.h | 41 +++ .../gdb.debuginfod/deferred-auto-load.c | 27 ++ .../gdb.debuginfod/deferred-auto-load.exp | 223 ++++++++++++++++ .../gdb.debuginfod/deferred-download-lib1.c | 43 +++ .../gdb.debuginfod/deferred-download-lib2.c | 37 +++ .../gdb.debuginfod/deferred-download.c | 29 ++ .../gdb.debuginfod/deferred-download.exp | 158 +++++++++++ .../gdb.debuginfod/deferred-dwz-common.h | 41 +++ .../gdb.debuginfod/deferred-dwz-lib1.c | 24 ++ .../gdb.debuginfod/deferred-dwz-lib2.c | 24 ++ gdb/testsuite/gdb.debuginfod/deferred-dwz.c | 30 +++ gdb/testsuite/gdb.debuginfod/deferred-dwz.exp | 247 ++++++++++++++++++ .../deferred-expand-warning-lib.c | 36 +++ .../gdb.debuginfod/deferred-expand-warning.c | 25 ++ .../deferred-expand-warning.exp | 177 +++++++++++++ .../gdb.debuginfod/deferred-expand-warning.py | 61 +++++ .../gdb.debuginfod/deferred-frame-cache-lib.c | 25 ++ .../gdb.debuginfod/deferred-frame-cache.c | 28 ++ .../gdb.debuginfod/deferred-frame-cache.exp | 180 +++++++++++++ .../gdb.debuginfod/deferred-frame-cache.py | 68 +++++ .../deferred-no-debuginfo-lib.c | 22 ++ .../gdb.debuginfod/deferred-no-debuginfo.c | 25 ++ .../gdb.debuginfod/deferred-no-debuginfo.exp | 194 ++++++++++++++ .../deferred-observer-symbols.exp | 161 ++++++++++++ .../deferred-observer-symbols.py | 62 +++++ .../gdb.debuginfod/deferred-pending.exp | 172 ++++++++++++ .../deferred-select-frame-lib1.c | 26 ++ .../deferred-select-frame-lib2.c | 26 ++ .../gdb.debuginfod/deferred-select-frame.c | 61 +++++ .../gdb.debuginfod/deferred-select-frame.exp | 240 +++++++++++++++++ .../gdb.debuginfod/deferred-select-frame.py | 44 ++++ .../gdb.python/py-frame-cache-flushing-lib1.c | 26 ++ .../gdb.python/py-frame-cache-flushing-lib2.c | 26 ++ .../gdb.python/py-frame-cache-flushing.c | 55 ++++ .../gdb.python/py-frame-cache-flushing.exp | 115 ++++++++ .../gdb.python/py-frame-cache-flushing.py | 52 ++++ gdb/testsuite/lib/debuginfod-support.exp | 31 ++- gdb/testsuite/lib/gdb.exp | 8 +- gdbsupport/traits.h | 7 + 55 files changed, 3557 insertions(+), 68 deletions(-) create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-auto-load-lib.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-auto-load-py-script.h create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-auto-load.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-auto-load.exp create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-download-lib1.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-download-lib2.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-download.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-download.exp create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-dwz-common.h create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-dwz-lib1.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-dwz-lib2.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-dwz.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-dwz.exp create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-expand-warning-lib.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-expand-warning.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-expand-warning.exp create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-expand-warning.py create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-frame-cache-lib.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-frame-cache.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-frame-cache.exp create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-frame-cache.py create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-no-debuginfo-lib.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-no-debuginfo.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-no-debuginfo.exp create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-observer-symbols.exp create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-observer-symbols.py create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-pending.exp create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-select-frame-lib1.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-select-frame-lib2.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-select-frame.c create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-select-frame.exp create mode 100644 gdb/testsuite/gdb.debuginfod/deferred-select-frame.py create mode 100644 gdb/testsuite/gdb.python/py-frame-cache-flushing-lib1.c create mode 100644 gdb/testsuite/gdb.python/py-frame-cache-flushing-lib2.c create mode 100644 gdb/testsuite/gdb.python/py-frame-cache-flushing.c create mode 100644 gdb/testsuite/gdb.python/py-frame-cache-flushing.exp create mode 100644 gdb/testsuite/gdb.python/py-frame-cache-flushing.py base-commit: cef1fbf3b02ff6e5bc62e1b8a7d30c0a32b8b9f7 -- 2.25.4