From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: gdb-patches@sourceware.org
Subject: [PATCH] Remove unnecessary get_current_frame calls from infrun.c
Date: Sun, 31 Mar 2024 12:50:45 +0200 [thread overview]
Message-ID: <AS8P193MB12857683EFA5C45A0FC018B6E4382@AS8P193MB1285.EURP193.PROD.OUTLOOK.COM> (raw)
Since the frame variable is now a frame_info_ptr, the issue
with the dangling frame pointer is apparently no longer there.
So remove the re-fetch code and the corresponding meanwhile
misleading comments.
---
gdb/infrun.c | 24 ++++--------------------
1 file changed, 4 insertions(+), 20 deletions(-)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index a5030b16376..521c3b0299c 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -7056,11 +7056,6 @@ handle_signal_stop (struct execution_control_state *ecs)
ecs->event_thread->stop_pc (),
ecs->ws);
skip_inline_frames (ecs->event_thread, stop_chain);
-
- /* Re-fetch current thread's frame in case that invalidated
- the frame cache. */
- frame = get_current_frame ();
- gdbarch = get_frame_arch (frame);
}
}
@@ -7419,12 +7414,6 @@ process_event_stop_test (struct execution_control_state *ecs)
bp_jit_event). Run them now. */
bpstat_run_callbacks (ecs->event_thread->control.stop_bpstat);
- /* If we hit an internal event that triggers symbol changes, the
- current frame will be invalidated within bpstat_what (e.g., if we
- hit an internal solib event). Re-fetch it. */
- frame = get_current_frame ();
- gdbarch = get_frame_arch (frame);
-
/* Shorthand to make if statements smaller. */
struct frame_id original_frame_id
= ecs->event_thread->control.step_frame_id;
@@ -7670,11 +7659,6 @@ process_event_stop_test (struct execution_control_state *ecs)
return;
}
- /* Re-fetch current thread's frame in case the code above caused
- the frame cache to be re-initialized, making our FRAME variable
- a dangling pointer. */
- frame = get_current_frame ();
- gdbarch = get_frame_arch (frame);
fill_in_stop_func (gdbarch, ecs);
/* If stepping through a line, keep going if still within it.
@@ -7855,7 +7839,7 @@ process_event_stop_test (struct execution_control_state *ecs)
if ((get_stack_frame_id (frame)
!= ecs->event_thread->control.step_stack_frame_id)
&& get_frame_type (frame) != SIGTRAMP_FRAME
- && ((frame_unwind_caller_id (get_current_frame ())
+ && ((frame_unwind_caller_id (frame)
== ecs->event_thread->control.step_stack_frame_id)
&& ((ecs->event_thread->control.step_stack_frame_id
!= outer_frame_id)
@@ -8138,7 +8122,7 @@ process_event_stop_test (struct execution_control_state *ecs)
{
infrun_debug_printf ("stepped into inlined function");
- symtab_and_line call_sal = find_frame_sal (get_current_frame ());
+ symtab_and_line call_sal = find_frame_sal (frame);
if (ecs->event_thread->control.step_over_calls != STEP_OVER_ALL)
{
@@ -8180,9 +8164,9 @@ process_event_stop_test (struct execution_control_state *ecs)
to go further up to find the exact frame ID, we are stepping
through a more inlined call beyond its call site. */
- if (get_frame_type (get_current_frame ()) == INLINE_FRAME
+ if (get_frame_type (frame) == INLINE_FRAME
&& (*curr_frame_id != original_frame_id)
- && stepped_in_from (get_current_frame (), original_frame_id))
+ && stepped_in_from (frame, original_frame_id))
{
infrun_debug_printf ("stepping through inlined function");
--
2.39.2
next reply other threads:[~2024-03-31 10:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-31 10:50 Bernd Edlinger [this message]
2024-04-01 2:52 ` Simon Marchi
2024-04-01 11:45 ` Bernd Edlinger
2024-04-01 16:07 ` Tom Tromey
2024-04-01 17:00 ` Bernd Edlinger
2024-04-26 16:31 ` Tom Tromey
2024-04-26 17:47 ` Bernd Edlinger
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=AS8P193MB12857683EFA5C45A0FC018B6E4382@AS8P193MB1285.EURP193.PROD.OUTLOOK.COM \
--to=bernd.edlinger@hotmail.de \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).