# HG changeset patch # User Michael Pavone # Date 1706151104 28800 # Node ID 767ec72acca74a132934b35dab88db47a4df5043 # Parent b733a10488c65faf7dcdda2e22e35de3ad325295 Avoid conflicts between watchpoints and normal debugger entry diff -r b733a10488c6 -r 767ec72acca7 genesis.c --- a/genesis.c Sat Jan 20 21:16:04 2024 -0800 +++ b/genesis.c Wed Jan 24 18:51:44 2024 -0800 @@ -370,7 +370,7 @@ } context->target_cycle = context->int_cycle < context->sync_cycle ? context->int_cycle : context->sync_cycle; - if (context->should_return || gen->header.enter_debugger) { + if (context->should_return || gen->header.enter_debugger || context->wp_hit) { context->target_cycle = context->current_cycle; } else if (context->target_cycle < context->current_cycle) { //Changes to SR can result in an interrupt cycle that's in the past @@ -611,8 +611,10 @@ context->target_cycle = gen->reset_cycle; } if (address) { - if (gen->header.enter_debugger) { - gen->header.enter_debugger = 0; + if (gen->header.enter_debugger || context->wp_hit) { + if (!context->wp_hit) { + gen->header.enter_debugger = 0; + } #ifndef IS_LIB if (gen->header.debugger_type == DEBUGGER_NATIVE) { debugger(context, address); diff -r b733a10488c6 -r 767ec72acca7 m68k_core.c --- a/m68k_core.c Sat Jan 20 21:16:04 2024 -0800 +++ b/m68k_core.c Wed Jan 24 18:51:44 2024 -0800 @@ -867,7 +867,6 @@ context->wp_hit = 1; context->target_cycle = context->sync_cycle = context->current_cycle; system_header *system = context->system; - system->enter_debugger = 1; return vcontext; } @@ -892,7 +891,6 @@ context->wp_hit = 1; context->target_cycle = context->sync_cycle = context->current_cycle; system_header *system = context->system; - system->enter_debugger = 1; return vcontext; } diff -r b733a10488c6 -r 767ec72acca7 sms.c --- a/sms.c Sat Jan 20 21:16:04 2024 -0800 +++ b/sms.c Wed Jan 24 18:51:44 2024 -0800 @@ -478,8 +478,10 @@ } } } - if (system->enter_debugger && sms->z80->pc) { - system->enter_debugger = 0; + if ((system->enter_debugger || sms->z80->wp_hit) && sms->z80->pc) { + if (!sms->z80->wp_hit) { + system->enter_debugger = 0; + } #ifndef IS_LIB zdebugger(sms->z80, sms->z80->pc); #endif @@ -495,7 +497,7 @@ } } - if (system->enter_debugger) { + if (system->enter_debugger || sms->z80->wp_hit) { target_cycle = sms->z80->Z80_CYCLE + 1; } z80_run(sms->z80, target_cycle); diff -r b733a10488c6 -r 767ec72acca7 z80_to_x86.c --- a/z80_to_x86.c Sat Jan 20 21:16:04 2024 -0800 +++ b/z80_to_x86.c Wed Jan 24 18:51:44 2024 -0800 @@ -3923,7 +3923,6 @@ context->wp_hit = 1; context->target_cycle = context->sync_cycle = context->current_cycle; system_header *system = context->system; - system->enter_debugger = 1; return vcontext; }