#define TRACE_CHECKONLY 10
static int trace_mode;
-static uae_u32 trace_param1;
-static uae_u32 trace_param2;
+static uae_u32 trace_param[3];
int debugger_active;
static int debug_rewind;
{
activate_debugger();
trace_mode = TRACE_RANGE_PC;
- trace_param1 = pc;
- trace_param2 = pc + len;
+ trace_param[0] = pc;
+ trace_param[1] = pc + len;
}
bool debug_enforcer(void)
_T(" fa <address> [<start>] [<end>]\n")
_T(" Find effective address <address>.\n")
_T(" fi Step forward until PC points to RTS, RTD or RTE.\n")
- _T(" fi <opcode> Step forward until PC points to <opcode>.\n")
+ _T(" fi <opcode> [<w2>] [<w3>] Step forward until PC points to <opcode>.\n")
_T(" fp \"<name>\"/<addr> Step forward until process <name> or <addr> is active.\n")
_T(" fl List breakpoints.\n")
_T(" fd Remove all breakpoints.\n")
return 0;
} else if (nc == 'I') {
next_char (c);
- if (more_params (c))
- trace_param1 = readhex (c);
- else
- trace_param1 = 0x10000;
+ trace_param[1] = 0x10000;
+ trace_param[2] = 0x10000;
+ if (more_params(c)) {
+ trace_param[0] = readhex(c);
+ if (more_params(c)) {
+ trace_param[1] = readhex(c);
+ }
+ if (more_params(c)) {
+ trace_param[2] = readhex(c);
+ }
+ } else {
+ trace_param[0] = 0x10000;
+ }
trace_mode = TRACE_MATCH_INS;
return 1;
} else if (nc == 'D' && (*c)[1] == 0) {
return 0;
}
trace_mode = TRACE_RANGE_PC;
- trace_param1 = readhex (c);
+ trace_param[0] = readhex (c);
if (more_params (c)) {
- trace_param2 = readhex (c);
+ trace_param[1] = readhex (c);
return 1;
} else {
for (i = 0; i < BREAKPOINT_TOTAL; i++) {
bpn = &bpnodes[i];
- if (bpn->enabled && bpn->value1 == trace_param1) {
+ if (bpn->enabled && bpn->value1 == trace_param[0]) {
bpn->enabled = 0;
console_out (_T("Breakpoint removed.\n"));
trace_mode = 0;
bpn = &bpnodes[i];
if (bpn->enabled)
continue;
- bpn->value1 = trace_param1;
+ bpn->value1 = trace_param[0];
bpn->type = BREAKPOINT_REG_PC;
bpn->oper = BREAKPOINT_CMP_EQUAL;
bpn->enabled = 1;
case 't':
no_trace_exceptions = 0;
debug_cycles();
- trace_param1 = trace_param2 = 0;
+ trace_param[0] = trace_param[1] = 0;
if (*inptr == 't') {
no_trace_exceptions = 1;
inptr++;
}
if (*inptr == 'r') {
// break when PC in debugmem
- if (debugmem_get_range(&trace_param1, &trace_param2)) {
+ if (debugmem_get_range(&trace_param[0], &trace_param[1])) {
trace_mode = TRACE_RANGE_PC;
return true;
}
// skip next source line
if (debugmem_isactive()) {
trace_mode = TRACE_SKIP_LINE;
- trace_param1 = 1;
- trace_param2 = debugmem_get_sourceline(M68K_GETPC, NULL, 0);
+ trace_param[0] = 1;
+ trace_param[1] = debugmem_get_sourceline(M68K_GETPC, NULL, 0);
return true;
}
} else {
if (more_params(&inptr))
- trace_param1 = readint(&inptr);
- if (trace_param1 <= 0 || trace_param1 > 10000)
- trace_param1 = 1;
+ trace_param[0] = readint(&inptr);
+ if (trace_param[0] <= 0 || trace_param[0] > 10000)
+ trace_param[0] = 1;
trace_mode = TRACE_SKIP_INS;
exception_debugging = 1;
return true;
break;
case 'z':
trace_mode = TRACE_MATCH_PC;
- trace_param1 = nextpc;
+ trace_param[0] = nextpc;
exception_debugging = 1;
debug_cycles();
return true;
}
if (trace_mode) {
- if (trace_mode == TRACE_MATCH_PC && trace_param1 == pc)
+ if (trace_mode == TRACE_MATCH_PC && trace_param[0] == pc)
bp = -1;
if (trace_mode == TRACE_RAM_PC) {
addrbank *ab = &get_mem_bank(pc);
}
}
} else if (trace_mode == TRACE_MATCH_INS) {
- if (trace_param1 == 0x10000) {
+ if (trace_param[0] == 0x10000) {
if (opcode == 0x4e75 || opcode == 0x4e73 || opcode == 0x4e77)
bp = -1;
- } else if (opcode == trace_param1) {
+ } else if (opcode == trace_param[0]) {
bp = -1;
+ for (int op = 1; op < 3; op++) {
+ if (trace_param[op] != 0x10000) {
+ uae_u16 w = 0xffff;
+ debug_get_prefetch(op, &w);
+ if (w != trace_param[op])
+ bp = 0;
+ }
+ }
}
} else if (trace_mode == TRACE_SKIP_INS) {
- if (trace_param1 != 0)
- trace_param1--;
- if (trace_param1 == 0) {
+ if (trace_param[0] != 0)
+ trace_param[0]--;
+ if (trace_param[0] == 0) {
bp = -1;
}
#if 0
bp = -1;
#endif
} else if (trace_mode == TRACE_RANGE_PC) {
- if (pc >= trace_param1 && pc < trace_param2)
+ if (pc >= trace_param[0] && pc < trace_param[1])
bp = -1;
} else if (trace_mode == TRACE_SKIP_LINE) {
- if (trace_param1 != 0)
- trace_param1--;
- if (trace_param1 == 0) {
+ if (trace_param[0] != 0)
+ trace_param[0]--;
+ if (trace_param[0] == 0) {
int line = debugmem_get_sourceline(pc, NULL, 0);
- if (line > 0 && line != trace_param2)
+ if (line > 0 && line != trace_param[1])
bp = -1;
}
}
return false;
}
+bool debug_get_prefetch(int idx, uae_u16 *opword)
+{
+ if (currprefs.cpu_compatible) {
+ if (currprefs.cpu_model < 68020) {
+ if (idx == 0) {
+ *opword = regs.ir;
+ return true;
+ }
+ if (idx == 1) {
+ *opword = regs.irc;
+ return true;
+ }
+ *opword = get_word_debug(m68k_getpc() + idx * 2);
+ return false;
+ } else {
+ if (regs.prefetch020_valid[idx]) {
+ *opword = regs.prefetch020[idx];
+ return true;
+ }
+ *opword = get_word_debug(m68k_getpc() + idx * 2);
+ return false;
+ }
+
+ } else {
+ *opword = get_word_debug(m68k_getpc() + idx * 2);
+ return false;
+ }
+}
+
#define DEBUGSPRINTF_SIZE 32
static int debugsprintf_cnt;
struct dsprintfstack
console_out_f (_T("TT0: %08X TT1: %08X TC: %08X\n"), tt0_030, tt1_030, tc_030);
}
if (currprefs.cpu_compatible) {
- if (currprefs.cpu_model == 68000) {
+ console_out_f(_T("Prefetch"));
+ if (currprefs.cpu_model == 68020 || currprefs.cpu_model == 68030) {
+ console_out_f(_T(" %08x %08x (%d)"),
+ regs.cacheholdingaddr020, regs.cacheholdingdata020, regs.cacheholdingdata_valid);
+ }
+ for (int i = 0; i < 3; i++) {
+ uae_u16 w;
+ if (!debug_get_prefetch(i, &w))
+ break;
struct instr *dp;
- struct mnemolookup *lookup1, *lookup2;
- dp = table68k + regs.irc;
- for (lookup1 = lookuptab; lookup1->mnemo != dp->mnemo; lookup1++)
- ;
- dp = table68k + regs.ir;
- for (lookup2 = lookuptab; lookup2->mnemo != dp->mnemo; lookup2++)
+ struct mnemolookup *lookup;
+ dp = table68k + w;
+ for (lookup = lookuptab; lookup->mnemo != dp->mnemo; lookup++)
;
- console_out_f (_T("Prefetch %04x (%s) %04x (%s) Chip latch %08X\n"), regs.irc, lookup1->name, regs.ir, lookup2->name, regs.chipset_latch_rw);
- } else if (currprefs.cpu_model == 68020 || currprefs.cpu_model == 68030) {
- console_out_f (_T("Prefetch %08x %08x (%d) %04x (%d) %04x (%d) %04x (%d)\n"),
- regs.cacheholdingaddr020, regs.cacheholdingdata020, regs.cacheholdingdata_valid,
- regs.prefetch020[0], regs.prefetch020_valid[0],
- regs.prefetch020[1], regs.prefetch020_valid[1],
- regs.prefetch020[2], regs.prefetch020_valid[2]);
+ console_out_f(_T(" %04x (%s)"), w, lookup->name);
}
+ console_out_f (_T(" Chip latch %08X\n"), regs.chipset_latch_rw);
}
if (prevpc != 0xffffffff && pc - prevpc < 100) {
while (prevpc < pc) {