This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/2] New function displaced_step_in_progress_thread
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 29 Oct 2015 15:01:01 +0000
- Subject: [PATCH 1/2] New function displaced_step_in_progress_thread
- Authentication-results: sourceware.org; auth=none
- References: <1446130862-12824-1-git-send-email-yao dot qi at linaro dot org>
This patch adds a new function displaced_step_in_progress_thread,
which returns whether the thread is in progress of displaced
stepping.
gdb:
2015-10-28 Yao Qi <yao.qi@linaro.org>
* infrun.c (displaced_step_in_progress_thread): New function.
(handle_inferior_event_1): Call it.
---
gdb/infrun.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 917f9be..0265d35 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1536,6 +1536,21 @@ displaced_step_in_progress_any_inferior (void)
return 0;
}
+/* Return true if thread represented by PTID is doing a displaced
+ step. */
+
+static int
+displaced_step_in_progress_thread (ptid_t ptid)
+{
+ struct displaced_step_inferior_state *displaced;
+
+ gdb_assert (!ptid_equal (ptid, null_ptid));
+
+ displaced = get_displaced_stepping_state (ptid_get_pid (ptid));
+
+ return (displaced != NULL && ptid_equal (displaced->step_ptid, ptid));
+}
+
/* Return true if process PID has a thread doing a displaced step. */
static int
@@ -4923,12 +4938,10 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
{
struct regcache *regcache = get_thread_regcache (ecs->ptid);
struct gdbarch *gdbarch = get_regcache_arch (regcache);
- struct displaced_step_inferior_state *displaced
- = get_displaced_stepping_state (ptid_get_pid (ecs->ptid));
/* If checking displaced stepping is supported, and thread
ecs->ptid is displaced stepping. */
- if (displaced && ptid_equal (displaced->step_ptid, ecs->ptid))
+ if (displaced_step_in_progress_thread (ecs->ptid))
{
struct inferior *parent_inf
= find_inferior_ptid (ecs->ptid);
@@ -4947,6 +4960,9 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
if (ecs->ws.kind == TARGET_WAITKIND_FORKED)
{
+ struct displaced_step_inferior_state *displaced
+ = get_displaced_stepping_state (ptid_get_pid (ecs->ptid));
+
/* Restore scratch pad for child process. */
displaced_step_restore (displaced, ecs->ws.value.related_pid);
}
--
1.9.1