fixed code breakpoint hit
This commit is contained in:
parent
0a88065722
commit
dd36d3c754
@ -525,6 +525,9 @@ unsigned BX_CPU_C::handleAsyncEvent(void)
|
|||||||
// A trap may be inhibited on this boundary due to an instruction
|
// A trap may be inhibited on this boundary due to an instruction
|
||||||
// which loaded SS. If so we clear the inhibit_mask below
|
// which loaded SS. If so we clear the inhibit_mask below
|
||||||
// and don't execute this code until the next boundary.
|
// 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
|
exception(BX_DB_EXCEPTION, 0); // no error, not interrupt
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -619,8 +622,9 @@ unsigned BX_CPU_C::handleAsyncEvent(void)
|
|||||||
else {
|
else {
|
||||||
// only bother comparing if any breakpoints enabled and
|
// only bother comparing if any breakpoints enabled and
|
||||||
// debug events are not inhibited on this boundary.
|
// 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) {
|
if (! (BX_CPU_THIS_PTR inhibit_mask & BX_INHIBIT_DEBUG_SHADOW)) {
|
||||||
code_breakpoint_match(get_laddr(BX_SEG_REG_CS, BX_CPU_THIS_PTR prev_rip));
|
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
|
#endif
|
||||||
|
@ -3446,7 +3446,7 @@ public: // for now...
|
|||||||
// x86 hardware debug support
|
// x86 hardware debug support
|
||||||
BX_SMF bx_bool hwbreakpoint_check(bx_address laddr);
|
BX_SMF bx_bool hwbreakpoint_check(bx_address laddr);
|
||||||
BX_SMF void iobreakpoint_match(unsigned port, unsigned len);
|
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 void hwbreakpoint_match(bx_address laddr, unsigned len, unsigned rw);
|
||||||
BX_SMF Bit32u hwdebug_compare(bx_address laddr, unsigned len,
|
BX_SMF Bit32u hwdebug_compare(bx_address laddr, unsigned len,
|
||||||
unsigned opa, unsigned opb);
|
unsigned opa, unsigned opb);
|
||||||
|
@ -1209,17 +1209,22 @@ bx_bool BX_CPU_C::hwbreakpoint_check(bx_address laddr)
|
|||||||
return 0;
|
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()) {
|
if (BX_CPU_THIS_PTR dr7.get_bp_enabled()) {
|
||||||
Bit32u dr6_bits = hwdebug_compare(laddr, 1, BX_HWDebugInstruction, BX_HWDebugInstruction);
|
Bit32u dr6_bits = hwdebug_compare(laddr, 1, BX_HWDebugInstruction, BX_HWDebugInstruction);
|
||||||
if (dr6_bits) {
|
if (dr6_bits) {
|
||||||
// Add to the list of debug events thus far.
|
// Add to the list of debug events thus far.
|
||||||
BX_CPU_THIS_PTR debug_trap |= dr6_bits;
|
BX_CPU_THIS_PTR debug_trap |= dr6_bits;
|
||||||
BX_ERROR(("#DB: x86 code breakpoint catched"));
|
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)
|
void BX_CPU_C::hwbreakpoint_match(bx_address laddr, unsigned len, unsigned rw)
|
||||||
|
Loading…
Reference in New Issue
Block a user