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 1/2] gdb: use get_current_frame consistently in print_stop_location
Date: Sun, 5 Apr 2026 11:12:06 +0100 [thread overview]
Message-ID: <640943dbfd2e2d6555be950b04a4c50288e3334a.1775383137.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1775383137.git.aburgess@redhat.com>
In print_stop_location, in the PRINT_UNKNOWN case we currently use a
strange mix of get_current_frame and get_selected_frame. This works
fine because at the point print_stop_location is called the selected
frame will always be the current frame, but calling these two
different functions is confusing, at least for me.
As we are stopping, and deciding whether to print information about
the frame, it makes sense, I think, to make the choice based on the
current frame, and so let's call get_current_frame once, and then use
that result throughout the decision making process.
There should be no user visible changes after this commit.
---
gdb/infrun.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 6ca2a505299..aa1c3553131 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -9362,13 +9362,13 @@ print_stop_location (const target_waitstatus &ws)
/* FIXME: cagney/2002-12-01: Given that a frame ID does (or
should) carry around the function and does (or should) use
that when doing a frame comparison. */
- if (tp->control.stop_step
- && (tp->control.step_frame_id
- == get_frame_id (get_current_frame ()))
+ if (frame_info_ptr frame = get_current_frame ();
+ tp->control.stop_step
+ && (tp->control.step_frame_id == get_frame_id (frame))
&& (tp->control.step_start_function
== find_symbol_for_pc (tp->stop_pc ())))
{
- symtab_and_line sal = find_frame_sal (get_selected_frame (nullptr));
+ symtab_and_line sal = find_frame_sal (frame);
if (sal.symtab != tp->current_symtab)
{
/* Finished step in same frame but into different file, print
--
2.25.4
next prev parent reply other threads:[~2026-04-05 10:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 13:23 [RFC v2 0/3] [gdb] Fix missing print frame when stepping out of function Tom de Vries
2026-03-31 13:23 ` [RFC v2 1/3] [gdb/symtab] Add find_symbol_for_pc_maybe_inline Tom de Vries
2026-03-31 13:23 ` [RFC v2 2/3] [gdb] Add thread_control_state::step_start_function methods Tom de Vries
2026-03-31 13:23 ` [RFC v2 3/3] [gdb] Fix missing print frame when stepping out of function Tom de Vries
2026-04-05 10:12 ` [PATCH 0/2] " Andrew Burgess
2026-04-05 10:12 ` Andrew Burgess [this message]
2026-04-09 6:42 ` [PATCH 1/2] gdb: use get_current_frame consistently in print_stop_location Tom de Vries
2026-04-09 8:54 ` Andrew Burgess
2026-04-09 13:43 ` Tom de Vries
2026-04-10 8:57 ` Andrew Burgess
2026-04-10 10:17 ` Tom de Vries
2026-04-05 10:12 ` [PATCH 2/2] gdb: fix missing print frame when stepping out of function Andrew Burgess
2026-04-10 10:29 ` Tom de Vries
2026-04-10 10:48 ` [PATCH 0/2] Fix " Tom de Vries
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=640943dbfd2e2d6555be950b04a4c50288e3334a.1775383137.git.aburgess@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/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