#include "inferior.h"
#include "symtab.h"
#include "target.h"
+#include "gdbcore.h"
#include "xcoffsolib.h"
/* Breakpoint shadows for the single step instructions will be kept here. */
static struct sstep_breaks {
- int address;
- int data;
+ /* Address, or 0 if this is not in use. */
+ CORE_ADDR address;
+ /* Shadow contents. */
+ char data[4];
} stepBreaks[2];
/* Static function prototypes */
#define INSNLEN(OPCODE) 4
static char breakp[] = BREAKPOINT;
- int ii, insn, ret, loc;
- int breaks[2], opcode;
+ int ii, insn;
+ CORE_ADDR loc;
+ CORE_ADDR breaks[2];
+ int opcode;
if (!one_stepped) {
loc = read_pc ();
- ret = read_memory (loc, &insn, sizeof (int));
- if (ret)
- printf ("Error in single_step()!!\n");
+ read_memory (loc, &insn, 4);
breaks[0] = loc + INSNLEN(insn);
opcode = insn >> 26;
if (breaks[1] == breaks[0])
breaks[1] = -1;
- stepBreaks[1].address = -1;
+ stepBreaks[1].address = 0;
for (ii=0; ii < 2; ++ii) {
if ( breaks[ii] == -1)
continue;
- read_memory (breaks[ii], &(stepBreaks[ii].data), sizeof(int));
+ read_memory (breaks[ii], stepBreaks[ii].data, 4);
- ret = write_memory (breaks[ii], breakp, sizeof(int));
+ write_memory (breaks[ii], breakp, 4);
stepBreaks[ii].address = breaks[ii];
}
/* remove step breakpoints. */
for (ii=0; ii < 2; ++ii)
- if (stepBreaks[ii].address != -1)
+ if (stepBreaks[ii].address != 0)
write_memory
- (stepBreaks[ii].address, &(stepBreaks[ii].data), sizeof(int));
+ (stepBreaks[ii].address, stepBreaks[ii].data, 4);
one_stepped = 0;
}
errno = 0; /* FIXME, don't ignore errors! */
+ /* What errors? {read,write}_memory call error(). */
}