This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] Add step_stack_prev_frame_id


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]