(STEP_SKIPS_DELAY): Added.
* infrun.c (proceed) [STEP_SKIPS_DELAY]: Check for a breakpoint in
the delay slot.
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
#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
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);
#include "objfiles.h"
#include "gdbtypes.h"
-#if 0
#include "opcode/mips.h"
-#endif
#define VM_MIN_ADDRESS (unsigned)0x400000
return -1;
}
\f
-#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;
| 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