mirror of https://github.com/xemu-project/xemu.git
target/i386: Use cpu_breakpoint_test in breakpoint_handler
The loop is performing a simple boolean test for the existence of a BP_CPU breakpoint at EIP. Plus it gets the iteration wrong, if we happen to have a BP_GDB breakpoint at the same address. We have a function for this: cpu_breakpoint_test. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20210620062317.1399034-1-richard.henderson@linaro.org>
This commit is contained in:
parent
d1c74ab3a1
commit
50b208b848
|
@ -210,7 +210,6 @@ void breakpoint_handler(CPUState *cs)
|
||||||
{
|
{
|
||||||
X86CPU *cpu = X86_CPU(cs);
|
X86CPU *cpu = X86_CPU(cs);
|
||||||
CPUX86State *env = &cpu->env;
|
CPUX86State *env = &cpu->env;
|
||||||
CPUBreakpoint *bp;
|
|
||||||
|
|
||||||
if (cs->watchpoint_hit) {
|
if (cs->watchpoint_hit) {
|
||||||
if (cs->watchpoint_hit->flags & BP_CPU) {
|
if (cs->watchpoint_hit->flags & BP_CPU) {
|
||||||
|
@ -222,15 +221,10 @@ void breakpoint_handler(CPUState *cs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
|
if (cpu_breakpoint_test(cs, env->eip, BP_CPU)) {
|
||||||
if (bp->pc == env->eip) {
|
|
||||||
if (bp->flags & BP_CPU) {
|
|
||||||
check_hw_breakpoints(env, true);
|
check_hw_breakpoints(env, true);
|
||||||
raise_exception(env, EXCP01_DB);
|
raise_exception(env, EXCP01_DB);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue