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]

[PATCH 1/7] New macro THREAD_WITHIN_SINGLE_STEP_RANGE


This patch moves code into a macro, which will be used in my
following patches.

gdb:

2013-03-11  Yao Qi  <yao@codesourcery.com>

	* gdbthread.h (THREAD_WITHIN_SINGLE_STEP_RANGE): New macro.
	* infrun.c (handle_inferior_event): Use it.
---
 gdb/gdbthread.h |    6 ++++++
 gdb/infrun.c    |    6 ++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 824e4d0..6f47006 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -37,6 +37,12 @@ enum thread_state
   THREAD_EXITED,
 };
 
+/* PC is within the range of single stepping of thread THR.  */
+
+#define THREAD_WITHIN_SINGLE_STEP_RANGE(THR, PC)	\
+  ((PC) >= (THR)->control.step_range_start		\
+   && (PC) < (THR)->control.step_range_end)
+
 /* Inferior thread specific part of `struct infcall_control_state'.
 
    Inferior process counterpart is `struct inferior_control_state'.  */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 1cf30fe..5bc276c 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4340,8 +4340,7 @@ process_event_stop_test:
 
       if (ecs->event_thread->control.step_range_end != 0
 	  && ecs->event_thread->suspend.stop_signal != GDB_SIGNAL_0
-	  && (ecs->event_thread->control.step_range_start <= stop_pc
-	      && stop_pc < ecs->event_thread->control.step_range_end)
+	  && THREAD_WITHIN_SINGLE_STEP_RANGE (ecs->event_thread, stop_pc)
 	  && frame_id_eq (get_stack_frame_id (frame),
 			  ecs->event_thread->control.step_stack_frame_id)
 	  && ecs->event_thread->control.step_resume_breakpoint == NULL)
@@ -4710,8 +4709,7 @@ process_event_stop_test:
      through a function epilogue and therefore must detect when
      the current-frame changes in the middle of a line.  */
 
-  if (stop_pc >= ecs->event_thread->control.step_range_start
-      && stop_pc < ecs->event_thread->control.step_range_end
+  if (THREAD_WITHIN_SINGLE_STEP_RANGE (ecs->event_thread, stop_pc)
       && (execution_direction != EXEC_REVERSE
 	  || frame_id_eq (get_frame_id (frame),
 			  ecs->event_thread->control.step_frame_id)))
-- 
1.7.7.6


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