| Message ID | cover.1775383137.git.aburgess@redhat.com |
|---|---|
| Headers |
Return-Path: <gdb-patches-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id DC6684BA23D6 for <patchwork@sourceware.org>; Sun, 5 Apr 2026 10:12:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DC6684BA23D6 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=eY0T2Tqx X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id F20BE4BA2E13 for <gdb-patches@sourceware.org>; Sun, 5 Apr 2026 10:12:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F20BE4BA2E13 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 F20BE4BA2E13 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775383934; cv=none; b=uo7RbfiFy7T2HnyMuWnifnJwPeeEsPDx6qu2Z3Gvoja8iFajcm24IwcH0c/msaDOkqzE4lAz7ZllNhQIS4AcOLXTYeKLPOM8znR3KRLkZLOxulgppKTlPFKoLOXbAjmooW8YKwRdFlpLEnAc/G+B51yHlS4/Vm537WvG6491tvk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775383934; c=relaxed/simple; bh=kvUc5mYgIyCCIBLk9nvDK1921W6sBkqvDFMS0mbFE68=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=XoJcSTYbh6eyslNhGyXx2w4LW17yuj2JKCpiP1JbiCdfXHmu6p0bhir99SAnos8934ec2lW1dCSwv1QYnOqRZkM/BRle9CVZqhY95wXOKbiYdR37XNHvXiTMihXoY5YLmCZr6T+ZNl7s6zK3tMdTQbBLbc5oZxjRT1Mtpr1aYRA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F20BE4BA2E13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775383933; 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=Y0YMUZYwmdKMUT7NTp0L69oO0/qFH512CsCwpsuei7g=; b=eY0T2TqxbaKBFfKdAMt74udsOs6wuSgrk0Rf36MG+HYogGOH+WM7nqQJvA3fwLao7IVz8e v133X8fhSZmV5yZeQbBrfged1KvWMquizGLqS+jigqJoc+vx458lcBR+ne8PnSuDgyo0+O tWV+PiuzJ1+HbFKwf+AoTdM24d1XIek= 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_256_GCM_SHA384) id us-mta-652-xSYTKh81PG6ZasVYX7lkRA-1; Sun, 05 Apr 2026 06:12:12 -0400 X-MC-Unique: xSYTKh81PG6ZasVYX7lkRA-1 X-Mimecast-MFC-AGG-ID: xSYTKh81PG6ZasVYX7lkRA_1775383932 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4887d32788bso25037035e9.0 for <gdb-patches@sourceware.org>; Sun, 05 Apr 2026 03:12:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775383931; x=1775988731; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Y0YMUZYwmdKMUT7NTp0L69oO0/qFH512CsCwpsuei7g=; b=rjTxzkCaIYBiyM+CFLdHBhwPqE1ehKK5ECO+rsqegm+gnWiBqlFPA41r1JwdtHDBGX WUeZAIFUaskfK2K2Hf2WqMYfUMOMHhN1Al9elPybk4Uan/vl/1yKFT810RARptkfAQ4Y NrcS0o8EpA6bZfukW7lxcYVYYqdU03zuR9W4ZW1wSni4mJMTaHssYldujZNUJUG60XaU 66AC6cgDmQ+AISSr7mrwfuwy6VJQMQKymBc71AUHYIIMPSZ4pipDAIYbyLy4vD3ZqhIb I5l/YvjuKQVbYEDKI7k+B7TeiYo2BgUcH8d002PdCGE3VmyYsqPXh1Xq1pNEN3eI/rhr BU2w== X-Gm-Message-State: AOJu0Yw8WtSasVbl2cCC6GQIElqPLtaHu1Je9ibvpNA+yASLDvuNhShf GbrarVuNisHQPDhUOr1/vw+sVrkKjnVpS+swCtLGHXpfK9DeS2lRKF0JQ3WRdPYXt7A0y0suLLM twfsRbe2jsaU4ar6yV0PbW3GaruTTIex2tNG9Sa38ttcQBjoi5EwtE2KsQ5LK8avcKdPr/c8Z2i NQNHPg8zLlNh5AFWmfXBE/m8gtc+1k13GtR1otco0KPDPd+V8= X-Gm-Gg: AeBDiesfBPbzvXpBsHl2dPAMrFBWX0Pq6r9wSMJB4H+Ok9Nn3lgbL3nbnByBaWo6gNk GfCvuvXtXokOR4D54IjhTmYm4tKXzAeIR+xeuDKWP0Hav45JolNIAF3o5a+e/1lZ1GmWozIPxWD 1e2b3FJr+/b5GcEFvv5tj2b7cA9372EpCE1o1Wv9XX8HFq2JRMqANUr7Y4yI+wssH9mCp0zxkMa xno8pi6E5xI3fpkPzfHgst2CgUZPE/dSqBdzaKsDl5LEYFmL4qhhYzCcg1fyzi5NTqtwlcvd+/Y alW07CW5vrPyJfooO9DK+CW+GOGu/5TPN5CL7VIHKoKpyK4kxLWr0wldNxee8UoZ2rgnRqw/5Le 966zswYxqXMK1RiP9 X-Received: by 2002:a05:600d:1b:b0:488:b0a1:3cc3 with SMTP id 5b1f17b1804b1-488b0a1404fmr3128395e9.14.1775383931091; Sun, 05 Apr 2026 03:12:11 -0700 (PDT) X-Received: by 2002:a05:600d:1b:b0:488:b0a1:3cc3 with SMTP id 5b1f17b1804b1-488b0a1404fmr3128115e9.14.1775383930534; Sun, 05 Apr 2026 03:12:10 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48899e49229sm65695565e9.15.2026.04.05.03.12.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Apr 2026 03:12:10 -0700 (PDT) From: Andrew Burgess <aburgess@redhat.com> To: gdb-patches@sourceware.org Cc: Andrew Burgess <aburgess@redhat.com>, Tom de Vries <tdevries@suse.de> Subject: [PATCH 0/2] Fix missing print frame when stepping out of function Date: Sun, 5 Apr 2026 11:12:05 +0100 Message-Id: <cover.1775383137.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20260331132342.1050954-1-tdevries@suse.de> References: <20260331132342.1050954-1-tdevries@suse.de> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 1Q6XAUPaGdEQGi2IqWrsA_rGg2JvMjOK26zZcw7k3Sg_1775383932 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-5.9 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, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
Fix missing print frame when stepping out of function
|
|
Message
Andrew Burgess
April 5, 2026, 10:12 a.m. UTC
Hi Tom, I looked into the regression you saw with gdb.opt/inline-cmds.exp, and read your notes. As you predicted, the issue is that we need to better take into account the inline frame state when setting up, and checking during, the step/next process. Luckily, we already have a mechanism in GDB to do this, get_frame_function. This returns the function symbol for a frame, taking into account which frames are inlined but being skipped. Assuming a call stack like: 'non-inline function -> inline function' the original code was always returning the non-inline function. My initial proposal was always returning the inline function, and the reality is neither of these is always correct. The get_frame_function returns the function that represents the given frame, which is exactly what we want. In fact, I did consider the idea that we should move away from tracking via the function symbol, and instead just hold a separate frame-id for the "original frame when stepping started". I think this would probably work just fine, but currently, if the frame-id changes, but the function symbol stays the same then GDB would work a particular way, switching to using a frame-id would change this. I doubt this is actually a real concern, but I didn't want to change too much in one go, so I'm sticking with function symbol tracking. The gdb.opt/inline-cmds.exp regression you ran into was only visible from part of the test that runs in MI mode, but the bug itself would manifest in CLI and MI mode, we just didn't spot the bug in CLI mode. So I extended the test to reveal the bug in CLI mode too. I expect that the bug likely was present in other tests too, but the test patterns are too lax, and so didn't trigger for the regression, which is a bit of a shame, but I don't have the time right now to track down tests that _should_ have failed and fix them, at least we have one test that we know checks this stuff now. Your new additions to gdb.dwarf2/dw2-extend-inline-block.exp all pass, and I've done a full local test run and don't see any other regressions. Your original RFC patch #1 was no longer needed for this series, but you might want to repost that separately as it did have one use outside this series, so maybe it's worth having anyway? I folded RFC patch #2 into what is the second patch in this series. I ended up changing the API anyway, so it seemed to make sense to do all the changes in a single patch. Take a look through, and let me know what you think. Thanks, Andrew --- Andrew Burgess (1): gdb: use get_current_frame consistently in print_stop_location Tom de Vries (1): gdb: fix missing print frame when stepping out of function gdb/gdbthread.h | 36 ++++++++++++++- gdb/infcmd.c | 3 +- gdb/infrun.c | 20 ++++----- .../gdb.dwarf2/dw2-extend-inline-block.exp | 45 +++++++++++++++++-- gdb/testsuite/gdb.opt/inline-cmds.exp | 33 +++++++++----- 5 files changed, 108 insertions(+), 29 deletions(-) base-commit: 9d3cf9efd51ebae3f45bb49e3544cb7eeb63a138
Comments
On 4/5/26 12:12 PM, Andrew Burgess wrote: > Hi Tom, > > I looked into the regression you saw with gdb.opt/inline-cmds.exp, and > read your notes. Hi Andrew, a massive thanks for helping out with this. > As you predicted, the issue is that we need to > better take into account the inline frame state when setting up, and > checking during, the step/next process. > > Luckily, we already have a mechanism in GDB to do this, > get_frame_function. This returns the function symbol for a frame, > taking into account which frames are inlined but being skipped. > > Assuming a call stack like: 'non-inline function -> inline function' > the original code was always returning the non-inline function. My > initial proposal was always returning the inline function, and the > reality is neither of these is always correct. > > The get_frame_function returns the function that represents the given > frame, which is exactly what we want. > > In fact, I did consider the idea that we should move away from > tracking via the function symbol, and instead just hold a separate > frame-id for the "original frame when stepping started". Yes, I actually had already started working on that approach when I saw this series. > I think this > would probably work just fine, but currently, if the frame-id changes, > but the function symbol stays the same then GDB would work a > particular way, switching to using a frame-id would change this. I > doubt this is actually a real concern, but I didn't want to change too > much in one go, so I'm sticking with function symbol tracking. I see. > The gdb.opt/inline-cmds.exp regression you ran into was only visible > from part of the test that runs in MI mode, but the bug itself would > manifest in CLI and MI mode, we just didn't spot the bug in CLI mode. > So I extended the test to reveal the bug in CLI mode too. That's a great idea, thanks. > I expect > that the bug likely was present in other tests too, but the test > patterns are too lax, and so didn't trigger for the regression, which > is a bit of a shame, but I don't have the time right now to track down > tests that _should_ have failed and fix them, at least we have one > test that we know checks this stuff now. I didn't think of that, good point. > Your new additions to gdb.dwarf2/dw2-extend-inline-block.exp all pass, > and I've done a full local test run and don't see any other > regressions. > > Your original RFC patch #1 was no longer needed for this series, but > you might want to repost that separately as it did have one use > outside this series, so maybe it's worth having anyway? > OK, I'll do that. > I folded RFC patch #2 into what is the second patch in this series. I > ended up changing the API anyway, so it seemed to make sense to do all > the changes in a single patch. > I ended up reverting that in v4, I think the fix is more readable with infrastructure changes factored out. > Take a look through, and let me know what you think. I think v4 is ok to commit. Thanks, - Tom