public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.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	[thread overview]
Message-ID: <bug-31278-4717-anc1QyBvZB@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31278-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=31278

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
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 = 0xaaaaa4f2, end
= 0xaaaaa4fc, may_range_step = 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 = 0xaaaaa4f2, end
= 0xaaaaa4fc, may_range_step = 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 = 0xaaaaa4f2, end
= 0xaaaaa4fc, may_range_step = 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 = 0xaaaaa4ee, end
= 0xaaaaa4f2, may_range_step = 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)
       != ecs->event_thread->control.step_stack_frame_id)
      && get_frame_type (frame) != SIGTRAMP_FRAME
      && ((frame_unwind_caller_id (get_current_frame ())
           == ecs->event_thread->control.step_stack_frame_id)
          && ((ecs->event_thread->control.step_stack_frame_id
               != outer_frame_id)
              || (ecs->event_thread->control.step_start_function
                  != 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 = {stack_addr = 0x12, code_addr = 0xaaaaa4fc, special_addr = 0x0,
stack_status = 0x1, code_addr_p = 0x1, 
  special_addr_p = 0x0, user_created_p = 0x0, artificial_depth = 0x0}
(gdb) p /x ecs->event_thread->control.step_stack_frame_id          
$2 = {stack_addr = 0xfffef4d8, code_addr = 0xaaaaa4fc, special_addr = 0x0,
stack_status = 0x1, code_addr_p = 0x1, 
  special_addr_p = 0x0, user_created_p = 0x0, artificial_depth = 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_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 ())
-          == ecs->event_thread->control.step_stack_frame_id)
+      && ((frame_unwind_caller_id (get_current_frame ()).code_addr
+          == ecs->event_thread->control.step_stack_frame_id.code_addr)
          && ((ecs->event_thread->control.step_stack_frame_id
               != 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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2024-02-09 13:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 23:11 [Bug tdep/31278] New: " thiago.bauermann at linaro dot org
2024-01-23 10:18 ` [Bug tdep/31278] " vries at gcc dot gnu.org
2024-01-24  3:07 ` thiago.bauermann at linaro dot org
2024-01-25 14:30 ` vries at gcc dot gnu.org
2024-02-08 14:24 ` luis.machado at arm dot com
2024-02-09 13:01 ` vries at gcc dot gnu.org [this message]
2024-02-09 16:19 ` vries at gcc dot gnu.org
2024-02-11 11:58 ` vries at gcc dot gnu.org
2024-02-11 12:19 ` [Bug tdep/31278] [gdb/tdep, thumb2] " vries at gcc dot gnu.org
2024-02-11 13:10 ` vries at gcc dot gnu.org
2024-02-12  9:39 ` luis.machado at arm dot com
2024-02-12 11:27 ` vries at gcc dot gnu.org
2024-02-12 12:03 ` luis.machado at arm dot com
2024-02-12 14:11 ` vries at gcc dot gnu.org
2024-02-13  8:10 ` cvs-commit at gcc dot gnu.org
2024-02-13  8:13 ` vries at gcc dot gnu.org

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=bug-31278-4717-anc1QyBvZB@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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).