fixed code breakpoint hit

This commit is contained in:
Stanislav Shwartsman 2011-03-24 19:06:58 +00:00
parent 0a88065722
commit dd36d3c754
3 changed files with 14 additions and 5 deletions

View File

@ -525,6 +525,9 @@ unsigned BX_CPU_C::handleAsyncEvent(void)
// A trap may be inhibited on this boundary due to an instruction
// which loaded SS. If so we clear the inhibit_mask below
// and don't execute this code until the next boundary.
#if BX_X86_DEBUGGER
code_breakpoint_match(get_laddr(BX_SEG_REG_CS, BX_CPU_THIS_PTR prev_rip));
#endif
exception(BX_DB_EXCEPTION, 0); // no error, not interrupt
}
@ -619,8 +622,9 @@ unsigned BX_CPU_C::handleAsyncEvent(void)
else {
// only bother comparing if any breakpoints enabled and
// debug events are not inhibited on this boundary.
if (! (BX_CPU_THIS_PTR inhibit_mask & BX_INHIBIT_DEBUG_SHADOW) && ! BX_CPU_THIS_PTR in_repeat) {
code_breakpoint_match(get_laddr(BX_SEG_REG_CS, BX_CPU_THIS_PTR prev_rip));
if (! (BX_CPU_THIS_PTR inhibit_mask & BX_INHIBIT_DEBUG_SHADOW)) {
if (code_breakpoint_match(get_laddr(BX_SEG_REG_CS, BX_CPU_THIS_PTR prev_rip)))
exception(BX_DB_EXCEPTION, 0); // no error, not interrupt
}
}
#endif

View File

@ -3446,7 +3446,7 @@ public: // for now...
// x86 hardware debug support
BX_SMF bx_bool hwbreakpoint_check(bx_address laddr);
BX_SMF void iobreakpoint_match(unsigned port, unsigned len);
BX_SMF void code_breakpoint_match(bx_address laddr);
BX_SMF Bit32u code_breakpoint_match(bx_address laddr);
BX_SMF void hwbreakpoint_match(bx_address laddr, unsigned len, unsigned rw);
BX_SMF Bit32u hwdebug_compare(bx_address laddr, unsigned len,
unsigned opa, unsigned opb);

View File

@ -1209,17 +1209,22 @@ bx_bool BX_CPU_C::hwbreakpoint_check(bx_address laddr)
return 0;
}
void BX_CPU_C::code_breakpoint_match(bx_address laddr)
Bit32u BX_CPU_C::code_breakpoint_match(bx_address laddr)
{
if (BX_CPU_THIS_PTR get_RF() || BX_CPU_THIS_PTR in_repeat)
return 0;
if (BX_CPU_THIS_PTR dr7.get_bp_enabled()) {
Bit32u dr6_bits = hwdebug_compare(laddr, 1, BX_HWDebugInstruction, BX_HWDebugInstruction);
if (dr6_bits) {
// Add to the list of debug events thus far.
BX_CPU_THIS_PTR debug_trap |= dr6_bits;
BX_ERROR(("#DB: x86 code breakpoint catched"));
exception(BX_DB_EXCEPTION, 0); // no error, not interrupt
return dr6_bits;
}
}
return 0;
}
void BX_CPU_C::hwbreakpoint_match(bx_address laddr, unsigned len, unsigned rw)