From patchwork Fri Apr 15 13:29:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 11758 Received: (qmail 18050 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 17940 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 X-HELO: mail-pf0-f174.google.com Received: from mail-pf0-f174.google.com (HELO mail-pf0-f174.google.com) (209.85.192.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 15 Apr 2016 13:29:40 +0000 Received: by mail-pf0-f174.google.com with SMTP id e128so56865257pfe.3 for ; Fri, 15 Apr 2016 06:29:40 -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=wQ8nl5A6FRXdFxH5df3A7ELVl3AaBekNcdNzpR1Qmyg=; b=RV2zZCbjEm8wknSWsjxSDSn3KTixxGspXFIz/IIRTicthusUyg3I0s0deZT0BakEDR +ooHZqmMz2keZKVhmWtlMuMbcVpc2J3e18OKiOF4NS1JEN0l3vlqdCF0nPpVKdmCjzyd V9BZ6oR+Jxb0Hvh9G+PXeK2S7srOOuFf3+sGdHusdsJNQeWsN9k/eU6CfWSSh1oGB64l HVZK6bNSn4JQwExsaPdpmeYmmme8m1vRIKO0zBALb2tfWPAo05J0/TCybvhzj4lsSPtK 0l6K8I8/bwIzpqQszHsis/IasvLocNWIsOx/fO+12bDKgSKcARCQHrUZ8NKeE7QlHwCI +ViA== X-Gm-Message-State: AOPr4FWV4W1P0pK2PQFsoYTiLyVfNMIWJ5gqjwB7lDoafuyGoY2reet9FLBVkPAqsGiziw== X-Received: by 10.98.71.203 with SMTP id p72mr29372811pfi.165.1460726979141; Fri, 15 Apr 2016 06:29:39 -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.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Apr 2016 06:29:38 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 1/2] Refactor function set_step_over_info Date: Fri, 15 Apr 2016 14:29:20 +0100 Message-Id: <1460726961-27486-2-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 replace two parameters of set_step_over_info (aspace and address) with one (thread). gdb: 2016-04-15 Yao Qi * infrun.c (set_step_over_info): Remove parameter aspace and address. Add thread. Set field aspace and address. Callers updated. (keep_going_pass_signal): Remove local variable regcache. --- gdb/infrun.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index 696105d..9017b0a 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1325,14 +1325,24 @@ struct step_over_info static struct step_over_info step_over_info; /* Record the address of the breakpoint/instruction we're currently - stepping over. */ + stepping over THREAD. */ static void -set_step_over_info (struct address_space *aspace, CORE_ADDR address, +set_step_over_info (struct thread_info *thread, int nonsteppable_watchpoint_p) { - step_over_info.aspace = aspace; - step_over_info.address = address; + 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.nonsteppable_watchpoint_p = nonsteppable_watchpoint_p; } @@ -2578,8 +2588,7 @@ resume (enum gdb_signal sig) if (target_is_non_stop_p ()) stop_all_threads (); - set_step_over_info (get_regcache_aspace (regcache), - regcache_read_pc (regcache), 0); + set_step_over_info (tp, 0); step = maybe_software_singlestep (gdbarch, pc); @@ -7713,7 +7722,6 @@ keep_going_pass_signal (struct execution_control_state *ecs) } else { - struct regcache *regcache = get_current_regcache (); int remove_bp; int remove_wps; step_over_what step_what; @@ -7749,11 +7757,10 @@ keep_going_pass_signal (struct execution_control_state *ecs) if (remove_bp && (remove_wps || !use_displaced_stepping (ecs->event_thread))) { - set_step_over_info (get_regcache_aspace (regcache), - regcache_read_pc (regcache), remove_wps); + set_step_over_info (ecs->event_thread, remove_wps); } else if (remove_wps) - set_step_over_info (NULL, 0, remove_wps); + set_step_over_info (NULL, remove_wps); /* If we now need to do an in-line step-over, we need to stop all other threads. Note this must be done before