From patchwork Mon Nov 14 17:42:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 17472 Received: (qmail 47968 invoked by alias); 14 Nov 2016 17:43:20 -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 47862 invoked by uid 89); 14 Nov 2016 17:43:20 -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=completion, 6768, rs6000tdepc, rs6000-tdep.c X-HELO: mail-pg0-f66.google.com Received: from mail-pg0-f66.google.com (HELO mail-pg0-f66.google.com) (74.125.83.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 14 Nov 2016 17:43:10 +0000 Received: by mail-pg0-f66.google.com with SMTP id x23so9473384pgx.3 for ; Mon, 14 Nov 2016 09:43:09 -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=69s1WiRXseAS5Q8s8sKfkqqvtcfVPFU272VQadKyyuE=; b=EcsTMgfMZEg1+tNVbBo5xXy2VCUGMm4Cs1WFTKNKRQhqKahMHFgY/7Ilt+/I9bhlE1 Shf5BSZHew1NQyzYo4/4D8DGTdNcM9ZM033MyPQOrkNdr3L0ygMNhtAKaJGPJ8pnwtJi wNk532W219oWLP1oF0SHm1ypewRXoZ7fBIggNAmVG0elOu9QSPpMNvLyeRe7L73VEDYX PYGS0sHYa7/WgiGa4LOpFEEQthfGLjlJ8NsRtXs2vtOQqNVpDegfaodT05usYMlYbeHl wK7wkooLI/1Z082GWdwfLg+CNCCds7RSVWkiciJlewYWWzLtf6DP2kSd4Y/+hJQbu/5P Nl1w== X-Gm-Message-State: ABUngvetLKLALaB5am7AsFUifqPaqA8vZaJBry/KfSYyboKqsuU9aKaNhvovRDxve0JcZw== X-Received: by 10.98.153.20 with SMTP id d20mr38801081pfe.44.1479145388232; Mon, 14 Nov 2016 09:43:08 -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.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Nov 2016 09:43:07 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 10/13] gdbarch software_single_step frame_info to regcache: rs6000 Date: Mon, 14 Nov 2016 17:42:47 +0000 Message-Id: <1479145370-11432-11-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-10 Yao Qi * rs6000-aix-tdep.c (branch_dest): Replace parameter frame with regcache. Call get_regcache_arch instead of get_frame_arch. Call regcache_raw_get_unsigned instead of get_frame_register_unsigned. (rs6000_software_single_step): Likewise. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Call get_regcache_arch instead of get_frame_arch. Call regcache_read_pc instead of get_frame_pc. --- gdb/rs6000-aix-tdep.c | 32 ++++++++++++++++++-------------- gdb/rs6000-tdep.c | 6 +++--- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c index a7a3937..80038a1 100644 --- a/gdb/rs6000-aix-tdep.c +++ b/gdb/rs6000-aix-tdep.c @@ -597,10 +597,10 @@ rs6000_convert_from_func_ptr_addr (struct gdbarch *gdbarch, /* Calculate the destination of a branch/jump. Return -1 if not a branch. */ static CORE_ADDR -branch_dest (struct frame_info *frame, int opcode, int instr, +branch_dest (struct regcache *regcache, int opcode, int instr, CORE_ADDR pc, CORE_ADDR safety) { - struct gdbarch *gdbarch = get_frame_arch (frame); + struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); CORE_ADDR dest; @@ -633,29 +633,33 @@ branch_dest (struct frame_info *frame, int opcode, int instr, if (ext_op == 16) /* br conditional register */ { - dest = get_frame_register_unsigned (frame, tdep->ppc_lr_regnum) & ~3; + dest = regcache_raw_get_unsigned (regcache, tdep->ppc_lr_regnum) & ~3; /* If we are about to return from a signal handler, dest is something like 0x3c90. The current frame is a signal handler caller frame, upon completion of the sigreturn system call execution will return to the saved PC in the frame. */ if (dest < AIX_TEXT_SEGMENT_BASE) - dest = read_memory_unsigned_integer - (get_frame_base (frame) + SIG_FRAME_PC_OFFSET, - tdep->wordsize, byte_order); + { + struct frame_info *frame = get_current_frame (); + + dest = read_memory_unsigned_integer + (get_frame_base (frame) + SIG_FRAME_PC_OFFSET, + tdep->wordsize, byte_order); + } } else if (ext_op == 528) /* br cond to count reg */ { - dest = get_frame_register_unsigned (frame, - tdep->ppc_ctr_regnum) & ~3; + dest = regcache_raw_get_unsigned (regcache, + tdep->ppc_ctr_regnum) & ~3; /* If we are about to execute a system call, dest is something like 0x22fc or 0x3b00. Upon completion the system call will return to the address in the link register. */ if (dest < AIX_TEXT_SEGMENT_BASE) - dest = get_frame_register_unsigned (frame, - tdep->ppc_lr_regnum) & ~3; + dest = regcache_raw_get_unsigned (regcache, + tdep->ppc_lr_regnum) & ~3; } else return -1; @@ -672,8 +676,8 @@ branch_dest (struct frame_info *frame, int opcode, int instr, static VEC (CORE_ADDR) * rs6000_software_single_step (struct frame_info *frame) { - struct gdbarch *gdbarch = get_frame_arch (frame); - struct address_space *aspace = get_frame_address_space (frame); + struct regcache *regcache = get_current_regcache (); + struct gdbarch *gdbarch = get_regcache_arch (regcache); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int ii, insn; CORE_ADDR loc; @@ -681,7 +685,7 @@ rs6000_software_single_step (struct frame_info *frame) int opcode; VEC (CORE_ADDR) *next_pcs; - loc = get_frame_pc (frame); + loc = regcache_read_pc (regcache); insn = read_memory_integer (loc, 4, byte_order); @@ -691,7 +695,7 @@ rs6000_software_single_step (struct frame_info *frame) breaks[0] = loc + PPC_INSN_SIZE; opcode = insn >> 26; - breaks[1] = branch_dest (frame, opcode, insn, loc, breaks[0]); + breaks[1] = branch_dest (regcache, opcode, insn, loc, breaks[0]); /* Don't put two breakpoints on the same address. */ if (breaks[1] == breaks[0]) diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 5e10893..629d4c2 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1146,10 +1146,10 @@ ppc_displaced_step_hw_singlestep (struct gdbarch *gdbarch, VEC (CORE_ADDR) * ppc_deal_with_atomic_sequence (struct frame_info *frame) { - struct gdbarch *gdbarch = get_frame_arch (frame); - struct address_space *aspace = get_frame_address_space (frame); + struct regcache *regcache = get_current_regcache (); + struct gdbarch *gdbarch = get_regcache_arch (regcache); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - CORE_ADDR pc = get_frame_pc (frame); + CORE_ADDR pc = regcache_read_pc (regcache); CORE_ADDR breaks[2] = {-1, -1}; CORE_ADDR loc = pc; CORE_ADDR closing_insn; /* Instruction that closes the atomic sequence. */