From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1853) id 758E23858C42; Fri, 26 Apr 2024 17:43:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 758E23858C42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1714153405; bh=HN+fv0k609mrnWTqT5OJCaPAS8sD2fA0P7uxw64uG6E=; h=From:To:Subject:Date:From; b=t1SYOKMuoaBrVnfku4Tr5zKF57TbIclKoinhyu9mevLsHjAZNY3Duj+dnPa+IyqHY 5scUrKZcy3P+zZ75LGm1tZfU0Vb/wPn1//uP3LTNba8DjOtpvL9xQi77kDR3+go4Eq hyIi3/jURJgU17ms5iJHwRLoAM54WV78dRSwATaM= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Bernd Edlinger To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Remove unnecessary get_current_frame calls from infrun.c X-Act-Checkin: binutils-gdb X-Git-Author: Bernd Edlinger X-Git-Refname: refs/heads/master X-Git-Oldrev: d830e565e704efc62c0b21d55ee35a035110e235 X-Git-Newrev: 354f8d0a1f98a1ade9b669f9200a9c23d22349fe Message-Id: <20240426174325.758E23858C42@sourceware.org> Date: Fri, 26 Apr 2024 17:43:25 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D354f8d0a1f98= a1ade9b669f9200a9c23d22349fe commit 354f8d0a1f98a1ade9b669f9200a9c23d22349fe Author: Bernd Edlinger Date: Wed Mar 27 09:16:27 2024 +0100 Remove unnecessary get_current_frame calls from infrun.c =20 Since the frame variable is now a frame_info_ptr, the issue with the dangling frame pointer is apparently no longer there. =20 So remove the re-fetch code and the corresponding meanwhile misleading comments. =20 Approved-By: Tom Tromey Diff: --- gdb/infrun.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index d23be9ef941..2b6c1207391 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 =3D get_current_frame (); - gdbarch =3D get_frame_arch (frame); } } =20 @@ -7419,12 +7414,6 @@ process_event_stop_test (struct execution_control_st= ate *ecs) bp_jit_event). Run them now. */ bpstat_run_callbacks (ecs->event_thread->control.stop_bpstat); =20 - /* 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 =3D get_current_frame (); - gdbarch =3D get_frame_arch (frame); - /* Shorthand to make if statements smaller. */ struct frame_id original_frame_id =3D ecs->event_thread->control.step_frame_id; @@ -7670,11 +7659,6 @@ process_event_stop_test (struct execution_control_st= ate *ecs) return; } =20 - /* 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 =3D get_current_frame (); - gdbarch =3D get_frame_arch (frame); fill_in_stop_func (gdbarch, ecs); =20 /* If stepping through a line, keep going if still within it. @@ -7855,7 +7839,7 @@ process_event_stop_test (struct execution_control_sta= te *ecs) if ((get_stack_frame_id (frame) !=3D ecs->event_thread->control.step_stack_frame_id) && get_frame_type (frame) !=3D SIGTRAMP_FRAME - && ((frame_unwind_caller_id (get_current_frame ()) + && ((frame_unwind_caller_id (frame) =3D=3D ecs->event_thread->control.step_stack_frame_id) && ((ecs->event_thread->control.step_stack_frame_id !=3D outer_frame_id) @@ -8138,7 +8122,7 @@ process_event_stop_test (struct execution_control_sta= te *ecs) { infrun_debug_printf ("stepped into inlined function"); =20 - symtab_and_line call_sal =3D find_frame_sal (get_current_frame ()); + symtab_and_line call_sal =3D find_frame_sal (frame); =20 if (ecs->event_thread->control.step_over_calls !=3D STEP_OVER_ALL) { @@ -8180,9 +8164,9 @@ process_event_stop_test (struct execution_control_sta= te *ecs) to go further up to find the exact frame ID, we are stepping through a more inlined call beyond its call site. */ =20 - if (get_frame_type (get_current_frame ()) =3D=3D INLINE_FRAME + if (get_frame_type (frame) =3D=3D INLINE_FRAME && (*curr_frame_id !=3D 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");