Change gdbarch software_single_step frame_info to regcache

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-22  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.
This commit is contained in:
Yao Qi 2016-11-22 14:05:06 +00:00
parent b2260160f8
commit f5ea389ac7
23 changed files with 57 additions and 42 deletions

View File

@ -1,3 +1,32 @@
2016-11-22 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.
2016-11-22 Yao Qi <yao.qi@linaro.org>
* spu-tdep.c (spu_software_single_step): Call get_regcache_arch

View File

@ -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;

View File

@ -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;

View File

@ -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 *);

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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++)

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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;

View File

@ -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);

View File

@ -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];

View File

@ -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;

View File

@ -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. */

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;