From patchwork Fri Apr 15 13:29:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 11759 Received: (qmail 18087 invoked by alias); 15 Apr 2016 13:29:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 17943 invoked by uid 89); 15 Apr 2016 13:29:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:get_thr, HX-Received:10.98.76.22 X-HELO: mail-pf0-f172.google.com Received: from mail-pf0-f172.google.com (HELO mail-pf0-f172.google.com) (209.85.192.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 15 Apr 2016 13:29:42 +0000 Received: by mail-pf0-f172.google.com with SMTP id c20so56991405pfc.1 for ; Fri, 15 Apr 2016 06:29:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=MNHSh/vsbii2oDp3adgHVnloBj1oQL2efmDxjPIezus=; b=gheeZJhBjy3tRnVXEML5iWEEcq6liU/ismWbZui1xkigf6JQH2yds4A1Ayn0Qq0oCk DnYoxnzXRL3W//5ywo5lSxyl5NyPDfJGGCJ8uxF3bXRzdOpFGx4J4UUai3S20Nbwqzlt 9xlQxBESMrH6mRh9qQ2I/pMKidfdWabA0TGtMPCTyftKdVhlrWNqq39AILgF4HuAOWWG d1OfVAtqnpmy0qInLvu96fMkBHAuztl8sh2lde7tw4S+YPCuitkB4mIM1YCjUoPWM9Sc XoJxaYd65mhksswRMqIQJk66alkXS6nH7RyEnuLq+WU18TsbiImuvy2QKXEJ1vcL63fd Ne/g== X-Gm-Message-State: AOPr4FWZLkJW27WBV85KUDF2QEV33CMJ00N1QhubcX5cauNLG9HDisCoCcA4+iwAfvJo+w== X-Received: by 10.98.76.22 with SMTP id z22mr29077345pfa.78.1460726980644; Fri, 15 Apr 2016 06:29:40 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id 19sm64914048pfp.66.2016.04.15.06.29.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Apr 2016 06:29:40 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 2/2] Replace address and aspace with thread in struct step_over_info Date: Fri, 15 Apr 2016 14:29:21 +0100 Message-Id: <1460726961-27486-3-git-send-email-yao.qi@linaro.org> In-Reply-To: <1460726961-27486-1-git-send-email-yao.qi@linaro.org> References: <1460726961-27486-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes This patch replaces the fields aspace and address in 'struct step_over_info' with 'thread', because aspace and thread can be got from thread. gdb: 2016-04-15 Yao Qi * infrun.c (struct step_over_info) : Remove
: Remove. : New field. (set_step_over_info): Update. (clear_step_over_info): Update. (stepping_past_nonsteppable_watchpoint): Update. --- gdb/infrun.c | 47 +++++++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index 9017b0a..72f7fe4 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1282,16 +1282,12 @@ enum step_over_what_flag }; DEF_ENUM_FLAGS_TYPE (enum step_over_what_flag, step_over_what); -/* Info about an instruction that is being stepped over. */ +/* Info about a thread that is being stepped over. */ struct step_over_info { - /* If we're stepping past a breakpoint, this is the address space - and address of the instruction the breakpoint is set at. We'll - skip inserting all breakpoints here. Valid iff ASPACE is - non-NULL. */ - struct address_space *aspace; - CORE_ADDR address; + /* We're stepping over the thread to pass a breakpoint. */ + struct thread_info *thread; /* The instruction being stepped over triggers a nonsteppable watchpoint. If true, we'll skip inserting watchpoints. */ @@ -1331,18 +1327,7 @@ static void set_step_over_info (struct thread_info *thread, int nonsteppable_watchpoint_p) { - if (thread != NULL) - { - struct regcache *regcache = get_thread_regcache (thread->ptid); - - step_over_info.aspace = get_regcache_aspace (regcache); - step_over_info.address = regcache_read_pc (regcache); - } - else - { - step_over_info.aspace = NULL; - step_over_info.address = 0; - } + step_over_info.thread = thread; step_over_info.nonsteppable_watchpoint_p = nonsteppable_watchpoint_p; } @@ -1355,8 +1340,7 @@ clear_step_over_info (void) if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: clear_step_over_info\n"); - step_over_info.aspace = NULL; - step_over_info.address = 0; + step_over_info.thread = NULL; step_over_info.nonsteppable_watchpoint_p = 0; } @@ -1366,10 +1350,21 @@ int stepping_past_instruction_at (struct address_space *aspace, CORE_ADDR address) { - return (step_over_info.aspace != NULL - && breakpoint_address_match (aspace, address, - step_over_info.aspace, - step_over_info.address)); + if (step_over_info.thread != NULL) + { + struct regcache *regcache; + + regcache = get_thread_regcache (step_over_info.thread->ptid); + + /* The step-over isn't finished or is still valid, so the PC got + from regcache is the value when thread stops, rather than the + value after step-over. */ + return breakpoint_address_match (aspace, address, + get_regcache_aspace (regcache) , + regcache_read_pc (regcache)); + } + else + return 0; } /* See infrun.h. */ @@ -1385,7 +1380,7 @@ stepping_past_nonsteppable_watchpoint (void) static int step_over_info_valid_p (void) { - return (step_over_info.aspace != NULL + return (step_over_info.thread != NULL || stepping_past_nonsteppable_watchpoint ()); }