mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-04 22:15:12 +08:00
* gdbarch.sh (software_single_step): Remove "insert_breakpoints_p" and
"sig" arguments, add "regcache" argument. * gdbarch.c, gdbarch.h: Regenerate. * infrun.c (resume): Update SOFTWARE_SINGLE_STEP call arguments. (handle_inferior_event): Call remove_single_step_breakpoints directly instead of calling SOFTWARE_SINGLE_STEP to remove breakpoints. * alpha-tdep.c (alpha_software_single_step): Update argument list. Remove handling of !insert_breakpoints_p case. * arm-tdep.c (arm_software_single_step): Likewise. * cris-tdep.c (cris_software_single_step): Likewise. * mips-tdep.c (mips_software_single_step): Likewise. * rs6000-tdep.c (rs6000_software_single_step): Likewise. * sparc-tdep.c (sparc_software_single_step): Likewise. * spu-tdep.c (spu_software_single_step): Likewise. * alpha-tdep.h (alpha_software_single_step): Update prototype. * mips-tdep.h (mips_software_single_step): Likewise. * rs6000-tdep.h (rs6000_software_single_step): Likewise. * sparc-tdep.h (sparc_software_single_step): Likewise.
This commit is contained in:
@ -1,3 +1,27 @@
|
||||
2007-04-14 Ulrich Weigand <uweigand@de.ibm.com>
|
||||
|
||||
* gdbarch.sh (software_single_step): Remove "insert_breakpoints_p" and
|
||||
"sig" arguments, add "regcache" argument.
|
||||
* gdbarch.c, gdbarch.h: Regenerate.
|
||||
|
||||
* infrun.c (resume): Update SOFTWARE_SINGLE_STEP call arguments.
|
||||
(handle_inferior_event): Call remove_single_step_breakpoints directly
|
||||
instead of calling SOFTWARE_SINGLE_STEP to remove breakpoints.
|
||||
|
||||
* alpha-tdep.c (alpha_software_single_step): Update argument list.
|
||||
Remove handling of !insert_breakpoints_p case.
|
||||
* arm-tdep.c (arm_software_single_step): Likewise.
|
||||
* cris-tdep.c (cris_software_single_step): Likewise.
|
||||
* mips-tdep.c (mips_software_single_step): Likewise.
|
||||
* rs6000-tdep.c (rs6000_software_single_step): Likewise.
|
||||
* sparc-tdep.c (sparc_software_single_step): Likewise.
|
||||
* spu-tdep.c (spu_software_single_step): Likewise.
|
||||
|
||||
* alpha-tdep.h (alpha_software_single_step): Update prototype.
|
||||
* mips-tdep.h (mips_software_single_step): Likewise.
|
||||
* rs6000-tdep.h (rs6000_software_single_step): Likewise.
|
||||
* sparc-tdep.h (sparc_software_single_step): Likewise.
|
||||
|
||||
2007-04-14 Ulrich Weigand <uweigand@de.ibm.com>
|
||||
|
||||
* alpha-tdep.c (alpha_software_single_step): Do not call write_pc
|
||||
|
@ -1391,10 +1391,7 @@ fp_register_sign_bit (LONGEST reg)
|
||||
/* alpha_software_single_step() is called just before we want to resume
|
||||
the inferior, if we want to single-step it but there is no hardware
|
||||
or kernel single-step support (NetBSD on Alpha, for example). We find
|
||||
the target of the coming instruction and breakpoint it.
|
||||
|
||||
single_step is also called just after the inferior stops. If we had
|
||||
set up a simulated single-step, we undo our damage. */
|
||||
the target of the coming instruction and breakpoint it. */
|
||||
|
||||
static CORE_ADDR
|
||||
alpha_next_pc (CORE_ADDR pc)
|
||||
@ -1519,22 +1516,14 @@ alpha_next_pc (CORE_ADDR pc)
|
||||
}
|
||||
|
||||
int
|
||||
alpha_software_single_step (enum target_signal sig, int insert_breakpoints_p)
|
||||
alpha_software_single_step (struct regcache *regcache)
|
||||
{
|
||||
CORE_ADDR next_pc;
|
||||
CORE_ADDR pc;
|
||||
CORE_ADDR pc, next_pc;
|
||||
|
||||
if (insert_breakpoints_p)
|
||||
{
|
||||
pc = read_pc ();
|
||||
next_pc = alpha_next_pc (pc);
|
||||
|
||||
insert_single_step_breakpoint (next_pc);
|
||||
}
|
||||
else
|
||||
{
|
||||
remove_single_step_breakpoints ();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ struct gdbarch_tdep
|
||||
};
|
||||
|
||||
extern unsigned int alpha_read_insn (CORE_ADDR pc);
|
||||
extern int alpha_software_single_step (enum target_signal, int);
|
||||
extern int 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 *);
|
||||
|
@ -1902,26 +1902,17 @@ arm_get_next_pc (CORE_ADDR pc)
|
||||
/* single_step() is called just before we want to resume the inferior,
|
||||
if we want to single-step it but there is no hardware or kernel
|
||||
single-step support. We find the target of the coming instruction
|
||||
and breakpoint it.
|
||||
|
||||
single_step() is also called just after the inferior stops. If we
|
||||
had set up a simulated single-step, we undo our damage. */
|
||||
and breakpoint it. */
|
||||
|
||||
static int
|
||||
arm_software_single_step (enum target_signal sig, int insert_bpt)
|
||||
arm_software_single_step (struct regcache *regcache)
|
||||
{
|
||||
/* NOTE: This may insert the wrong breakpoint instruction when
|
||||
single-stepping over a mode-changing instruction, if the
|
||||
CPSR heuristics are used. */
|
||||
|
||||
if (insert_bpt)
|
||||
{
|
||||
CORE_ADDR next_pc = arm_get_next_pc (read_register (ARM_PC_REGNUM));
|
||||
|
||||
insert_single_step_breakpoint (next_pc);
|
||||
}
|
||||
else
|
||||
remove_single_step_breakpoints ();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -2120,12 +2120,10 @@ find_step_target (inst_env_type *inst_env)
|
||||
Either one ordinary target or two targets for branches may be found. */
|
||||
|
||||
static int
|
||||
cris_software_single_step (enum target_signal ignore, int insert_breakpoints)
|
||||
cris_software_single_step (struct regcache *regcache)
|
||||
{
|
||||
inst_env_type inst_env;
|
||||
|
||||
if (insert_breakpoints)
|
||||
{
|
||||
/* Analyse the present instruction environment and insert
|
||||
breakpoints. */
|
||||
int status = find_step_target (&inst_env);
|
||||
@ -2149,9 +2147,6 @@ cris_software_single_step (enum target_signal ignore, int insert_breakpoints)
|
||||
insert_single_step_breakpoint (branch_target_address);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
remove_single_step_breakpoints ();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1522,8 +1522,8 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
|
||||
#ifdef SOFTWARE_SINGLE_STEP
|
||||
fprintf_unfiltered (file,
|
||||
"gdbarch_dump: %s # %s\n",
|
||||
"SOFTWARE_SINGLE_STEP(sig, insert_breakpoints_p)",
|
||||
XSTRING (SOFTWARE_SINGLE_STEP (sig, insert_breakpoints_p)));
|
||||
"SOFTWARE_SINGLE_STEP(regcache)",
|
||||
XSTRING (SOFTWARE_SINGLE_STEP (regcache)));
|
||||
#endif
|
||||
fprintf_unfiltered (file,
|
||||
"gdbarch_dump: software_single_step = <0x%lx>\n",
|
||||
@ -3290,13 +3290,13 @@ gdbarch_software_single_step_p (struct gdbarch *gdbarch)
|
||||
}
|
||||
|
||||
int
|
||||
gdbarch_software_single_step (struct gdbarch *gdbarch, enum target_signal sig, int insert_breakpoints_p)
|
||||
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 (sig, insert_breakpoints_p);
|
||||
return gdbarch->software_single_step (regcache);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1173,14 +1173,14 @@ extern int gdbarch_software_single_step_p (struct gdbarch *gdbarch);
|
||||
#define SOFTWARE_SINGLE_STEP_P() (gdbarch_software_single_step_p (current_gdbarch))
|
||||
#endif
|
||||
|
||||
typedef int (gdbarch_software_single_step_ftype) (enum target_signal sig, int insert_breakpoints_p);
|
||||
extern int gdbarch_software_single_step (struct gdbarch *gdbarch, enum target_signal sig, int insert_breakpoints_p);
|
||||
typedef int (gdbarch_software_single_step_ftype) (struct regcache *regcache);
|
||||
extern int 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);
|
||||
#if !defined (GDB_TM_FILE) && defined (SOFTWARE_SINGLE_STEP)
|
||||
#error "Non multi-arch definition of SOFTWARE_SINGLE_STEP"
|
||||
#endif
|
||||
#if !defined (SOFTWARE_SINGLE_STEP)
|
||||
#define SOFTWARE_SINGLE_STEP(sig, insert_breakpoints_p) (gdbarch_software_single_step (current_gdbarch, sig, insert_breakpoints_p))
|
||||
#define SOFTWARE_SINGLE_STEP(regcache) (gdbarch_software_single_step (current_gdbarch, regcache))
|
||||
#endif
|
||||
|
||||
/* Return non-zero if the processor is executing a delay slot and a
|
||||
|
@ -628,7 +628,7 @@ f:=:CORE_ADDR:smash_text_address:CORE_ADDR addr:addr::core_addr_identity::0
|
||||
#
|
||||
# A return value of 1 means that the software_single_step breakpoints
|
||||
# were inserted; 0 means they were not.
|
||||
F:=:int:software_single_step:enum target_signal sig, int insert_breakpoints_p:sig, insert_breakpoints_p
|
||||
F:=:int: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.
|
||||
|
@ -548,7 +548,7 @@ resume (int step, enum target_signal sig)
|
||||
if (SOFTWARE_SINGLE_STEP_P () && step)
|
||||
{
|
||||
/* Do it the hard way, w/temp breakpoints */
|
||||
if (SOFTWARE_SINGLE_STEP (sig, 1 /*insert-breakpoints */ ))
|
||||
if (SOFTWARE_SINGLE_STEP (current_regcache))
|
||||
{
|
||||
/* ...and don't ask hardware to do it. */
|
||||
step = 0;
|
||||
@ -1571,7 +1571,7 @@ handle_inferior_event (struct execution_control_state *ecs)
|
||||
if (debug_infrun)
|
||||
fprintf_unfiltered (gdb_stdlog, "infrun: stepping_past_singlestep_breakpoint\n");
|
||||
/* Pull the single step breakpoints out of the target. */
|
||||
(void) SOFTWARE_SINGLE_STEP (0, 0);
|
||||
remove_single_step_breakpoints ();
|
||||
singlestep_breakpoints_inserted_p = 0;
|
||||
|
||||
ecs->random_signal = 0;
|
||||
@ -1680,7 +1680,7 @@ handle_inferior_event (struct execution_control_state *ecs)
|
||||
if (SOFTWARE_SINGLE_STEP_P () && singlestep_breakpoints_inserted_p)
|
||||
{
|
||||
/* Pull the single step breakpoints out of the target. */
|
||||
(void) SOFTWARE_SINGLE_STEP (0, 0);
|
||||
remove_single_step_breakpoints ();
|
||||
singlestep_breakpoints_inserted_p = 0;
|
||||
}
|
||||
|
||||
@ -1751,7 +1751,7 @@ handle_inferior_event (struct execution_control_state *ecs)
|
||||
if (SOFTWARE_SINGLE_STEP_P () && singlestep_breakpoints_inserted_p)
|
||||
{
|
||||
/* Pull the single step breakpoints out of the target. */
|
||||
(void) SOFTWARE_SINGLE_STEP (0, 0);
|
||||
remove_single_step_breakpoints ();
|
||||
singlestep_breakpoints_inserted_p = 0;
|
||||
}
|
||||
|
||||
|
@ -2199,26 +2199,17 @@ mips_addr_bits_remove (CORE_ADDR addr)
|
||||
/* mips_software_single_step() is called just before we want to resume
|
||||
the inferior, if we want to single-step it but there is no hardware
|
||||
or kernel single-step support (MIPS on GNU/Linux for example). We find
|
||||
the target of the coming instruction and breakpoint it.
|
||||
|
||||
single_step is also called just after the inferior stops. If we had
|
||||
set up a simulated single-step, we undo our damage. */
|
||||
the target of the coming instruction and breakpoint it. */
|
||||
|
||||
int
|
||||
mips_software_single_step (enum target_signal sig, int insert_breakpoints_p)
|
||||
mips_software_single_step (struct regcache *regcache)
|
||||
{
|
||||
CORE_ADDR pc, next_pc;
|
||||
|
||||
if (insert_breakpoints_p)
|
||||
{
|
||||
pc = read_register (mips_regnum (current_gdbarch)->pc);
|
||||
next_pc = mips_next_pc (pc);
|
||||
|
||||
insert_single_step_breakpoint (next_pc);
|
||||
}
|
||||
else
|
||||
remove_single_step_breakpoints ();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ enum
|
||||
};
|
||||
|
||||
/* Single step based on where the current instruction will take us. */
|
||||
extern int mips_software_single_step (enum target_signal, int);
|
||||
extern int mips_software_single_step (struct regcache *regcache);
|
||||
|
||||
/* Tell if the program counter value in MEMADDR is in a MIPS16
|
||||
function. */
|
||||
|
@ -723,8 +723,7 @@ rs6000_breakpoint_from_pc (CORE_ADDR *bp_addr, int *bp_size)
|
||||
/* AIX does not support PT_STEP. Simulate it. */
|
||||
|
||||
int
|
||||
rs6000_software_single_step (enum target_signal signal,
|
||||
int insert_breakpoints_p)
|
||||
rs6000_software_single_step (struct regcache *regcache)
|
||||
{
|
||||
CORE_ADDR dummy;
|
||||
int breakp_sz;
|
||||
@ -734,8 +733,6 @@ rs6000_software_single_step (enum target_signal signal,
|
||||
CORE_ADDR breaks[2];
|
||||
int opcode;
|
||||
|
||||
if (insert_breakpoints_p)
|
||||
{
|
||||
loc = read_pc ();
|
||||
|
||||
insn = read_memory_integer (loc, 4);
|
||||
@ -755,9 +752,6 @@ rs6000_software_single_step (enum target_signal signal,
|
||||
continue;
|
||||
insert_single_step_breakpoint (breaks[ii]);
|
||||
}
|
||||
}
|
||||
else
|
||||
remove_single_step_breakpoints ();
|
||||
|
||||
errno = 0; /* FIXME, don't ignore errors! */
|
||||
/* What errors? {read,write}_memory call error(). */
|
||||
|
@ -21,8 +21,7 @@
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
extern int rs6000_software_single_step (enum target_signal signal,
|
||||
int insert_breakpoints_p);
|
||||
extern int rs6000_software_single_step (struct regcache *regcache);
|
||||
|
||||
/* Hook in rs6000-tdep.c for determining the TOC address when
|
||||
calling functions in the inferior. */
|
||||
|
@ -1330,14 +1330,12 @@ sparc_step_trap (unsigned long insn)
|
||||
}
|
||||
|
||||
int
|
||||
sparc_software_single_step (enum target_signal sig, int insert_breakpoints_p)
|
||||
sparc_software_single_step (struct regcache *regcache)
|
||||
{
|
||||
struct gdbarch *arch = current_gdbarch;
|
||||
struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
|
||||
CORE_ADDR npc, nnpc;
|
||||
|
||||
if (insert_breakpoints_p)
|
||||
{
|
||||
CORE_ADDR pc, orig_npc;
|
||||
|
||||
pc = sparc_address_from_register (tdep->pc_regnum);
|
||||
@ -1356,9 +1354,6 @@ sparc_software_single_step (enum target_signal sig, int insert_breakpoints_p)
|
||||
from here straight to NULL, i.e. a call or jump to 0. */
|
||||
gdb_assert (npc != 0 || nnpc != 0 || orig_npc == 0);
|
||||
gdb_assert (nnpc != npc || orig_npc == 0);
|
||||
}
|
||||
else
|
||||
remove_single_step_breakpoints ();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -167,8 +167,7 @@ extern struct sparc_frame_cache *
|
||||
|
||||
|
||||
|
||||
extern int sparc_software_single_step (enum target_signal sig,
|
||||
int insert_breakpoints_p);
|
||||
extern int sparc_software_single_step (struct regcache *regcache);
|
||||
|
||||
extern void sparc_supply_rwindow (struct regcache *regcache,
|
||||
CORE_ADDR sp, int regnum);
|
||||
|
@ -1079,16 +1079,14 @@ spu_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr)
|
||||
/* Software single-stepping support. */
|
||||
|
||||
int
|
||||
spu_software_single_step (enum target_signal signal, int insert_breakpoints_p)
|
||||
spu_software_single_step (struct regcache *regcache)
|
||||
{
|
||||
if (insert_breakpoints_p)
|
||||
{
|
||||
CORE_ADDR pc, next_pc;
|
||||
unsigned int insn;
|
||||
int offset, reg;
|
||||
gdb_byte buf[4];
|
||||
|
||||
regcache_cooked_read (current_regcache, SPU_PC_REGNUM, buf);
|
||||
regcache_cooked_read (regcache, SPU_PC_REGNUM, buf);
|
||||
/* Mask off interrupt enable bit. */
|
||||
pc = extract_unsigned_integer (buf, 4) & -4;
|
||||
|
||||
@ -1114,7 +1112,7 @@ spu_software_single_step (enum target_signal signal, int insert_breakpoints_p)
|
||||
target += pc;
|
||||
else if (reg != -1)
|
||||
{
|
||||
regcache_cooked_read_part (current_regcache, reg, 0, 4, buf);
|
||||
regcache_cooked_read_part (regcache, reg, 0, 4, buf);
|
||||
target += extract_unsigned_integer (buf, 4) & -4;
|
||||
}
|
||||
|
||||
@ -1122,9 +1120,6 @@ spu_software_single_step (enum target_signal signal, int insert_breakpoints_p)
|
||||
if (target != next_pc)
|
||||
insert_single_step_breakpoint (target);
|
||||
}
|
||||
}
|
||||
else
|
||||
remove_single_step_breakpoints ();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user