diff -r -u bochs-2.2.6/bx_debug/dbg_main.cc bochs-2.2.6-r1/bx_debug/dbg_main.cc --- bochs-2.2.6/bx_debug/dbg_main.cc 2006-01-28 16:16:02.000000000 +0000 +++ bochs-2.2.6-r1/bx_debug/dbg_main.cc 2006-10-28 00:31:57.000000000 +0000 @@ -1132,36 +1132,41 @@ void bx_dbg_stepN_command(bx_dbg_icount_t count) { - if (count == 0) { - dbg_printf("Error: stepN: count=0\n"); - return; - } - - // use simulation mode while executing instructions. When the prompt - // is printed, we will return to config mode. - SIM->set_display_mode (DISP_MODE_SIM); - - // single CPU - bx_guard.guard_for |= BX_DBG_GUARD_ICOUNT; // looking for icount - bx_guard.guard_for |= BX_DBG_GUARD_CTRL_C; // or Ctrl-C - // for now, step each CPU one BX_DBG_DEFAULT_ICOUNT_QUANTUM at a time - for (unsigned cycle=0; cycle < count; cycle++) { - for (unsigned cpu=0; cpu < BX_SMP_PROCESSORS; cpu++) { - bx_guard.icount = 1; - bx_guard.interrupt_requested = 0; - BX_CPU(cpu)->guard_found.guard_found = 0; - BX_CPU(cpu)->guard_found.icount = 0; - BX_CPU(cpu)->cpu_loop(-1); + if (count == 0) { + dbg_printf("Error: stepN: count=0\n"); + return; } -#if BX_SUPPORT_SMP == 0 - // ticks are handled inside the cpu loop -#else - BX_TICK1 (); -#endif - } - - BX_INSTR_DEBUG_PROMPT(); - bx_dbg_print_guard_results(); + + // use simulation mode while executing instructions. When the prompt + // is printed, we will return to config mode. + SIM->set_display_mode(DISP_MODE_SIM); + + // single CPU + int old_guard = bx_guard.guard_for; + bx_guard.guard_for |= BX_DBG_GUARD_ICOUNT; // looking for icount + bx_guard.guard_for |= BX_DBG_GUARD_CTRL_C; // or Ctrl-C + bx_guard.guard_for &= ~BX_DBG_GUARD_IADDR_ALL; + // for now, step each CPU one instruction at a time + for (unsigned cycle=0; cycle < count; cycle++) { + for (unsigned cpu=0; cpu < BX_SMP_PROCESSORS; cpu++) { + bx_guard.icount = 1; + bx_guard.interrupt_requested = 0; + int old_mode_break = BX_CPU(cpu)->mode_break; + BX_CPU(cpu)->guard_found.guard_found = 0; + BX_CPU(cpu)->guard_found.icount = 0; + BX_CPU(cpu)->cpu_loop(1); + BX_CPU(cpu)->mode_break = old_mode_break; + } + #if BX_SUPPORT_SMP == 0 + // ticks are handled inside the cpu loop + #else + BX_TICK1(); + #endif + } + + BX_INSTR_DEBUG_PROMPT(); + bx_dbg_print_guard_results(); + bx_guard.guard_for = old_guard; } static disassembler bx_disassemble;