This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/7] New macro THREAD_WITHIN_SINGLE_STEP_RANGE
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Thu, 11 Apr 2013 10:43:36 +0800
- Subject: [PATCH 1/7] New macro THREAD_WITHIN_SINGLE_STEP_RANGE
- References: <1363006291-13334-1-git-send-email-yao at codesourcery dot com> <1365648222-12540-1-git-send-email-yao at codesourcery dot com>
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 0846322..3525de6 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -38,6 +38,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 7031ecc..6876dd6 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4341,8 +4341,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)
@@ -4711,8 +4710,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