Skip to content

Commit

Permalink
fixed segfault when debugger is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Shwartsman committed Nov 24, 2024
1 parent 30ed864 commit d6aeec0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bochs/cpu/cpu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ void BX_CPU_C::cpu_loop_debugger(void)
BX_CPU_THIS_PTR prev_rip = RIP; // commit new EIP
BX_CPU_THIS_PTR speculative_rsp = false;

// stop tracing after every instruction to handle in internal debugger
BX_CPU_THIS_PTR async_event |= BX_ASYNC_EVENT_STOP_TRACE;

while (1) {

// check on events which occurred for previous instructions (traps)
Expand All @@ -90,6 +87,9 @@ void BX_CPU_C::cpu_loop_debugger(void)
}
}

// stop tracing after every instruction to handle in internal debugger
BX_CPU_THIS_PTR async_event |= BX_ASYNC_EVENT_STOP_TRACE;

bxICacheEntry_c *entry = getICacheEntry();
bxInstruction_c *i = entry->i;
bxInstruction_c *last = i + (entry->tlen);
Expand All @@ -112,7 +112,7 @@ void BX_CPU_C::cpu_loop_debugger(void)
// note instructions generating exceptions never reach this point
if (dbg_instruction_epilog()) return;

if (BX_CPU_THIS_PTR async_event) break;
if (BX_CPU_THIS_PTR async_event & ~BX_ASYNC_EVENT_STOP_TRACE) break;

if (++i == last) {
entry = getICacheEntry();
Expand Down

0 comments on commit d6aeec0

Please sign in to comment.