From patchwork Mon Nov 14 17:42:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 17469 Received: (qmail 46836 invoked by alias); 14 Nov 2016 17:43:13 -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 46345 invoked by uid 89); 14 Nov 2016 17:43:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=Hx-spam-relays-external:74.125.83.68, H*RU:74.125.83.68, 1.9.1, HX-Received:10.99.170.79 X-HELO: mail-pg0-f68.google.com Received: from mail-pg0-f68.google.com (HELO mail-pg0-f68.google.com) (74.125.83.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 14 Nov 2016 17:43:06 +0000 Received: by mail-pg0-f68.google.com with SMTP id 3so9473204pgd.0 for ; Mon, 14 Nov 2016 09:43:06 -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=GdVrWSdFU2aIVfP2rYEdBXyESbzP6AhgZDKeVfcMhVw=; b=M7TNAlIe0NvxP3mriKLZqnlIMTPbmWpk1n6jJdpOnVjIIjavu5VYoVGLIBf11nhEz2 jMVrxNIlAm+6CttkehCUtKYmMcrXKbS1adI1VMOQ8chW1FoqhAYL51mNKemlUzkJNTVM P6+98qg3Bq8TZUw776Csoj5sCLCngb554a97vMasZifBLlHbI21c1poJ7hRR1nzDRZOG 76zPU7Okgy1LuLZSuAqoyKpsMWIZm9ger5n1LahnVCNg0QI8tMDQAR11rzMlZlqTRiuO HgxfDkEFCYqvuGPgw6nedecjci9v9LvnFxoJwQN0tm+iiNIzKg4+Q50yEhKUdlg9P3vf pTaQ== X-Gm-Message-State: ABUngvd2Nfulz6SWGIb0Ysl3iRA/VUKZRwapk5RwQdpS5rCfhKOkm7B886PcpC0i5i1Qkg== X-Received: by 10.99.170.79 with SMTP id x15mr2387903pgo.14.1479145384952; Mon, 14 Nov 2016 09:43:04 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id y29sm36696024pfd.63.2016.11.14.09.43.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Nov 2016 09:43:04 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 07/13] gdbarch software_single_step frame_info to regcache: nios2 Date: Mon, 14 Nov 2016 17:42:44 +0000 Message-Id: <1479145370-11432-8-git-send-email-yao.qi@linaro.org> In-Reply-To: <1479145370-11432-1-git-send-email-yao.qi@linaro.org> References: <1479145370-11432-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes gdb: 2016-11-14 Yao Qi * nios2-tdep.c (nios2_get_next_pc): Replace parameter frame with regcache. Call regcache_raw_get_signed instead of get_frame_register_unsigned. (nios2_software_single_step): Call get_regcache_arch instead of get_frame_arch. --- gdb/nios2-tdep.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c index 67861ca..f03c2df 100644 --- a/gdb/nios2-tdep.c +++ b/gdb/nios2-tdep.c @@ -2126,9 +2126,9 @@ static const struct frame_unwind nios2_stub_frame_unwind = branch prediction. */ static CORE_ADDR -nios2_get_next_pc (struct frame_info *frame, CORE_ADDR pc) +nios2_get_next_pc (struct regcache *regcache, CORE_ADDR pc) { - struct gdbarch *gdbarch = get_frame_arch (frame); + struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); unsigned long mach = gdbarch_bfd_arch_info (gdbarch)->mach; unsigned int insn; @@ -2146,10 +2146,10 @@ nios2_get_next_pc (struct frame_info *frame, CORE_ADDR pc) if (nios2_match_branch (insn, op, mach, &ra, &rb, &imm, &cond)) { - int ras = get_frame_register_signed (frame, ra); - int rbs = get_frame_register_signed (frame, rb); - unsigned int rau = get_frame_register_unsigned (frame, ra); - unsigned int rbu = get_frame_register_unsigned (frame, rb); + int ras = regcache_raw_get_signed (regcache, ra); + int rbs = regcache_raw_get_signed (regcache, rb); + unsigned int rau = regcache_raw_get_unsigned (regcache, ra); + unsigned int rbu = regcache_raw_get_unsigned (regcache, rb); pc += op->size; switch (cond) @@ -2192,7 +2192,7 @@ nios2_get_next_pc (struct frame_info *frame, CORE_ADDR pc) else if (nios2_match_jmpr (insn, op, mach, &ra) || nios2_match_callr (insn, op, mach, &ra)) - pc = get_frame_register_unsigned (frame, ra); + pc = regcache_raw_get_unsigned (regcache, ra); else if (nios2_match_ldwm (insn, op, mach, &uimm, &ra, &imm, &wb, &id, &ret) && ret) @@ -2200,15 +2200,15 @@ nios2_get_next_pc (struct frame_info *frame, CORE_ADDR pc) /* If ra is in the reglist, we have to use the value saved in the stack frame rather than the current value. */ if (uimm & (1 << NIOS2_RA_REGNUM)) - pc = nios2_unwind_pc (gdbarch, frame); + pc = nios2_unwind_pc (gdbarch, get_current_frame ()); else - pc = get_frame_register_unsigned (frame, NIOS2_RA_REGNUM); + pc = regcache_raw_get_unsigned (regcache, NIOS2_RA_REGNUM); } else if (nios2_match_trap (insn, op, mach, &uimm) && uimm == 0) { if (tdep->syscall_next_pc != NULL) - return tdep->syscall_next_pc (frame, op); + return tdep->syscall_next_pc (get_current_frame (), op); } else @@ -2222,8 +2222,9 @@ nios2_get_next_pc (struct frame_info *frame, CORE_ADDR pc) static VEC (CORE_ADDR) * nios2_software_single_step (struct frame_info *frame) { - struct gdbarch *gdbarch = get_frame_arch (frame); - CORE_ADDR next_pc = nios2_get_next_pc (frame, get_frame_pc (frame)); + struct regcache *regcache = get_current_regcache (); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + CORE_ADDR next_pc = nios2_get_next_pc (regcache, regcache_read_pc (regcache)); VEC (CORE_ADDR) *next_pcs = NULL; VEC_safe_push (CORE_ADDR, next_pcs, next_pc);