Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hui Zhu <teawater@gmail.com>
To: gdb-patches ml <gdb-patches@sourceware.org>,
	Michael Snyder <msnyder@vmware.com>,
	 	Daniel Jacobowitz <drow@false.org>,
	Pedro Alves <pedro@codesourcery.com>,
	 	Marc Khouzam <marc.khouzam@ericsson.com>
Subject: [RFC] Add step_stack_prev_frame_id
Date: Tue, 07 Jul 2009 09:30:00 -0000	[thread overview]
Message-ID: <daef60380907070229s5a80966br36de1b16222fd92a@mail.gmail.com> (raw)

Hi,

Now, reverse debug have a problem about infrun doesn't know the
frame_id of prev function.  So it will not know inferior stepped into
subroutine or stepped out from subroutine.
http://sourceware.org/ml/gdb/2009-06/msg00089.html
This mail talk about this issue.

Daniel suggest us to use "frame_unwind_caller_id" and Michael make
some patch for it.  Looks it's depend on arch code support and new
version gcc support.

I have other idea about it.
http://sourceware.org/ml/gdb-patches/2009-06/msg00793.html
Save this prev_frame_id when we save step_stack_prev_frame_id in
reverse mode.  I made a patch for it.
I think it will not depend on arch code support and new version gcc
support.  I try it with precord AMD64 patch.


Thanks,
Hui


2009-07-07  Hui Zhu  <teawater@gmail.com>

	* gdbthread.h (thread_info): Add step_stack_prev_frame_id to
	save the prev_frame_id when we can get the prev_frame.
	* infrun.c (inferior_status): Ditto.
	(save_inferior_status): Ditto.
	(restore_inferior_status): Ditto.
	(set_step_info): Get the step_stack_prev_frame_id.
	(handle_inferior_event): Use the step_stack_prev_frame_id make
	sure inferior stepped into subroutine or not.


---
 gdbthread.h |    3 +++
 infrun.c    |   14 +++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

--- a/gdbthread.h
+++ b/gdbthread.h
@@ -88,6 +88,9 @@ struct thread_info
      any inlined frames).  */
   struct frame_id step_stack_frame_id;

+  /* The prev frame id of step_stack_frame_id.  */
+  struct frame_id step_stack_prev_frame_id;
+
   int current_line;
   struct symtab *current_symtab;

--- a/infrun.c
+++ b/infrun.c
@@ -2153,10 +2153,17 @@ void
 set_step_info (struct frame_info *frame, struct symtab_and_line sal)
 {
   struct thread_info *tp = inferior_thread ();
+  struct frame_info *prev_frame;

   tp->step_frame_id = get_frame_id (frame);
   tp->step_stack_frame_id = get_stack_frame_id (frame);

+  prev_frame = get_prev_frame (frame);
+  if (prev_frame)
+    tp->step_stack_prev_frame_id = get_stack_frame_id (prev_frame);
+  else
+    tp->step_stack_prev_frame_id = null_frame_id;
+
   tp->current_symtab = sal.symtab;
   tp->current_line = sal.line;
 }
@@ -3778,7 +3785,9 @@ infrun: not switching back to stepped th
 		    ecs->event_thread->step_stack_frame_id)
       && (frame_id_eq (frame_unwind_caller_id (frame),
 		       ecs->event_thread->step_stack_frame_id)
-	  || execution_direction == EXEC_REVERSE))
+	  || (execution_direction == EXEC_REVERSE
+              && !frame_id_eq (get_stack_frame_id (frame),
+                               ecs->event_thread->step_stack_prev_frame_id))))
     {
       CORE_ADDR real_stop_pc;

@@ -5388,6 +5397,7 @@ struct inferior_status
   CORE_ADDR step_range_end;
   struct frame_id step_frame_id;
   struct frame_id step_stack_frame_id;
+  struct frame_id step_stack_prev_frame_id;
   enum step_over_calls_kind step_over_calls;
   CORE_ADDR step_resume_break_address;
   int stop_after_trap;
@@ -5418,6 +5428,7 @@ save_inferior_status (void)
   inf_status->step_range_end = tp->step_range_end;
   inf_status->step_frame_id = tp->step_frame_id;
   inf_status->step_stack_frame_id = tp->step_stack_frame_id;
+  inf_status->step_stack_prev_frame_id = tp->step_stack_prev_frame_id;
   inf_status->step_over_calls = tp->step_over_calls;
   inf_status->stop_after_trap = stop_after_trap;
   inf_status->stop_soon = inf->stop_soon;
@@ -5472,6 +5483,7 @@ restore_inferior_status (struct inferior
   tp->step_range_end = inf_status->step_range_end;
   tp->step_frame_id = inf_status->step_frame_id;
   tp->step_stack_frame_id = inf_status->step_stack_frame_id;
+  tp->step_stack_prev_frame_id = inf_status->step_stack_prev_frame_id;
   tp->step_over_calls = inf_status->step_over_calls;
   stop_after_trap = inf_status->stop_after_trap;
   inf->stop_soon = inf_status->stop_soon;


             reply	other threads:[~2009-07-07  9:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-07  9:30 Hui Zhu [this message]
2009-07-07  9:31 ` Hui Zhu

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=daef60380907070229s5a80966br36de1b16222fd92a@mail.gmail.com \
    --to=teawater@gmail.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=marc.khouzam@ericsson.com \
    --cc=msnyder@vmware.com \
    --cc=pedro@codesourcery.com \
    /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