* [PATCH 13/13] Change gdbarch software_single_step frame_info to regcache
2016-11-14 17:43 [PATCH 00/13] Change gdbarch software_single_step frame_info to regcache Yao Qi
@ 2016-11-14 17:43 ` Yao Qi
2016-11-16 16:17 ` Luis Machado
2016-11-14 17:43 ` [PATCH 12/13] gdbarch software_single_step frame_info to regcache: spu Yao Qi
` (11 subsequent siblings)
12 siblings, 1 reply; 18+ messages in thread
From: Yao Qi @ 2016-11-14 17:43 UTC (permalink / raw)
To: gdb-patches
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 <yao.qi@linaro.org>
* 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;
--
1.9.1
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 13/13] Change gdbarch software_single_step frame_info to regcache
2016-11-14 17:43 ` [PATCH 13/13] " Yao Qi
@ 2016-11-16 16:17 ` Luis Machado
0 siblings, 0 replies; 18+ messages in thread
From: Luis Machado @ 2016-11-16 16:17 UTC (permalink / raw)
To: Yao Qi, gdb-patches
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 <yao.qi@linaro.org>
>
> * 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.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 12/13] gdbarch software_single_step frame_info to regcache: spu
2016-11-14 17:43 [PATCH 00/13] Change gdbarch software_single_step frame_info to regcache Yao Qi
2016-11-14 17:43 ` [PATCH 13/13] " Yao Qi
@ 2016-11-14 17:43 ` Yao Qi
2016-11-14 17:43 ` [PATCH 05/13] gdbarch software_single_step frame_info to regcache: mips Yao Qi
` (10 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Yao Qi @ 2016-11-14 17:43 UTC (permalink / raw)
To: gdb-patches
gdb:
2016-11-10 Yao Qi <yao.qi@linaro.org>
* spu-tdep.c (spu_software_single_step): Call get_regcache_arch
instead of get_frame_arch. Call regcache_read_pc instead of
get_frame_pc. Call regcache_raw_get_unsigned instead of
get_frame_register_unsigned.
---
gdb/spu-tdep.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 073be2d..d16b68f 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -1613,7 +1613,8 @@ spu_memory_remove_breakpoint (struct gdbarch *gdbarch,
static VEC (CORE_ADDR) *
spu_software_single_step (struct frame_info *frame)
{
- struct gdbarch *gdbarch = get_frame_arch (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, next_pc;
unsigned int insn;
@@ -1622,7 +1623,7 @@ spu_software_single_step (struct frame_info *frame)
ULONGEST lslr;
VEC (CORE_ADDR) *next_pcs = NULL;
- pc = get_frame_pc (frame);
+ pc = regcache_read_pc (regcache);
if (target_read_memory (pc, buf, 4))
throw_error (MEMORY_ERROR, _("Could not read instruction at %s."),
@@ -1631,7 +1632,7 @@ spu_software_single_step (struct frame_info *frame)
insn = extract_unsigned_integer (buf, 4, byte_order);
/* Get local store limit. */
- lslr = get_frame_register_unsigned (frame, SPU_LSLR_REGNUM);
+ lslr = regcache_raw_get_unsigned (regcache, SPU_LSLR_REGNUM);
if (!lslr)
lslr = (ULONGEST) -1;
@@ -1652,7 +1653,7 @@ spu_software_single_step (struct frame_info *frame)
if (reg == SPU_PC_REGNUM)
target += SPUADDR_ADDR (pc);
else if (reg != -1)
- target += get_frame_register_unsigned (frame, reg) & -4;
+ target += regcache_raw_get_unsigned (regcache, reg) & -4;
target = target & lslr;
if (target != next_pc)
--
1.9.1
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 05/13] gdbarch software_single_step frame_info to regcache: mips
2016-11-14 17:43 [PATCH 00/13] Change gdbarch software_single_step frame_info to regcache Yao Qi
2016-11-14 17:43 ` [PATCH 13/13] " Yao Qi
2016-11-14 17:43 ` [PATCH 12/13] gdbarch software_single_step frame_info to regcache: spu Yao Qi
@ 2016-11-14 17:43 ` Yao Qi
2016-11-14 17:43 ` [PATCH 08/13] gdbarch software_single_step frame_info to regcache: sparc Yao Qi
` (9 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Yao Qi @ 2016-11-14 17:43 UTC (permalink / raw)
To: gdb-patches
gdb:
2016-11-10 Yao Qi <yao.qi@linaro.org>
* mips-tdep.c (mips32_bc1_pc): Replace parameter frame with
regcache. Call regcache_raw_get_unsigned instead of
get_frame_register_unsigned.
(mips32_next_pc): Likewise.
(micromips_bc1_pc): Likewise.
(micromips_next_pc): Likewise.
(extended_mips16_next_pc): Likewise.
(mips16_next_pc): Likewise.
(mips_next_pc): Likewise.
(mips_software_single_step): Call get_regcache_arch instead
of get_frame_arch.
---
gdb/mips-tdep.c | 140 ++++++++++++++++++++++++++++----------------------------
1 file changed, 71 insertions(+), 69 deletions(-)
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index c0c6442..ba0d71d 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -1544,7 +1544,7 @@ mips32_relative_offset (ULONGEST inst)
number of the floating condition bits tested by the branch. */
static CORE_ADDR
-mips32_bc1_pc (struct gdbarch *gdbarch, struct frame_info *frame,
+mips32_bc1_pc (struct gdbarch *gdbarch, struct regcache *regcache,
ULONGEST inst, CORE_ADDR pc, int count)
{
int fcsr = mips_regnum (gdbarch)->fp_control_status;
@@ -1558,7 +1558,7 @@ mips32_bc1_pc (struct gdbarch *gdbarch, struct frame_info *frame,
/* No way to handle; it'll most likely trap anyway. */
return pc;
- fcs = get_frame_register_unsigned (frame, fcsr);
+ fcs = regcache_raw_get_unsigned (regcache, fcsr);
cond = ((fcs >> 24) & 0xfe) | ((fcs >> 23) & 0x01);
if (((cond >> cnum) & mask) != mask * !tf)
@@ -1602,9 +1602,9 @@ is_octeon_bbit_op (int op, struct gdbarch *gdbarch)
branch prediction. */
static CORE_ADDR
-mips32_next_pc (struct frame_info *frame, CORE_ADDR pc)
+mips32_next_pc (struct regcache *regcache, CORE_ADDR pc)
{
- struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
unsigned long inst;
int op;
inst = mips_fetch_instruction (gdbarch, ISA_MIPS, pc, NULL);
@@ -1631,15 +1631,15 @@ mips32_next_pc (struct frame_info *frame, CORE_ADDR pc)
}
else if (op == 17 && itype_rs (inst) == 8)
/* BC1F, BC1FL, BC1T, BC1TL: 010001 01000 */
- pc = mips32_bc1_pc (gdbarch, frame, inst, pc + 4, 1);
+ pc = mips32_bc1_pc (gdbarch, regcache, inst, pc + 4, 1);
else if (op == 17 && itype_rs (inst) == 9
&& (itype_rt (inst) & 2) == 0)
/* BC1ANY2F, BC1ANY2T: 010001 01001 xxx0x */
- pc = mips32_bc1_pc (gdbarch, frame, inst, pc + 4, 2);
+ pc = mips32_bc1_pc (gdbarch, regcache, inst, pc + 4, 2);
else if (op == 17 && itype_rs (inst) == 10
&& (itype_rt (inst) & 2) == 0)
/* BC1ANY4F, BC1ANY4T: 010001 01010 xxx0x */
- pc = mips32_bc1_pc (gdbarch, frame, inst, pc + 4, 4);
+ pc = mips32_bc1_pc (gdbarch, regcache, inst, pc + 4, 4);
else if (op == 29)
/* JALX: 011101 */
/* The new PC will be alternate mode. */
@@ -1661,8 +1661,8 @@ mips32_next_pc (struct frame_info *frame, CORE_ADDR pc)
if (op == 54 || op == 62)
bit += 32;
- if (((get_frame_register_signed (frame,
- itype_rs (inst)) >> bit) & 1)
+ if (((regcache_raw_get_signed (regcache,
+ itype_rs (inst)) >> bit) & 1)
== branch_if)
pc += mips32_relative_offset (inst) + 4;
else
@@ -1685,15 +1685,15 @@ mips32_next_pc (struct frame_info *frame, CORE_ADDR pc)
case 8: /* JR */
case 9: /* JALR */
/* Set PC to that address. */
- pc = get_frame_register_signed (frame, rtype_rs (inst));
+ pc = regcache_raw_get_signed (regcache, rtype_rs (inst));
break;
case 12: /* SYSCALL */
{
struct gdbarch_tdep *tdep;
- tdep = gdbarch_tdep (get_frame_arch (frame));
+ tdep = gdbarch_tdep (gdbarch);
if (tdep->syscall_next_pc != NULL)
- pc = tdep->syscall_next_pc (frame);
+ pc = tdep->syscall_next_pc (get_current_frame ());
else
pc += 4;
}
@@ -1713,7 +1713,7 @@ mips32_next_pc (struct frame_info *frame, CORE_ADDR pc)
case 16: /* BLTZAL */
case 18: /* BLTZALL */
less_branch:
- if (get_frame_register_signed (frame, itype_rs (inst)) < 0)
+ if (regcache_raw_get_signed (regcache, itype_rs (inst)) < 0)
pc += mips32_relative_offset (inst) + 4;
else
pc += 8; /* after the delay slot */
@@ -1722,7 +1722,7 @@ mips32_next_pc (struct frame_info *frame, CORE_ADDR pc)
case 3: /* BGEZL */
case 17: /* BGEZAL */
case 19: /* BGEZALL */
- if (get_frame_register_signed (frame, itype_rs (inst)) >= 0)
+ if (regcache_raw_get_signed (regcache, itype_rs (inst)) >= 0)
pc += mips32_relative_offset (inst) + 4;
else
pc += 8; /* after the delay slot */
@@ -1739,8 +1739,8 @@ mips32_next_pc (struct frame_info *frame, CORE_ADDR pc)
/* No way to handle; it'll most likely trap anyway. */
break;
- if ((get_frame_register_unsigned (frame,
- dspctl) & 0x7f) >= pos)
+ if ((regcache_raw_get_unsigned (regcache,
+ dspctl) & 0x7f) >= pos)
pc += mips32_relative_offset (inst);
else
pc += 4;
@@ -1763,22 +1763,22 @@ mips32_next_pc (struct frame_info *frame, CORE_ADDR pc)
break;
case 4: /* BEQ, BEQL */
equal_branch:
- if (get_frame_register_signed (frame, itype_rs (inst)) ==
- get_frame_register_signed (frame, itype_rt (inst)))
+ if (regcache_raw_get_signed (regcache, itype_rs (inst)) ==
+ regcache_raw_get_signed (regcache, itype_rt (inst)))
pc += mips32_relative_offset (inst) + 4;
else
pc += 8;
break;
case 5: /* BNE, BNEL */
neq_branch:
- if (get_frame_register_signed (frame, itype_rs (inst)) !=
- get_frame_register_signed (frame, itype_rt (inst)))
+ if (regcache_raw_get_signed (regcache, itype_rs (inst)) !=
+ regcache_raw_get_signed (regcache, itype_rt (inst)))
pc += mips32_relative_offset (inst) + 4;
else
pc += 8;
break;
case 6: /* BLEZ, BLEZL */
- if (get_frame_register_signed (frame, itype_rs (inst)) <= 0)
+ if (regcache_raw_get_signed (regcache, itype_rs (inst)) <= 0)
pc += mips32_relative_offset (inst) + 4;
else
pc += 8;
@@ -1786,7 +1786,7 @@ mips32_next_pc (struct frame_info *frame, CORE_ADDR pc)
case 7:
default:
greater_branch: /* BGTZ, BGTZL */
- if (get_frame_register_signed (frame, itype_rs (inst)) > 0)
+ if (regcache_raw_get_signed (regcache, itype_rs (inst)) > 0)
pc += mips32_relative_offset (inst) + 4;
else
pc += 8;
@@ -1840,7 +1840,7 @@ micromips_pc_insn_size (struct gdbarch *gdbarch, CORE_ADDR pc)
examined by the branch. */
static CORE_ADDR
-micromips_bc1_pc (struct gdbarch *gdbarch, struct frame_info *frame,
+micromips_bc1_pc (struct gdbarch *gdbarch, struct regcache *regcache,
ULONGEST insn, CORE_ADDR pc, int count)
{
int fcsr = mips_regnum (gdbarch)->fp_control_status;
@@ -1854,7 +1854,7 @@ micromips_bc1_pc (struct gdbarch *gdbarch, struct frame_info *frame,
/* No way to handle; it'll most likely trap anyway. */
return pc;
- fcs = get_frame_register_unsigned (frame, fcsr);
+ fcs = regcache_raw_get_unsigned (regcache, fcsr);
cond = ((fcs >> 24) & 0xfe) | ((fcs >> 23) & 0x01);
if (((cond >> cnum) & mask) != mask * !tf)
@@ -1869,9 +1869,9 @@ micromips_bc1_pc (struct gdbarch *gdbarch, struct frame_info *frame,
after the instruction at the address PC. */
static CORE_ADDR
-micromips_next_pc (struct frame_info *frame, CORE_ADDR pc)
+micromips_next_pc (struct regcache *regcache, CORE_ADDR pc)
{
- struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
ULONGEST insn;
insn = mips_fetch_instruction (gdbarch, ISA_MICROMIPS, pc, NULL);
@@ -1891,7 +1891,7 @@ micromips_next_pc (struct frame_info *frame, CORE_ADDR pc)
&& (b6s10_ext (insn) & 0x2bf) == 0x3c)
/* JALR, JALR.HB: 000000 000x111100 111100 */
/* JALRS, JALRS.HB: 000000 010x111100 111100 */
- pc = get_frame_register_signed (frame, b0s5_reg (insn >> 16));
+ pc = regcache_raw_get_signed (regcache, b0s5_reg (insn >> 16));
break;
case 0x10: /* POOL32I: bits 010000 */
@@ -1900,8 +1900,8 @@ micromips_next_pc (struct frame_info *frame, CORE_ADDR pc)
case 0x00: /* BLTZ: bits 010000 00000 */
case 0x01: /* BLTZAL: bits 010000 00001 */
case 0x11: /* BLTZALS: bits 010000 10001 */
- if (get_frame_register_signed (frame,
- b0s5_reg (insn >> 16)) < 0)
+ if (regcache_raw_get_signed (regcache,
+ b0s5_reg (insn >> 16)) < 0)
pc += micromips_relative_offset16 (insn);
else
pc += micromips_pc_insn_size (gdbarch, pc);
@@ -1910,38 +1910,38 @@ micromips_next_pc (struct frame_info *frame, CORE_ADDR pc)
case 0x02: /* BGEZ: bits 010000 00010 */
case 0x03: /* BGEZAL: bits 010000 00011 */
case 0x13: /* BGEZALS: bits 010000 10011 */
- if (get_frame_register_signed (frame,
- b0s5_reg (insn >> 16)) >= 0)
+ if (regcache_raw_get_signed (regcache,
+ b0s5_reg (insn >> 16)) >= 0)
pc += micromips_relative_offset16 (insn);
else
pc += micromips_pc_insn_size (gdbarch, pc);
break;
case 0x04: /* BLEZ: bits 010000 00100 */
- if (get_frame_register_signed (frame,
- b0s5_reg (insn >> 16)) <= 0)
+ if (regcache_raw_get_signed (regcache,
+ b0s5_reg (insn >> 16)) <= 0)
pc += micromips_relative_offset16 (insn);
else
pc += micromips_pc_insn_size (gdbarch, pc);
break;
case 0x05: /* BNEZC: bits 010000 00101 */
- if (get_frame_register_signed (frame,
- b0s5_reg (insn >> 16)) != 0)
+ if (regcache_raw_get_signed (regcache,
+ b0s5_reg (insn >> 16)) != 0)
pc += micromips_relative_offset16 (insn);
break;
case 0x06: /* BGTZ: bits 010000 00110 */
- if (get_frame_register_signed (frame,
- b0s5_reg (insn >> 16)) > 0)
+ if (regcache_raw_get_signed (regcache,
+ b0s5_reg (insn >> 16)) > 0)
pc += micromips_relative_offset16 (insn);
else
pc += micromips_pc_insn_size (gdbarch, pc);
break;
case 0x07: /* BEQZC: bits 010000 00111 */
- if (get_frame_register_signed (frame,
- b0s5_reg (insn >> 16)) == 0)
+ if (regcache_raw_get_signed (regcache,
+ b0s5_reg (insn >> 16)) == 0)
pc += micromips_relative_offset16 (insn);
break;
@@ -1962,8 +1962,8 @@ micromips_next_pc (struct frame_info *frame, CORE_ADDR pc)
/* No way to handle; it'll most likely trap anyway. */
break;
- if ((get_frame_register_unsigned (frame,
- dspctl) & 0x7f) >= pos)
+ if ((regcache_raw_get_unsigned (regcache,
+ dspctl) & 0x7f) >= pos)
pc += micromips_relative_offset16 (insn);
else
pc += micromips_pc_insn_size (gdbarch, pc);
@@ -1975,14 +1975,14 @@ micromips_next_pc (struct frame_info *frame, CORE_ADDR pc)
case 0x1d: /* BC1T: bits 010000 11101 xxx00 */
/* BC1ANY2T: bits 010000 11101 xxx01 */
if (((insn >> 16) & 0x2) == 0x0)
- pc = micromips_bc1_pc (gdbarch, frame, insn, pc,
+ pc = micromips_bc1_pc (gdbarch, regcache, insn, pc,
((insn >> 16) & 0x1) + 1);
break;
case 0x1e: /* BC1ANY4F: bits 010000 11110 xxx01 */
case 0x1f: /* BC1ANY4T: bits 010000 11111 xxx01 */
if (((insn >> 16) & 0x3) == 0x1)
- pc = micromips_bc1_pc (gdbarch, frame, insn, pc, 4);
+ pc = micromips_bc1_pc (gdbarch, regcache, insn, pc, 4);
break;
}
break;
@@ -1994,16 +1994,16 @@ micromips_next_pc (struct frame_info *frame, CORE_ADDR pc)
break;
case 0x25: /* BEQ: bits 100101 */
- if (get_frame_register_signed (frame, b0s5_reg (insn >> 16))
- == get_frame_register_signed (frame, b5s5_reg (insn >> 16)))
+ if (regcache_raw_get_signed (regcache, b0s5_reg (insn >> 16))
+ == regcache_raw_get_signed (regcache, b5s5_reg (insn >> 16)))
pc += micromips_relative_offset16 (insn);
else
pc += micromips_pc_insn_size (gdbarch, pc);
break;
case 0x2d: /* BNE: bits 101101 */
- if (get_frame_register_signed (frame, b0s5_reg (insn >> 16))
- != get_frame_register_signed (frame, b5s5_reg (insn >> 16)))
+ if (regcache_raw_get_signed (regcache, b0s5_reg (insn >> 16))
+ != regcache_raw_get_signed (regcache, b5s5_reg (insn >> 16)))
pc += micromips_relative_offset16 (insn);
else
pc += micromips_pc_insn_size (gdbarch, pc);
@@ -2022,17 +2022,17 @@ micromips_next_pc (struct frame_info *frame, CORE_ADDR pc)
case 0x11: /* POOL16C: bits 010001 */
if ((b5s5_op (insn) & 0x1c) == 0xc)
/* JR16, JRC, JALR16, JALRS16: 010001 011xx */
- pc = get_frame_register_signed (frame, b0s5_reg (insn));
+ pc = regcache_raw_get_signed (regcache, b0s5_reg (insn));
else if (b5s5_op (insn) == 0x18)
/* JRADDIUSP: bits 010001 11000 */
- pc = get_frame_register_signed (frame, MIPS_RA_REGNUM);
+ pc = regcache_raw_get_signed (regcache, MIPS_RA_REGNUM);
break;
case 0x23: /* BEQZ16: bits 100011 */
{
int rs = mips_reg3_to_reg[b7s3_reg (insn)];
- if (get_frame_register_signed (frame, rs) == 0)
+ if (regcache_raw_get_signed (regcache, rs) == 0)
pc += micromips_relative_offset7 (insn);
else
pc += micromips_pc_insn_size (gdbarch, pc);
@@ -2043,7 +2043,7 @@ micromips_next_pc (struct frame_info *frame, CORE_ADDR pc)
{
int rs = mips_reg3_to_reg[b7s3_reg (insn)];
- if (get_frame_register_signed (frame, rs) != 0)
+ if (regcache_raw_get_signed (regcache, rs) != 0)
pc += micromips_relative_offset7 (insn);
else
pc += micromips_pc_insn_size (gdbarch, pc);
@@ -2222,10 +2222,10 @@ add_offset_16 (CORE_ADDR pc, int offset)
}
static CORE_ADDR
-extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc,
+extended_mips16_next_pc (regcache *regcache, CORE_ADDR pc,
unsigned int extension, unsigned int insn)
{
- struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
int op = (insn >> 11);
switch (op)
{
@@ -2253,7 +2253,7 @@ extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc,
struct upk_mips16 upk;
int reg;
unpack_mips16 (gdbarch, pc, extension, insn, ritype, &upk);
- reg = get_frame_register_signed (frame, mips_reg3_to_reg[upk.regx]);
+ reg = regcache_raw_get_signed (regcache, mips_reg3_to_reg[upk.regx]);
if (reg == 0)
pc = add_offset_16 (pc, upk.offset);
else
@@ -2265,7 +2265,7 @@ extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc,
struct upk_mips16 upk;
int reg;
unpack_mips16 (gdbarch, pc, extension, insn, ritype, &upk);
- reg = get_frame_register_signed (frame, mips_reg3_to_reg[upk.regx]);
+ reg = regcache_raw_get_signed (regcache, mips_reg3_to_reg[upk.regx]);
if (reg != 0)
pc = add_offset_16 (pc, upk.offset);
else
@@ -2278,7 +2278,8 @@ extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc,
int reg;
unpack_mips16 (gdbarch, pc, extension, insn, i8type, &upk);
/* upk.regx contains the opcode */
- reg = get_frame_register_signed (frame, 24); /* Test register is 24 */
+ /* Test register is 24 */
+ reg = regcache_raw_get_signed (regcache, 24);
if (((upk.regx == 0) && (reg == 0)) /* BTEZ */
|| ((upk.regx == 1) && (reg != 0))) /* BTNEZ */
pc = add_offset_16 (pc, upk.offset);
@@ -2300,7 +2301,7 @@ extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc,
reg = mips_reg3_to_reg[upk.regx];
else
reg = 31; /* Function return instruction. */
- pc = get_frame_register_signed (frame, reg);
+ pc = regcache_raw_get_signed (regcache, reg);
}
else
pc += 2;
@@ -2312,7 +2313,7 @@ extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc,
that. */
{
pc += 2;
- pc = extended_mips16_next_pc (frame, pc, insn,
+ pc = extended_mips16_next_pc (regcache, pc, insn,
fetch_mips_16 (gdbarch, pc));
break;
}
@@ -2326,11 +2327,11 @@ extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc,
}
static CORE_ADDR
-mips16_next_pc (struct frame_info *frame, CORE_ADDR pc)
+mips16_next_pc (struct regcache *regcache, CORE_ADDR pc)
{
- struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
unsigned int insn = fetch_mips_16 (gdbarch, pc);
- return extended_mips16_next_pc (frame, pc, 0, insn);
+ return extended_mips16_next_pc (regcache, pc, 0, insn);
}
/* The mips_next_pc function supports single_step when the remote
@@ -2339,16 +2340,16 @@ mips16_next_pc (struct frame_info *frame, CORE_ADDR pc)
branch will go. This isn't hard because all the data is available.
The MIPS32, MIPS16 and microMIPS variants are quite different. */
static CORE_ADDR
-mips_next_pc (struct frame_info *frame, CORE_ADDR pc)
+mips_next_pc (struct regcache *regcache, CORE_ADDR pc)
{
- struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (mips_pc_is_mips16 (gdbarch, pc))
- return mips16_next_pc (frame, pc);
+ return mips16_next_pc (regcache, pc);
else if (mips_pc_is_micromips (gdbarch, pc))
- return micromips_next_pc (frame, pc);
+ return micromips_next_pc (regcache, pc);
else
- return mips32_next_pc (frame, pc);
+ return mips32_next_pc (regcache, pc);
}
/* Return non-zero if the MIPS16 instruction INSN is a compact branch
@@ -4150,16 +4151,17 @@ deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
VEC (CORE_ADDR) *
mips_software_single_step (struct frame_info *frame)
{
- struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct regcache *regcache = get_current_regcache ();
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
CORE_ADDR pc, next_pc;
VEC (CORE_ADDR) *next_pcs;
- pc = get_frame_pc (frame);
+ pc = regcache_read_pc (regcache);
next_pcs = deal_with_atomic_sequence (gdbarch, pc);
if (next_pcs != NULL)
return next_pcs;
- next_pc = mips_next_pc (frame, pc);
+ next_pc = mips_next_pc (regcache, pc);
VEC_safe_push (CORE_ADDR, next_pcs, next_pc);
return next_pcs;
--
1.9.1
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 08/13] gdbarch software_single_step frame_info to regcache: sparc
2016-11-14 17:43 [PATCH 00/13] Change gdbarch software_single_step frame_info to regcache Yao Qi
` (2 preceding siblings ...)
2016-11-14 17:43 ` [PATCH 05/13] gdbarch software_single_step frame_info to regcache: mips Yao Qi
@ 2016-11-14 17:43 ` Yao Qi
2016-11-14 17:43 ` [PATCH 10/13] gdbarch software_single_step frame_info to regcache: rs6000 Yao Qi
` (8 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Yao Qi @ 2016-11-14 17:43 UTC (permalink / raw)
To: gdb-patches
gdb:
2016-11-14 Yao Qi <yao.qi@linaro.org>
* sparc-tdep.c (sparc_analyze_control_transfer): Replace parameter
frame with regcache. Call get_current_frame.
(sparc_software_single_step): Call get_regcache_arch instead of
get_frame_arch. Call regcache_raw_get_unsigned instead of
get_frame_register_unsigned.
---
gdb/sparc-tdep.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index ea2435e..18b627d 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -1501,7 +1501,7 @@ sparc32_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
software single-step mechanism. */
static CORE_ADDR
-sparc_analyze_control_transfer (struct frame_info *frame,
+sparc_analyze_control_transfer (struct regcache *regcache,
CORE_ADDR pc, CORE_ADDR *npc)
{
unsigned long insn = sparc_fetch_instruction (pc);
@@ -1552,8 +1552,11 @@ sparc_analyze_control_transfer (struct frame_info *frame,
}
else if (X_OP (insn) == 2 && X_OP3 (insn) == 0x3a)
{
+ struct frame_info *frame = get_current_frame ();
+
/* Trap instruction (TRAP). */
- return gdbarch_tdep (get_frame_arch (frame))->step_trap (frame, insn);
+ return gdbarch_tdep (get_regcache_arch (regcache))->step_trap (frame,
+ insn);
}
/* FIXME: Handle DONE and RETRY instructions. */
@@ -1602,19 +1605,19 @@ sparc_step_trap (struct frame_info *frame, unsigned long insn)
static VEC (CORE_ADDR) *
sparc_software_single_step (struct frame_info *frame)
{
- struct gdbarch *arch = get_frame_arch (frame);
+ struct regcache *regcache = get_current_regcache ();
+ struct gdbarch *arch = get_regcache_arch (regcache);
struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
- struct address_space *aspace = get_frame_address_space (frame);
CORE_ADDR npc, nnpc;
CORE_ADDR pc, orig_npc;
VEC (CORE_ADDR) *next_pcs = NULL;
- pc = get_frame_register_unsigned (frame, tdep->pc_regnum);
- orig_npc = npc = get_frame_register_unsigned (frame, tdep->npc_regnum);
+ pc = regcache_raw_get_unsigned (regcache, tdep->pc_regnum);
+ orig_npc = npc = regcache_raw_get_unsigned (regcache, tdep->npc_regnum);
/* Analyze the instruction at PC. */
- nnpc = sparc_analyze_control_transfer (frame, pc, &npc);
+ nnpc = sparc_analyze_control_transfer (regcache, pc, &npc);
if (npc != 0)
VEC_safe_push (CORE_ADDR, next_pcs, npc);
--
1.9.1
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 10/13] gdbarch software_single_step frame_info to regcache: rs6000
2016-11-14 17:43 [PATCH 00/13] Change gdbarch software_single_step frame_info to regcache Yao Qi
` (3 preceding siblings ...)
2016-11-14 17:43 ` [PATCH 08/13] gdbarch software_single_step frame_info to regcache: sparc Yao Qi
@ 2016-11-14 17:43 ` Yao Qi
2016-11-14 17:43 ` [PATCH 03/13] gdbarch software_single_step frame_info to regcache: alpha Yao Qi
` (7 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Yao Qi @ 2016-11-14 17:43 UTC (permalink / raw)
To: gdb-patches
gdb:
2016-11-10 Yao Qi <yao.qi@linaro.org>
* 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. */
--
1.9.1
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 03/13] gdbarch software_single_step frame_info to regcache: alpha
2016-11-14 17:43 [PATCH 00/13] Change gdbarch software_single_step frame_info to regcache Yao Qi
` (4 preceding siblings ...)
2016-11-14 17:43 ` [PATCH 10/13] gdbarch software_single_step frame_info to regcache: rs6000 Yao Qi
@ 2016-11-14 17:43 ` Yao Qi
2016-11-14 17:43 ` [PATCH 02/13] gdbarch software_single_step frame_info to regcache: aarch64 Yao Qi
` (6 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Yao Qi @ 2016-11-14 17:43 UTC (permalink / raw)
To: gdb-patches
gdb:
2016-11-10 Yao Qi <yao.qi@linaro.org>
* alpha-tdep.c (alpha_deal_with_atomic_sequence): Call
get_regcache_arch instead of get_frame_arch. Call
regcache_read_pc instead of get_frame_pc.
(alpha_next_pc): Replace parameter frame with regcache.
Call regcache_raw_get_unsigned instead of
get_frame_register_unsigned.
---
gdb/alpha-tdep.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index a0485ef..9753c1b 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -768,8 +768,9 @@ static const int stq_c_opcode = 0x2f;
static VEC (CORE_ADDR) *
alpha_deal_with_atomic_sequence (struct frame_info *frame)
{
- struct gdbarch *gdbarch = get_frame_arch (frame);
- CORE_ADDR pc = get_frame_pc (frame);
+ 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};
CORE_ADDR loc = pc;
CORE_ADDR closing_insn; /* Instruction that closes the atomic sequence. */
@@ -1597,9 +1598,9 @@ fp_register_sign_bit (LONGEST reg)
the target of the coming instruction and breakpoint it. */
static CORE_ADDR
-alpha_next_pc (struct frame_info *frame, CORE_ADDR pc)
+alpha_next_pc (struct regcache *regcache, CORE_ADDR pc)
{
- struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
unsigned int insn;
unsigned int op;
int regno;
@@ -1615,7 +1616,7 @@ alpha_next_pc (struct frame_info *frame, CORE_ADDR pc)
{
/* Jump format: target PC is:
RB & ~3 */
- return (get_frame_register_unsigned (frame, (insn >> 16) & 0x1f) & ~3);
+ return (regcache_raw_get_unsigned (regcache, (insn >> 16) & 0x1f) & ~3);
}
if ((op & 0x30) == 0x30)
@@ -1646,7 +1647,7 @@ alpha_next_pc (struct frame_info *frame, CORE_ADDR pc)
regno += gdbarch_fp0_regnum (gdbarch);
}
- rav = get_frame_register_signed (frame, regno);
+ rav = regcache_raw_get_signed (regcache, regno);
switch (op)
{
@@ -1720,13 +1721,14 @@ alpha_next_pc (struct frame_info *frame, CORE_ADDR pc)
VEC (CORE_ADDR) *
alpha_software_single_step (struct frame_info *frame)
{
- struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct regcache *regcache = get_current_regcache ();
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
CORE_ADDR pc;
VEC (CORE_ADDR) *next_pcs = NULL;
- pc = get_frame_pc (frame);
+ pc = regcache_read_pc (regcache);
- VEC_safe_push (CORE_ADDR, next_pcs, alpha_next_pc (frame, pc));
+ VEC_safe_push (CORE_ADDR, next_pcs, alpha_next_pc (regcache, pc));
return next_pcs;
}
--
1.9.1
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 02/13] gdbarch software_single_step frame_info to regcache: aarch64
2016-11-14 17:43 [PATCH 00/13] Change gdbarch software_single_step frame_info to regcache Yao Qi
` (5 preceding siblings ...)
2016-11-14 17:43 ` [PATCH 03/13] gdbarch software_single_step frame_info to regcache: alpha Yao Qi
@ 2016-11-14 17:43 ` Yao Qi
2016-11-14 17:43 ` [PATCH 04/13] gdbarch software_single_step frame_info to regcache: cris Yao Qi
` (5 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Yao Qi @ 2016-11-14 17:43 UTC (permalink / raw)
To: gdb-patches
Use regcache in software_single_step.
gdb:
2016-11-14 Yao Qi <yao.qi@linaro.org>
* aarch64-tdep.c (aarch64_software_single_step): Call
get_regcache_arch instead of get_frame_arch. Call
regcache_read_pc instead of get_frame_pc.
---
gdb/aarch64-tdep.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index b5a88cc..62ee3c5 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -2227,11 +2227,12 @@ value_of_aarch64_user_reg (struct frame_info *frame, const void *baton)
static VEC (CORE_ADDR) *
aarch64_software_single_step (struct frame_info *frame)
{
- struct gdbarch *gdbarch = get_frame_arch (frame);
+ 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;
const int atomic_sequence_length = 16; /* Instruction sequence length. */
- 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 = 0;
--
1.9.1
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 04/13] gdbarch software_single_step frame_info to regcache: cris
2016-11-14 17:43 [PATCH 00/13] Change gdbarch software_single_step frame_info to regcache Yao Qi
` (6 preceding siblings ...)
2016-11-14 17:43 ` [PATCH 02/13] gdbarch software_single_step frame_info to regcache: aarch64 Yao Qi
@ 2016-11-14 17:43 ` Yao Qi
2016-11-14 17:43 ` [PATCH 07/13] gdbarch software_single_step frame_info to regcache: nios2 Yao Qi
` (4 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Yao Qi @ 2016-11-14 17:43 UTC (permalink / raw)
To: gdb-patches
gdb:
2016-11-10 Yao Qi <yao.qi@linaro.org>
* cris-tdep.c (find_step_target): 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.
(cris_software_single_step): Call get_regcache_arch instead
of get_frame_arch.
---
gdb/cris-tdep.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 460e7eb..6b060ea 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -1989,25 +1989,25 @@ find_cris_op (unsigned short insn, inst_env_type *inst_env)
actually an internal error. */
static int
-find_step_target (struct frame_info *frame, inst_env_type *inst_env)
+find_step_target (struct regcache *regcache, inst_env_type *inst_env)
{
int i;
int offset;
unsigned short insn;
- struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* Create a local register image and set the initial state. */
for (i = 0; i < NUM_GENREGS; i++)
{
inst_env->reg[i] =
- (unsigned long) get_frame_register_unsigned (frame, i);
+ (unsigned long) regcache_raw_get_unsigned (regcache, i);
}
offset = NUM_GENREGS;
for (i = 0; i < NUM_SPECREGS; i++)
{
inst_env->preg[i] =
- (unsigned long) get_frame_register_unsigned (frame, offset + i);
+ (unsigned long) regcache_raw_get_unsigned (regcache, offset + i);
}
inst_env->branch_found = 0;
inst_env->slot_needed = 0;
@@ -2063,13 +2063,14 @@ find_step_target (struct frame_info *frame, inst_env_type *inst_env)
static VEC (CORE_ADDR) *
cris_software_single_step (struct frame_info *frame)
{
- struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct regcache *regcache = get_current_regcache ();
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
inst_env_type inst_env;
VEC (CORE_ADDR) *next_pcs = NULL;
/* Analyse the present instruction environment and insert
breakpoints. */
- int status = find_step_target (frame, &inst_env);
+ int status = find_step_target (regcache, &inst_env);
if (status == -1)
{
/* Could not find a target. Things are likely to go downhill
--
1.9.1
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 07/13] gdbarch software_single_step frame_info to regcache: nios2
2016-11-14 17:43 [PATCH 00/13] Change gdbarch software_single_step frame_info to regcache Yao Qi
` (7 preceding siblings ...)
2016-11-14 17:43 ` [PATCH 04/13] gdbarch software_single_step frame_info to regcache: cris Yao Qi
@ 2016-11-14 17:43 ` Yao Qi
2016-11-14 17:43 ` [PATCH 06/13] gdbarch software_single_step frame_info to regcache: moxie Yao Qi
` (3 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Yao Qi @ 2016-11-14 17:43 UTC (permalink / raw)
To: gdb-patches
gdb:
2016-11-14 Yao Qi <yao.qi@linaro.org>
* 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);
--
1.9.1
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 06/13] gdbarch software_single_step frame_info to regcache: moxie
2016-11-14 17:43 [PATCH 00/13] Change gdbarch software_single_step frame_info to regcache Yao Qi
` (8 preceding siblings ...)
2016-11-14 17:43 ` [PATCH 07/13] gdbarch software_single_step frame_info to regcache: nios2 Yao Qi
@ 2016-11-14 17:43 ` Yao Qi
2016-11-14 17:43 ` [PATCH 11/13] gdbarch software_single_step frame_info to regcache: tic6x Yao Qi
` (2 subsequent siblings)
12 siblings, 0 replies; 18+ messages in thread
From: Yao Qi @ 2016-11-14 17:43 UTC (permalink / raw)
To: gdb-patches
gdb:
2016-11-10 Yao Qi <yao.qi@linaro.org>
* moxie-tdep.c (moxie_software_single_step): Call
get_regcache_arch instead of get_frame_arch. Call
regcache_read_pc instead of get_frame_pc.
---
gdb/moxie-tdep.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index b341945..90a6165 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -302,17 +302,17 @@ moxie_process_readu (CORE_ADDR addr, gdb_byte *buf,
static VEC (CORE_ADDR) *
moxie_software_single_step (struct frame_info *frame)
{
- struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct regcache *regcache = get_current_regcache ();
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
CORE_ADDR addr;
gdb_byte buf[4];
uint16_t inst;
uint32_t tmpu32;
ULONGEST fp;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- struct regcache *regcache = get_current_regcache ();
VEC (CORE_ADDR) *next_pcs = NULL;
- addr = get_frame_pc (frame);
+ addr = regcache_read_pc (regcache);
inst = (uint16_t) moxie_process_readu (addr, buf, 2, byte_order);
--
1.9.1
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 11/13] gdbarch software_single_step frame_info to regcache: tic6x
2016-11-14 17:43 [PATCH 00/13] Change gdbarch software_single_step frame_info to regcache Yao Qi
` (9 preceding siblings ...)
2016-11-14 17:43 ` [PATCH 06/13] gdbarch software_single_step frame_info to regcache: moxie Yao Qi
@ 2016-11-14 17:43 ` Yao Qi
2016-11-14 17:43 ` [PATCH 01/13] New regcache_raw_get_signed Yao Qi
2016-11-14 17:43 ` [PATCH 09/13] gdbarch software_single_step frame_info to regcache: s390 Yao Qi
12 siblings, 0 replies; 18+ messages in thread
From: Yao Qi @ 2016-11-14 17:43 UTC (permalink / raw)
To: gdb-patches
gdb:
2016-11-10 Yao Qi <yao.qi@linaro.org>
* tic6x-tdep.c (tic6x_condition_true): Replace frame with
regcache. Call regcache_raw_get_signed instead of
get_frame_register_signed.
(tic6x_get_next_pc): Likewise. Caller updated.
---
gdb/tic6x-tdep.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index 399795c..145534a 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -563,7 +563,7 @@ tic6x_fetch_instruction (struct gdbarch *gdbarch, CORE_ADDR pc)
return 1 if INST is not a conditional instruction. */
static int
-tic6x_condition_true (struct frame_info *frame, unsigned long inst)
+tic6x_condition_true (struct regcache *regcache, unsigned long inst)
{
int register_number;
int register_value;
@@ -573,7 +573,7 @@ tic6x_condition_true (struct frame_info *frame, unsigned long inst)
if (register_number == -1)
return 1;
- register_value = get_frame_register_signed (frame, register_number);
+ register_value = regcache_raw_get_signed (regcache, register_number);
if ((inst & 0x10000000) != 0)
return register_value == 0;
return register_value != 0;
@@ -604,9 +604,9 @@ tic6x_extract_signed_field (int value, int low_bit, int bits)
/* Determine where to set a single step breakpoint. */
static CORE_ADDR
-tic6x_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
+tic6x_get_next_pc (struct regcache *regcache, CORE_ADDR pc)
{
- struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
unsigned long inst;
int register_number;
int last = 0;
@@ -622,10 +622,10 @@ tic6x_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (tdep->syscall_next_pc != NULL)
- return tdep->syscall_next_pc (frame);
+ return tdep->syscall_next_pc (get_current_frame ());
}
- if (tic6x_condition_true (frame, inst))
+ if (tic6x_condition_true (regcache, inst))
{
if ((inst & 0x0000007c) == 0x00000010)
{
@@ -641,7 +641,7 @@ tic6x_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
register_number = tic6x_register_number ((inst >> 18) & 0x1f,
INST_S_BIT (inst),
INST_X_BIT (inst));
- pc = get_frame_register_unsigned (frame, register_number);
+ pc = regcache_raw_get_unsigned (regcache, register_number);
break;
}
if ((inst & 0x00001ffc) == 0x00001020)
@@ -649,7 +649,7 @@ tic6x_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
/* BDEC */
register_number = tic6x_register_number ((inst >> 23) & 0x1f,
INST_S_BIT (inst), 0);
- if (get_frame_register_signed (frame, register_number) >= 0)
+ if (regcache_raw_get_signed (regcache, register_number) >= 0)
{
pc &= ~(TIC6X_FETCH_PACKET_SIZE - 1);
pc += tic6x_extract_signed_field (inst, 7, 10) << 2;
@@ -668,7 +668,7 @@ tic6x_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
/* BNOP with register */
register_number = tic6x_register_number ((inst >> 18) & 0x1f,
1, INST_X_BIT (inst));
- pc = get_frame_register_unsigned (frame, register_number);
+ pc = regcache_raw_get_unsigned (regcache, register_number);
break;
}
if ((inst & 0x00001ffc) == 0x00000020)
@@ -676,7 +676,7 @@ tic6x_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
/* BPOS */
register_number = tic6x_register_number ((inst >> 23) & 0x1f,
INST_S_BIT (inst), 0);
- if (get_frame_register_signed (frame, register_number) >= 0)
+ if (regcache_raw_get_signed (regcache, register_number) >= 0)
{
pc &= ~(TIC6X_FETCH_PACKET_SIZE - 1);
pc += tic6x_extract_signed_field (inst, 13, 10) << 2;
@@ -702,7 +702,8 @@ tic6x_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
static VEC (CORE_ADDR) *
tic6x_software_single_step (struct frame_info *frame)
{
- CORE_ADDR next_pc = tic6x_get_next_pc (frame, get_frame_pc (frame));
+ 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;
VEC_safe_push (CORE_ADDR, next_pcs, next_pc);
--
1.9.1
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH 01/13] New regcache_raw_get_signed
2016-11-14 17:43 [PATCH 00/13] Change gdbarch software_single_step frame_info to regcache Yao Qi
` (10 preceding siblings ...)
2016-11-14 17:43 ` [PATCH 11/13] gdbarch software_single_step frame_info to regcache: tic6x Yao Qi
@ 2016-11-14 17:43 ` Yao Qi
2016-11-16 15:09 ` Luis Machado
2016-11-14 17:43 ` [PATCH 09/13] gdbarch software_single_step frame_info to regcache: s390 Yao Qi
12 siblings, 1 reply; 18+ messages in thread
From: Yao Qi @ 2016-11-14 17:43 UTC (permalink / raw)
To: gdb-patches
This patch adds a new regcache api regcache_raw_get_signed.
gdb:
2016-11-14 Yao Qi <yao.qi@linaro.org>
* regcache.c (regcache_raw_get_signed): New function.
* regcache.h (regcache_raw_get_signed): Declare.
---
gdb/regcache.c | 13 +++++++++++++
gdb/regcache.h | 3 +++
2 files changed, 16 insertions(+)
diff --git a/gdb/regcache.c b/gdb/regcache.c
index a5c90a6..1fcf933 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -742,6 +742,19 @@ regcache_raw_write_unsigned (struct regcache *regcache, int regnum,
regcache_raw_write (regcache, regnum, buf);
}
+LONGEST
+regcache_raw_get_signed (struct regcache *regcache, int regnum)
+{
+ LONGEST value;
+ enum register_status status;
+
+ status = regcache_raw_read_signed (regcache, regnum, &value);
+ if (status == REG_UNAVAILABLE)
+ throw_error (NOT_AVAILABLE_ERROR,
+ _("Register %d is not available"), regnum);
+ return value;
+}
+
enum register_status
regcache_cooked_read (struct regcache *regcache, int regnum, gdb_byte *buf)
{
diff --git a/gdb/regcache.h b/gdb/regcache.h
index 1bb0ce0..19ea976 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -66,6 +66,9 @@ extern void regcache_raw_write_signed (struct regcache *regcache,
extern void regcache_raw_write_unsigned (struct regcache *regcache,
int regnum, ULONGEST val);
+extern LONGEST regcache_raw_get_signed (struct regcache *regcache,
+ int regnum);
+
/* Set a raw register's value in the regcache's buffer. Unlike
regcache_raw_write, this is not write-through. The intention is
allowing to change the buffer contents of a read-only regcache
--
1.9.1
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 01/13] New regcache_raw_get_signed
2016-11-14 17:43 ` [PATCH 01/13] New regcache_raw_get_signed Yao Qi
@ 2016-11-16 15:09 ` Luis Machado
2016-11-22 9:28 ` Yao Qi
0 siblings, 1 reply; 18+ messages in thread
From: Luis Machado @ 2016-11-16 15:09 UTC (permalink / raw)
To: Yao Qi, gdb-patches
On 11/14/2016 11:42 AM, Yao Qi wrote:
> This patch adds a new regcache api regcache_raw_get_signed.
>
> gdb:
>
> 2016-11-14 Yao Qi <yao.qi@linaro.org>
>
> * regcache.c (regcache_raw_get_signed): New function.
> * regcache.h (regcache_raw_get_signed): Declare.
> ---
> gdb/regcache.c | 13 +++++++++++++
> gdb/regcache.h | 3 +++
> 2 files changed, 16 insertions(+)
>
> diff --git a/gdb/regcache.c b/gdb/regcache.c
> index a5c90a6..1fcf933 100644
> --- a/gdb/regcache.c
> +++ b/gdb/regcache.c
> @@ -742,6 +742,19 @@ regcache_raw_write_unsigned (struct regcache *regcache, int regnum,
> regcache_raw_write (regcache, regnum, buf);
> }
>
> +LONGEST
> +regcache_raw_get_signed (struct regcache *regcache, int regnum)
> +{
I don't quite like the name, but it is debatable whether it is
appropriate or not. :-)
Making it shorter and to the point since it gets used so much?
> + LONGEST value;
> + enum register_status status;
> +
> + status = regcache_raw_read_signed (regcache, regnum, &value);
> + if (status == REG_UNAVAILABLE)
> + throw_error (NOT_AVAILABLE_ERROR,
> + _("Register %d is not available"), regnum);
> + return value;
> +}
> +
> enum register_status
> regcache_cooked_read (struct regcache *regcache, int regnum, gdb_byte *buf)
> {
> diff --git a/gdb/regcache.h b/gdb/regcache.h
> index 1bb0ce0..19ea976 100644
> --- a/gdb/regcache.h
> +++ b/gdb/regcache.h
> @@ -66,6 +66,9 @@ extern void regcache_raw_write_signed (struct regcache *regcache,
> extern void regcache_raw_write_unsigned (struct regcache *regcache,
> int regnum, ULONGEST val);
>
> +extern LONGEST regcache_raw_get_signed (struct regcache *regcache,
> + int regnum);
> +
> /* Set a raw register's value in the regcache's buffer. Unlike
> regcache_raw_write, this is not write-through. The intention is
> allowing to change the buffer contents of a read-only regcache
>
I understand this command just mimics what get_frame_register_signed
does, but is it worth having some documentation to make it clear what
this does and that it throws when a register is not available?
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 01/13] New regcache_raw_get_signed
2016-11-16 15:09 ` Luis Machado
@ 2016-11-22 9:28 ` Yao Qi
[not found] ` <36110d4e-9c80-23cb-ee40-849fb155af53@codesourcery.com>
0 siblings, 1 reply; 18+ messages in thread
From: Yao Qi @ 2016-11-22 9:28 UTC (permalink / raw)
To: Luis Machado; +Cc: gdb-patches
On Wed, Nov 16, 2016 at 09:09:40AM -0600, Luis Machado wrote:
> >
> >+LONGEST
> >+regcache_raw_get_signed (struct regcache *regcache, int regnum)
> >+{
>
> I don't quite like the name, but it is debatable whether it is
> appropriate or not. :-)
>
> Making it shorter and to the point since it gets used so much?
>
Hi Luis,
[Sorry for the late response. I was in a training last week, C++ 11
training btw.]
We've already had regcache_raw_get_unsigned (in common/common-regcache.h),
so it is reasonable to add regcache_raw_get_signed. The regcache API
scheme is like regcache_{raw,cooked}_{read,write,get}_{signed,unsigned}.
I can't find any redundant bits in the function name.
> >diff --git a/gdb/regcache.h b/gdb/regcache.h
> >index 1bb0ce0..19ea976 100644
> >--- a/gdb/regcache.h
> >+++ b/gdb/regcache.h
> >@@ -66,6 +66,9 @@ extern void regcache_raw_write_signed (struct regcache *regcache,
> > extern void regcache_raw_write_unsigned (struct regcache *regcache,
> > int regnum, ULONGEST val);
> >
> >+extern LONGEST regcache_raw_get_signed (struct regcache *regcache,
> >+ int regnum);
> >+
> > /* Set a raw register's value in the regcache's buffer. Unlike
> > regcache_raw_write, this is not write-through. The intention is
> > allowing to change the buffer contents of a read-only regcache
> >
>
> I understand this command just mimics what get_frame_register_signed
> does, but is it worth having some documentation to make it clear
> what this does and that it throws when a register is not available?
How about this comment ?
/* Return the register's value in signed or throw if it's not available. */
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 09/13] gdbarch software_single_step frame_info to regcache: s390
2016-11-14 17:43 [PATCH 00/13] Change gdbarch software_single_step frame_info to regcache Yao Qi
` (11 preceding siblings ...)
2016-11-14 17:43 ` [PATCH 01/13] New regcache_raw_get_signed Yao Qi
@ 2016-11-14 17:43 ` Yao Qi
12 siblings, 0 replies; 18+ messages in thread
From: Yao Qi @ 2016-11-14 17:43 UTC (permalink / raw)
To: gdb-patches
gdb:
2016-11-10 Yao Qi <yao.qi@linaro.org>
* s390-linux-tdep.c (s390_software_single_step): Call
get_regcache_arch instead of get_frame_arch. Call
regcache_read_pc instead of get_frame_pc.
---
gdb/s390-linux-tdep.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 885aadd..dc5c674 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -725,9 +725,9 @@ s390_is_partial_instruction (struct gdbarch *gdbarch, CORE_ADDR loc, int *len)
static VEC (CORE_ADDR) *
s390_software_single_step (struct frame_info *frame)
{
- struct gdbarch *gdbarch = get_frame_arch (frame);
- struct address_space *aspace = get_frame_address_space (frame);
- CORE_ADDR loc = get_frame_pc (frame);
+ 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);
int len;
uint16_t insn;
--
1.9.1
^ permalink raw reply [flat|nested] 18+ messages in thread