From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8CD9C3858407; Fri, 9 Feb 2024 13:01:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8CD9C3858407 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707483711; bh=r1j5GZNEXewg+MmbYj+TzyAMHeQg+2q8s1MsZSelrV4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=p9Bzrq7e7FNOCVLTQA0oPCz/0gVNU1UHCrob2DerHXUUHkbO7M/o4ZKmHPnwM12qf YoOGB10XKIA2zC9Kf2pX40E1/fss1RXYYM5y72sZqjIe6KcAcva/Vbxlg82pHjfZDi XPmXRUKX62ELnNFNW2Q08bW1NWUvPEE54WptxhAI= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug tdep/31278] GDB on arm-linux-gnueabihf fails gdb.reverse/func-map-to-same-line.exp Date: Fri, 09 Feb 2024 13:01:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: tdep X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31278 --- Comment #5 from Tom de Vries --- I compared with -marm and x86_64, and in both cases we have: ... $ gdb -q -batch outputs/gdb.reverse/func-map-to-same-line/func-map-to-same-= line -ex start -ex record -ex "break 36" -ex continue -ex "set debug infrun 1" -= ex "reverse-step" 2>&1 | grep process_event_stop_test [infrun] process_event_stop_test: stepped into subroutine [infrun] process_event_stop_test: stepped into subroutine [infrun] process_event_stop_test: stepped into subroutine [infrun] process_event_stop_test: stepped into subroutine ... but with -mthumb: ... [infrun] process_event_stop_test: stepped into subroutine [infrun] process_event_stop_test: updated step range, start =3D 0xaaaaa4f= 2, end =3D 0xaaaaa4fc, may_range_step =3D 1 [infrun] process_event_stop_test: keep going [infrun] process_event_stop_test: reverse stepping, left a recursive call, don't update step info so we remember we left a frame [infrun] process_event_stop_test: updated step range, start =3D 0xaaaaa4f= 2, end =3D 0xaaaaa4fc, may_range_step =3D 1 [infrun] process_event_stop_test: keep going [infrun] process_event_stop_test: reverse stepping, left a recursive call, don't update step info so we remember we left a frame [infrun] process_event_stop_test: updated step range, start =3D 0xaaaaa4f= 2, end =3D 0xaaaaa4fc, may_range_step =3D 1 [infrun] process_event_stop_test: keep going [infrun] process_event_stop_test: reverse stepping, left a recursive call, don't update step info so we remember we left a frame [infrun] process_event_stop_test: updated step range, start =3D 0xaaaaa4e= e, end =3D 0xaaaaa4f2, may_range_step =3D 1 [infrun] process_event_stop_test: keep going [infrun] process_event_stop_test: stepped to a different line ... So, the deviation starts when the second call to process_event_stop_test doesn't detect "stepped into subroutine". The condition looks like this: ... 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 ()) =3D=3D ecs->event_thread->control.step_stack_frame_id) && ((ecs->event_thread->control.step_stack_frame_id !=3D outer_frame_id) || (ecs->event_thread->control.step_start_function !=3D find_pc_function (ecs->event_thread->stop_pc ()))))) { ... and it fails because these two are not equal: ... (gdb) p /x frame_unwind_caller_id (get_current_frame ()) $1 =3D {stack_addr =3D 0x12, code_addr =3D 0xaaaaa4fc, special_addr =3D 0x0, stack_status =3D 0x1, code_addr_p =3D 0x1,=20 special_addr_p =3D 0x0, user_created_p =3D 0x0, artificial_depth =3D 0x0} (gdb) p /x ecs->event_thread->control.step_stack_frame_id=20=20=20=20=20=20= =20=20=20=20 $2 =3D {stack_addr =3D 0xfffef4d8, code_addr =3D 0xaaaaa4fc, special_addr = =3D 0x0, stack_status =3D 0x1, code_addr_p =3D 0x1,=20 special_addr_p =3D 0x0, user_created_p =3D 0x0, artificial_depth =3D 0x0} ... Note the difference in stack_addr. With this demonstrator patch, limiting the comparison to code_addr, the test-case passes: ... diff --git a/gdb/infrun.c b/gdb/infrun.c index 87965fb1274..600dda6b5c5 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -7816,8 +7816,8 @@ 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 ()) - =3D=3D ecs->event_thread->control.step_stack_frame_id) + && ((frame_unwind_caller_id (get_current_frame ()).code_addr + =3D=3D ecs->event_thread->control.step_stack_frame_id.code_addr) && ((ecs->event_thread->control.step_stack_frame_id !=3D outer_frame_id) || (ecs->event_thread->control.step_start_function ... So I guess the question is why the frame id has that strange stack_addr. --=20 You are receiving this mail because: You are on the CC list for the bug.=