| 8236 | } |
| 8237 | |
| 8238 | void debug (void) |
| 8239 | { |
| 8240 | int wasactive; |
| 8241 | |
| 8242 | if (savestate_state || quit_program) |
| 8243 | return; |
| 8244 | |
| 8245 | disasm_init(); |
| 8246 | addhistory (); |
| 8247 | |
| 8248 | #if 0 |
| 8249 | if (do_skip && skipaddr_start == 0xC0DEDBAD) { |
| 8250 | if (trace_same_insn_count > 0) { |
| 8251 | if (memcmp (trace_insn_copy, regs.pc_p, 10) == 0 |
| 8252 | && memcmp (trace_prev_regs.regs, regs.regs, sizeof regs.regs) == 0) |
| 8253 | { |
| 8254 | trace_same_insn_count++; |
| 8255 | return; |
| 8256 | } |
| 8257 | } |
| 8258 | if (trace_same_insn_count > 1) |
| 8259 | fprintf (logfile, "[ repeated %d times ]\n", trace_same_insn_count); |
| 8260 | m68k_dumpstate (logfile, &nextpc); |
| 8261 | trace_same_insn_count = 1; |
| 8262 | memcpy (trace_insn_copy, regs.pc_p, 10); |
| 8263 | memcpy (&trace_prev_regs, ®s, sizeof regs); |
| 8264 | } |
| 8265 | #endif |
| 8266 | |
| 8267 | if (!memwatch_triggered) { |
| 8268 | if (trace_mode) { |
| 8269 | uae_u32 pc; |
| 8270 | uae_u16 opcode; |
| 8271 | int bpnum = -1; |
| 8272 | int bp = 0; |
| 8273 | |
| 8274 | pc = munge24 (m68k_getpc ()); |
| 8275 | opcode = currprefs.cpu_model < 68020 && (currprefs.cpu_compatible || currprefs.cpu_cycle_exact) ? regs.ir : get_word_debug (pc); |
| 8276 | |
| 8277 | for (int i = 0; i < BREAKPOINT_TOTAL; i++) { |
| 8278 | struct breakpoint_node *bpn = &bpnodes[i]; |
| 8279 | if (check_breakpoint(bpn, pc)) { |
| 8280 | int j; |
| 8281 | // if this breakpoint is chained, ignore it |
| 8282 | for (j = 0; j < BREAKPOINT_TOTAL; j++) { |
| 8283 | struct breakpoint_node *bpn2 = &bpnodes[j]; |
| 8284 | if (bpn2->enabled && bpn2->chain == i) { |
| 8285 | break; |
| 8286 | } |
| 8287 | } |
| 8288 | if (j >= BREAKPOINT_TOTAL) { |
| 8289 | if (!check_breakpoint_count(bpn, pc)) { |
| 8290 | break; |
| 8291 | } |
| 8292 | int max = BREAKPOINT_TOTAL; |
| 8293 | bpnum = i; |
| 8294 | // check breakpoint chain |
| 8295 | while (bpnum >= 0 && bpnodes[bpnum].chain >= 0 && bpnodes[bpnum].chain != bpnum && max > 0) { |
no test coverage detected