From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31586 invoked by alias); 16 Nov 2016 16:17:22 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 31571 invoked by uid 89); 16 Nov 2016 16:17:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=iow X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Nov 2016 16:17:11 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtp id 1c72ta-0002im-3T from Luis_Gustavo@mentor.com ; Wed, 16 Nov 2016 08:17:10 -0800 Received: from [172.30.4.107] (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Wed, 16 Nov 2016 08:17:07 -0800 Subject: Re: [PATCH 13/13] Change gdbarch software_single_step frame_info to regcache References: <1479145370-11432-1-git-send-email-yao.qi@linaro.org> <1479145370-11432-14-git-send-email-yao.qi@linaro.org> To: Yao Qi , Reply-To: Luis Machado From: Luis Machado Message-ID: Date: Wed, 16 Nov 2016 16:17:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1479145370-11432-14-git-send-email-yao.qi@linaro.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: svr-orw-mbx-04.mgc.mentorg.com (147.34.90.204) To svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg00422.txt.bz2 On 11/14/2016 11:42 AM, Yao Qi wrote: > This patch changes gdbarch method software_single_step's parameter from > "struct frame_info *" to "struct regcache *, IOW, software_single_step > starts to use current regcache rather than current frame for software > single. > > gdb: > > 2016-11-10 Yao Qi > > * gdbarch.sh (software_single_step): Change parameter from frame_info > to regcache. > * gdbarch.c, gdbarch.h: Regenerated. > * aarch64-tdep.c (aarch64_software_single_step): Change parameter > from frame_info to regcache. Don't call get_current_regcache. > * alpha-tdep.c (alpha_deal_with_atomic_sequence): Likewise. > (alpha_software_single_step): Likewise. > * alpha-tdep.h (alpha_software_single_step): Update declaration. > * arm-linux-tdep.c (arm_linux_software_single_step): Likewise. > * arm-tdep.c (arm_software_single_step): Likewise. > * arm-tdep.h (arm_software_single_step): Likewise. > * breakpoint.c (insert_single_step_breakpoint): Pass regcache to > gdbarch_software_single_step. > * cris-tdep.c (cris_software_single_step): Change parameter from > frame_info to regcache. Don't call get_current_regcache. > * mips-tdep.c (mips_software_single_step): Likewise. > * mips-tdep.h (mips_software_single_step): Update declaration. > * moxie-tdep.c (moxie_software_single_step): Likewise. > * nios2-tdep.c (nios2_software_single_step): Likewise. > * ppc-tdep.h (ppc_deal_with_atomic_sequence): Update declaration. > * rs6000-aix-tdep.c (rs6000_software_single_step): Likewise. > * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Likewise. > * s390-linux-tdep.c (s390_software_single_step): Likewise. > * sparc-tdep.c (sparc_software_single_step): Likewise. > * spu-tdep.c (spu_software_single_step): Likewise. > * tic6x-tdep.c (tic6x_software_single_step): Likewise. > --- > gdb/aarch64-tdep.c | 3 +-- > gdb/alpha-tdep.c | 6 ++---- > gdb/alpha-tdep.h | 2 +- > gdb/arm-linux-tdep.c | 3 +-- > gdb/arm-tdep.c | 3 +-- > gdb/arm-tdep.h | 2 +- > gdb/breakpoint.c | 5 +++-- > gdb/cris-tdep.c | 3 +-- > gdb/gdbarch.c | 4 ++-- > gdb/gdbarch.h | 4 ++-- > gdb/gdbarch.sh | 2 +- > gdb/mips-tdep.c | 3 +-- > gdb/mips-tdep.h | 2 +- > gdb/moxie-tdep.c | 3 +-- > gdb/nios2-tdep.c | 3 +-- > gdb/ppc-tdep.h | 2 +- > gdb/rs6000-aix-tdep.c | 5 ++--- > gdb/rs6000-tdep.c | 3 +-- > gdb/s390-linux-tdep.c | 3 +-- > gdb/sparc-tdep.c | 3 +-- > gdb/spu-tdep.c | 3 +-- > gdb/tic6x-tdep.c | 3 +-- > 22 files changed, 28 insertions(+), 42 deletions(-) > > diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c > index 62ee3c5..6b95d7c 100644 > --- a/gdb/aarch64-tdep.c > +++ b/gdb/aarch64-tdep.c > @@ -2225,9 +2225,8 @@ value_of_aarch64_user_reg (struct frame_info *frame, const void *baton) > single step through atomic sequences on AArch64. */ > > static VEC (CORE_ADDR) * > -aarch64_software_single_step (struct frame_info *frame) > +aarch64_software_single_step (struct regcache *regcache) > { > - struct regcache *regcache = get_current_regcache (); > struct gdbarch *gdbarch = get_regcache_arch (regcache); > enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch); > const int insn_size = 4; > diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c > index 9753c1b..4442d22 100644 > --- a/gdb/alpha-tdep.c > +++ b/gdb/alpha-tdep.c > @@ -766,9 +766,8 @@ static const int stq_c_opcode = 0x2f; > the sequence. */ > > static VEC (CORE_ADDR) * > -alpha_deal_with_atomic_sequence (struct frame_info *frame) > +alpha_deal_with_atomic_sequence (struct regcache *regcache) > { > - struct regcache *regcache = get_current_regcache (); > struct gdbarch *gdbarch = get_regcache_arch (regcache); > CORE_ADDR pc = regcache_read_pc (regcache); > CORE_ADDR breaks[2] = {-1, -1}; > @@ -1719,9 +1718,8 @@ alpha_next_pc (struct regcache *regcache, CORE_ADDR pc) > } > > VEC (CORE_ADDR) * > -alpha_software_single_step (struct frame_info *frame) > +alpha_software_single_step (struct regcache *regcache) > { > - struct regcache *regcache = get_current_regcache (); > struct gdbarch *gdbarch = get_regcache_arch (regcache); > CORE_ADDR pc; > VEC (CORE_ADDR) *next_pcs = NULL; > diff --git a/gdb/alpha-tdep.h b/gdb/alpha-tdep.h > index 5b64861..c0f36b9 100644 > --- a/gdb/alpha-tdep.h > +++ b/gdb/alpha-tdep.h > @@ -103,7 +103,7 @@ struct gdbarch_tdep > }; > > extern unsigned int alpha_read_insn (struct gdbarch *gdbarch, CORE_ADDR pc); > -extern VEC (CORE_ADDR) *alpha_software_single_step (struct frame_info *frame); > +extern VEC (CORE_ADDR) *alpha_software_single_step (struct regcache *regcache); > extern CORE_ADDR alpha_after_prologue (CORE_ADDR pc); > > extern void alpha_mdebug_init_abi (struct gdbarch_info, struct gdbarch *); > diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c > index c621cd6..a30a235 100644 > --- a/gdb/arm-linux-tdep.c > +++ b/gdb/arm-linux-tdep.c > @@ -922,9 +922,8 @@ arm_linux_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self) > /* Insert a single step breakpoint at the next executed instruction. */ > > static VEC (CORE_ADDR) * > -arm_linux_software_single_step (struct frame_info *frame) > +arm_linux_software_single_step (struct regcache *regcache) > { > - struct regcache *regcache = get_current_regcache (); > struct gdbarch *gdbarch = get_regcache_arch (regcache); > struct arm_get_next_pcs next_pcs_ctx; > CORE_ADDR pc; > diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c > index 78fc264..0b93df7 100644 > --- a/gdb/arm-tdep.c > +++ b/gdb/arm-tdep.c > @@ -6287,9 +6287,8 @@ arm_get_next_pcs_is_thumb (struct arm_get_next_pcs *self) > and breakpoint them. */ > > VEC (CORE_ADDR) * > -arm_software_single_step (struct frame_info *frame) > +arm_software_single_step (struct regcache *regcache) > { > - struct regcache *regcache = get_current_regcache (); > struct gdbarch *gdbarch = get_regcache_arch (regcache); > struct arm_get_next_pcs next_pcs_ctx; > CORE_ADDR pc; > diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h > index 10ab742..6af44a9f 100644 > --- a/gdb/arm-tdep.h > +++ b/gdb/arm-tdep.h > @@ -259,7 +259,7 @@ CORE_ADDR arm_get_next_pcs_addr_bits_remove (struct arm_get_next_pcs *self, > > int arm_get_next_pcs_is_thumb (struct arm_get_next_pcs *self); > > -VEC (CORE_ADDR) *arm_software_single_step (struct frame_info *); > +VEC (CORE_ADDR) *arm_software_single_step (struct regcache *); > int arm_is_thumb (struct regcache *regcache); > int arm_frame_is_thumb (struct frame_info *frame); > > diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c > index 245e078..b36c182 100644 > --- a/gdb/breakpoint.c > +++ b/gdb/breakpoint.c > @@ -15193,15 +15193,16 @@ insert_single_step_breakpoint (struct gdbarch *gdbarch, > int > insert_single_step_breakpoints (struct gdbarch *gdbarch) > { > - struct frame_info *frame = get_current_frame (); > + struct regcache *regcache = get_current_regcache (); > VEC (CORE_ADDR) * next_pcs; > > - next_pcs = gdbarch_software_single_step (gdbarch, frame); > + next_pcs = gdbarch_software_single_step (gdbarch, regcache); > > if (next_pcs != NULL) > { > int i; > CORE_ADDR pc; > + struct frame_info *frame = get_current_frame (); > struct address_space *aspace = get_frame_address_space (frame); > > for (i = 0; VEC_iterate (CORE_ADDR, next_pcs, i, pc); i++) > diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c > index 6b060ea..084ff49 100644 > --- a/gdb/cris-tdep.c > +++ b/gdb/cris-tdep.c > @@ -2061,9 +2061,8 @@ find_step_target (struct regcache *regcache, inst_env_type *inst_env) > Either one ordinary target or two targets for branches may be found. */ > > static VEC (CORE_ADDR) * > -cris_software_single_step (struct frame_info *frame) > +cris_software_single_step (struct regcache *regcache) > { > - struct regcache *regcache = get_current_regcache (); > struct gdbarch *gdbarch = get_regcache_arch (regcache); > inst_env_type inst_env; > VEC (CORE_ADDR) *next_pcs = NULL; > diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c > index 07b3ce5..20bcfd7 100644 > --- a/gdb/gdbarch.c > +++ b/gdb/gdbarch.c > @@ -3164,13 +3164,13 @@ gdbarch_software_single_step_p (struct gdbarch *gdbarch) > } > > VEC (CORE_ADDR) * > -gdbarch_software_single_step (struct gdbarch *gdbarch, struct frame_info *frame) > +gdbarch_software_single_step (struct gdbarch *gdbarch, struct regcache *regcache) > { > gdb_assert (gdbarch != NULL); > gdb_assert (gdbarch->software_single_step != NULL); > if (gdbarch_debug >= 2) > fprintf_unfiltered (gdb_stdlog, "gdbarch_software_single_step called\n"); > - return gdbarch->software_single_step (frame); > + return gdbarch->software_single_step (regcache); > } > > void > diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h > index cc95914..3f3c002 100644 > --- a/gdb/gdbarch.h > +++ b/gdb/gdbarch.h > @@ -688,8 +688,8 @@ extern void set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, gdbarch_addr_ > > extern int gdbarch_software_single_step_p (struct gdbarch *gdbarch); > > -typedef VEC (CORE_ADDR) * (gdbarch_software_single_step_ftype) (struct frame_info *frame); > -extern VEC (CORE_ADDR) * gdbarch_software_single_step (struct gdbarch *gdbarch, struct frame_info *frame); > +typedef VEC (CORE_ADDR) * (gdbarch_software_single_step_ftype) (struct regcache *regcache); > +extern VEC (CORE_ADDR) * gdbarch_software_single_step (struct gdbarch *gdbarch, struct regcache *regcache); > extern void set_gdbarch_software_single_step (struct gdbarch *gdbarch, gdbarch_software_single_step_ftype *software_single_step); > > /* Return non-zero if the processor is executing a delay slot and a > diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh > index 28a3478..ba57008 100755 > --- a/gdb/gdbarch.sh > +++ b/gdb/gdbarch.sh > @@ -634,7 +634,7 @@ m:CORE_ADDR:addr_bits_remove:CORE_ADDR addr:addr::core_addr_identity::0 > # the condition and only put the breakpoint at the branch destination if > # the condition is true, so that we ensure forward progress when stepping > # past a conditional branch to self. > -F:VEC (CORE_ADDR) *:software_single_step:struct frame_info *frame:frame > +F:VEC (CORE_ADDR) *:software_single_step:struct regcache *regcache:regcache > > # Return non-zero if the processor is executing a delay slot and a > # further single-step is needed before the instruction finishes. > diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c > index ba0d71d..cb4465b 100644 > --- a/gdb/mips-tdep.c > +++ b/gdb/mips-tdep.c > @@ -4149,9 +4149,8 @@ deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc) > the target of the coming instruction and breakpoint it. */ > > VEC (CORE_ADDR) * > -mips_software_single_step (struct frame_info *frame) > +mips_software_single_step (struct regcache *regcache) > { > - struct regcache *regcache = get_current_regcache (); > struct gdbarch *gdbarch = get_regcache_arch (regcache); > CORE_ADDR pc, next_pc; > VEC (CORE_ADDR) *next_pcs; > diff --git a/gdb/mips-tdep.h b/gdb/mips-tdep.h > index 8a870aa..3b24394 100644 > --- a/gdb/mips-tdep.h > +++ b/gdb/mips-tdep.h > @@ -154,7 +154,7 @@ enum > }; > > /* Single step based on where the current instruction will take us. */ > -extern VEC (CORE_ADDR) *mips_software_single_step (struct frame_info *frame); > +extern VEC (CORE_ADDR) *mips_software_single_step (struct regcache *regcache); > > /* Strip the ISA (compression) bit off from ADDR. */ > extern CORE_ADDR mips_unmake_compact_addr (CORE_ADDR addr); > diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c > index 90a6165..abf2868 100644 > --- a/gdb/moxie-tdep.c > +++ b/gdb/moxie-tdep.c > @@ -300,9 +300,8 @@ moxie_process_readu (CORE_ADDR addr, gdb_byte *buf, > /* Insert a single step breakpoint. */ > > static VEC (CORE_ADDR) * > -moxie_software_single_step (struct frame_info *frame) > +moxie_software_single_step (struct regcache *regcache) > { > - struct regcache *regcache = get_current_regcache (); > struct gdbarch *gdbarch = get_regcache_arch (regcache); > CORE_ADDR addr; > gdb_byte buf[4]; > diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c > index f03c2df..8b78968 100644 > --- a/gdb/nios2-tdep.c > +++ b/gdb/nios2-tdep.c > @@ -2220,9 +2220,8 @@ nios2_get_next_pc (struct regcache *regcache, CORE_ADDR pc) > /* Implement the software_single_step gdbarch method. */ > > static VEC (CORE_ADDR) * > -nios2_software_single_step (struct frame_info *frame) > +nios2_software_single_step (struct regcache *regcache) > { > - 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; > diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h > index 0249456..6f1fe89 100644 > --- a/gdb/ppc-tdep.h > +++ b/gdb/ppc-tdep.h > @@ -76,7 +76,7 @@ int ppc_altivec_support_p (struct gdbarch *gdbarch); > /* Return non-zero if the architecture described by GDBARCH has > VSX registers (vsr0 --- vsr63). */ > int vsx_support_p (struct gdbarch *gdbarch); > -VEC (CORE_ADDR) *ppc_deal_with_atomic_sequence (struct frame_info *frame); > +VEC (CORE_ADDR) *ppc_deal_with_atomic_sequence (struct regcache *regcache); > > > /* Register set description. */ > diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c > index 80038a1..2b90cb1 100644 > --- a/gdb/rs6000-aix-tdep.c > +++ b/gdb/rs6000-aix-tdep.c > @@ -674,9 +674,8 @@ branch_dest (struct regcache *regcache, int opcode, int instr, > /* AIX does not support PT_STEP. Simulate it. */ > > static VEC (CORE_ADDR) * > -rs6000_software_single_step (struct frame_info *frame) > +rs6000_software_single_step (struct regcache *regcache) > { > - 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; > @@ -689,7 +688,7 @@ rs6000_software_single_step (struct frame_info *frame) > > insn = read_memory_integer (loc, 4, byte_order); > > - next_pcs = ppc_deal_with_atomic_sequence (frame); > + next_pcs = ppc_deal_with_atomic_sequence (regcache); > if (next_pcs != NULL) > return next_pcs; > > diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c > index 629d4c2..1c26e1e 100644 > --- a/gdb/rs6000-tdep.c > +++ b/gdb/rs6000-tdep.c > @@ -1144,9 +1144,8 @@ ppc_displaced_step_hw_singlestep (struct gdbarch *gdbarch, > the sequence. */ > > VEC (CORE_ADDR) * > -ppc_deal_with_atomic_sequence (struct frame_info *frame) > +ppc_deal_with_atomic_sequence (struct regcache *regcache) > { > - 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 = regcache_read_pc (regcache); > diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c > index dc5c674..aabbbc2 100644 > --- a/gdb/s390-linux-tdep.c > +++ b/gdb/s390-linux-tdep.c > @@ -723,9 +723,8 @@ s390_is_partial_instruction (struct gdbarch *gdbarch, CORE_ADDR loc, int *len) > complexity. */ > > static VEC (CORE_ADDR) * > -s390_software_single_step (struct frame_info *frame) > +s390_software_single_step (struct regcache *regcache) > { > - struct regcache *regcache = get_current_regcache (); > struct gdbarch *gdbarch = get_regcache_arch (regcache); > CORE_ADDR loc = regcache_read_pc (regcache); > enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); > diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c > index 18b627d..7532bc2 100644 > --- a/gdb/sparc-tdep.c > +++ b/gdb/sparc-tdep.c > @@ -1603,9 +1603,8 @@ sparc_step_trap (struct frame_info *frame, unsigned long insn) > } > > static VEC (CORE_ADDR) * > -sparc_software_single_step (struct frame_info *frame) > +sparc_software_single_step (struct regcache *regcache) > { > - struct regcache *regcache = get_current_regcache (); > struct gdbarch *arch = get_regcache_arch (regcache); > struct gdbarch_tdep *tdep = gdbarch_tdep (arch); > CORE_ADDR npc, nnpc; > diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c > index d16b68f..a7c2bf0 100644 > --- a/gdb/spu-tdep.c > +++ b/gdb/spu-tdep.c > @@ -1611,9 +1611,8 @@ spu_memory_remove_breakpoint (struct gdbarch *gdbarch, > /* Software single-stepping support. */ > > static VEC (CORE_ADDR) * > -spu_software_single_step (struct frame_info *frame) > +spu_software_single_step (struct regcache *regcache) > { > - 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, next_pc; > diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c > index 145534a..de6bc6a 100644 > --- a/gdb/tic6x-tdep.c > +++ b/gdb/tic6x-tdep.c > @@ -700,9 +700,8 @@ tic6x_get_next_pc (struct regcache *regcache, CORE_ADDR pc) > /* This is the implementation of gdbarch method software_single_step. */ > > static VEC (CORE_ADDR) * > -tic6x_software_single_step (struct frame_info *frame) > +tic6x_software_single_step (struct regcache *regcache) > { > - struct regcache *regcache = get_current_regcache (); > CORE_ADDR next_pc = tic6x_get_next_pc (regcache, regcache_read_pc (regcache)); > VEC (CORE_ADDR) *next_pcs = NULL; > > All the other patches besides 01/13 look fairly mechanical to me, and they look sane.