From: Jim Kingdon Date: Tue, 1 Mar 1994 00:15:07 +0000 (+0000) Subject: * mips-tdep.c (mips_step_skips_delay), config/mips/tm-mips.h X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b5aff26825abb88d44d71392f759c0a89e979285;p=binutils-gdb.git * mips-tdep.c (mips_step_skips_delay), config/mips/tm-mips.h (STEP_SKIPS_DELAY): Added. * infrun.c (proceed) [STEP_SKIPS_DELAY]: Check for a breakpoint in the delay slot. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d0c30b31245..c6e5b11c64a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ Mon Feb 28 12:40:46 1994 Jim Kingdon (kingdon@deneb.cygnus.com) + * mips-tdep.c (mips_step_skips_delay), config/mips/tm-mips.h + (STEP_SKIPS_DELAY): Added. + * infrun.c (proceed) [STEP_SKIPS_DELAY]: Check for a breakpoint in + the delay slot. + * valprint.c (val_print_string): If errcode is set, always print an error, regardless of force_ellipsis. In the non-EIO case, just print the error message rather than calling error(). Don't diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index a0d0c890474..11326bf145b 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -46,6 +46,10 @@ extern int mips_fpu; #define SKIP_PROLOGUE(pc) pc = mips_skip_prologue (pc, 0) extern CORE_ADDR mips_skip_prologue PARAMS ((CORE_ADDR addr, int lenient)); +/* Return non-zero if PC points to an instruction which will cause a step + to execute both the instruction at PC and an instruction at PC+4. */ +#define STEP_SKIPS_DELAY(pc) (mips_step_skips_delay (pc)) + /* Immediately after a function call, return the saved pc. Can't always go through the frames for this because on some machines the new frame is not set up until the new function executes diff --git a/gdb/infrun.c b/gdb/infrun.c index ef9b82603a7..146621c75b5 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -280,6 +280,15 @@ proceed (addr, siggnal, step) if (breakpoint_here_p (read_pc ())) oneproc = 1; + +#ifdef STEP_SKIPS_DELAY + /* Check breakpoint_here_p first, because breakpoint_here_p is fast + (it just checks internal GDB data structures) and STEP_SKIPS_DELAY + is slow (it needs to read memory from the target). */ + if (breakpoint_here_p (read_pc () + 4) + && STEP_SKIPS_DELAY (read_pc ())) + oneproc = 1; +#endif /* STEP_SKIPS_DELAY */ } else write_pc (addr); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 9a5d6b92d45..faaeb6e1929 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -32,9 +32,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "objfiles.h" #include "gdbtypes.h" -#if 0 #include "opcode/mips.h" -#endif #define VM_MIN_ADDRESS (unsigned)0x400000 @@ -921,8 +919,9 @@ mips_frame_num_args(fip) return -1; } -#if 0 /* Is this a branch with a delay slot? */ +static int is_delayed PARAMS ((unsigned long)); + static int is_delayed (insn) unsigned long insn; @@ -937,7 +936,18 @@ is_delayed (insn) | INSN_COND_BRANCH_DELAY | INSN_COND_BRANCH_LIKELY))); } -#endif + +int +mips_step_skips_delay (pc) + CORE_ADDR pc; +{ + char buf[4]; + + if (target_read_memory (pc, buf, 4) != 0) + /* If error reading memory, guess that it is not a delayed branch. */ + return 0; + return is_delayed (extract_unsigned_integer (buf, 4)); +} /* To skip prologues, I use this predicate. Returns either PC itself if the code at PC does not look like a function prologue; otherwise