From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 68986 invoked by alias); 29 Oct 2015 15:01:13 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 68935 invoked by uid 89); 29 Oct 2015 15:01:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f47.google.com Received: from mail-pa0-f47.google.com (HELO mail-pa0-f47.google.com) (209.85.220.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 29 Oct 2015 15:01:09 +0000 Received: by pacfv9 with SMTP id fv9so45080783pac.3 for ; Thu, 29 Oct 2015 08:01:07 -0700 (PDT) X-Received: by 10.66.139.70 with SMTP id qw6mr2357722pab.142.1446130867650; Thu, 29 Oct 2015 08:01:07 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc2-power8.osuosl.org. [140.211.9.43]) by smtp.gmail.com with ESMTPSA id j16sm2916761pbq.23.2015.10.29.08.01.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Oct 2015 08:01:07 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 1/2] New function displaced_step_in_progress_thread Date: Thu, 29 Oct 2015 17:10:00 -0000 Message-Id: <1446130862-12824-2-git-send-email-yao.qi@linaro.org> In-Reply-To: <1446130862-12824-1-git-send-email-yao.qi@linaro.org> References: <1446130862-12824-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg00694.txt.bz2 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 * 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