From patchwork Fri Jan 15 09:57:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 10390 Received: (qmail 113263 invoked by alias); 15 Jan 2016 09:57:38 -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 113169 invoked by uid 89); 15 Jan 2016 09:57:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:209.85.192.194, H*RU:209.85.192.194, Hx-languages-length:1357, bother X-HELO: mail-pf0-f194.google.com Received: from mail-pf0-f194.google.com (HELO mail-pf0-f194.google.com) (209.85.192.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 15 Jan 2016 09:57:36 +0000 Received: by mail-pf0-f194.google.com with SMTP id e65so8378451pfe.0 for ; Fri, 15 Jan 2016 01:57:36 -0800 (PST) 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=sMG8JpTz71JHQYXQ9DviMJbFVs4DUd/wC3AZD4LQjk0=; b=g9j4M3YUTRBycpKGnMqq6dEWT6xQUTWf55Z1pS0cY52knd50GaPeCrGc0T//4ddSs/ eJiCXrqS9hFpV1ZFulr03cnfHxe7r5an+LorIaam/JvCKdEXwenUGzRRNnuPF36DJV9w evqX6JmEsVbAekvWqbwWyn+0vHM6vYXc4tV3dDa4xFwKL84TmjZ9XDUBOSwCo34/4fvt x9eFMhpLJ4pBcF/Nj1A4ktWN/jSVMxcrE0Lfc9MInGxOr+Hn1/3D3o0yfrpFyYveXFPM sGZoq3wZxmOEzRJZ0MPFrHcRZ0BbmE5XgGGuDb3M1qnFJv0UBc+T3vUmP1oeyt4ut/bL NPtw== X-Gm-Message-State: ALoCoQms27UaVMtQ+ud05n8OT6Zhxtx5MzkQerrM6CcTqJbujdJsf/txpodQvNvzoIDv7hW85XvmRNQ3Hc2wjanVl8/PpMbOXA== X-Received: by 10.98.0.7 with SMTP id 7mr12504718pfa.5.1452851855048; Fri, 15 Jan 2016 01:57:35 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id f27sm14576421pfj.0.2016.01.15.01.57.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Jan 2016 01:57:34 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 1/2] [GDBserver] Use regcache_read_pc in install_software_single_step_breakpoints Date: Fri, 15 Jan 2016 09:57:28 +0000 Message-Id: <1452851849-24127-2-git-send-email-yao.qi@linaro.org> In-Reply-To: <1452851849-24127-1-git-send-email-yao.qi@linaro.org> References: <1452851849-24127-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes In install_software_single_step_breakpoints, we've got the regcache of current_thread, so we don't have to bother get_pc to get pc, instead we can get pc from regcache directly. Note that the callers of install_software_single_step_breakpoints have already switched current_thread to LWP. Since the pc is got from regcache_read_pc, in the next patch, we can get pc inside the implementation of *the_low_target.get_next_pcs and stop passing pc to *the_low_target.get_next_pcs. gdb/gdbserver: 2016-01-15 Yao Qi * linux-low.c (install_software_single_step_breakpoints): Call regcache_read_pc instead of get_pc. --- gdb/gdbserver/linux-low.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 6082d66..9f194c7 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -4107,7 +4107,8 @@ install_software_single_step_breakpoints (struct lwp_info *lwp) VEC (CORE_ADDR) *next_pcs = NULL; struct cleanup *old_chain = make_cleanup (VEC_cleanup (CORE_ADDR), &next_pcs); - pc = get_pc (lwp); + pc = regcache_read_pc (regcache); + next_pcs = (*the_low_target.get_next_pcs) (pc, regcache); for (i = 0; VEC_iterate (CORE_ADDR, next_pcs, i, pc); ++i)