From: Stephan Rohr <stephan.rohr@intel.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 0/1] gdb: discard saved state on error in recursive infcall
Date: Fri, 19 Jun 2026 14:11:59 +0000 [thread overview]
Message-ID: <20260619141200.97232-1-stephan.rohr@intel.com> (raw)
From: "Rohr, Stephan" <stephan.rohr@intel.com>
Hi all,
I came across an issue when we hit a breakpoint in the copy constructor
during an infcall. GDB runs a nested 'call_function_by_hand (copy_ctor,
...)' that creates the dummy frame. If we hit a breakpoint inside the
ctor, that call raises an error. The parent
'call_function_by_hand_dummy' restores the caller's registers.
This works fine until the frame cache is reinitialized, e.g., when
switching inferiors. In that case, the unwinder cannot reach the dummy
frame anymore and the backtrace command doesn't show the correct frames.
I fixed this by not restoring the caller's state and the inferior status
on errors inside the nested ctor call. I extended the
'gdb.cp/pass-by-ref-2.exp' testcase to ensure GDB is able to finish the
abandoned infcall.
Regression tested on Ubuntu 24 with the native target.
I appreciate your feedback.
Thanks
Stephan
Rohr, Stephan (1):
gdb: discard saved state on error in recursive infcall
gdb/infcall.c | 23 +++++++++++++++++++++--
gdb/testsuite/gdb.cp/pass-by-ref-2.exp | 22 ++++++++++++++++++++++
2 files changed, 43 insertions(+), 2 deletions(-)
--
2.43.0
Intel Deutschland GmbH
Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.de
Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
next reply other threads:[~2026-06-19 14:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-19 14:11 Stephan Rohr [this message]
2026-06-19 14:12 ` [PATCH 1/1] " Stephan Rohr
2026-07-06 7:37 ` [PATCH 0/1] " Rohr, Stephan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260619141200.97232-1-stephan.rohr@intel.com \
--to=stephan.rohr@intel.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox