* [PATCH] target/i386: Use cpu_breakpoint_test in breakpoint_handler
@ 2021-06-20 6:23 Richard Henderson
2021-07-09 16:00 ` Richard Henderson
0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2021-06-20 6:23 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, ehabkost
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>
---
target/i386/tcg/sysemu/bpt_helper.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/target/i386/tcg/sysemu/bpt_helper.c b/target/i386/tcg/sysemu/bpt_helper.c
index 9bdf7e170b..f1fb479ad9 100644
--- a/target/i386/tcg/sysemu/bpt_helper.c
+++ b/target/i386/tcg/sysemu/bpt_helper.c
@@ -210,7 +210,6 @@ void breakpoint_handler(CPUState *cs)
{
X86CPU *cpu = X86_CPU(cs);
CPUX86State *env = &cpu->env;
- CPUBreakpoint *bp;
if (cs->watchpoint_hit) {
if (cs->watchpoint_hit->flags & BP_CPU) {
@@ -222,14 +221,9 @@ void breakpoint_handler(CPUState *cs)
}
}
} else {
- QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
- if (bp->pc == env->eip) {
- if (bp->flags & BP_CPU) {
- check_hw_breakpoints(env, true);
- raise_exception(env, EXCP01_DB);
- }
- break;
- }
+ if (cpu_breakpoint_test(cs, env->eip, BP_CPU)) {
+ check_hw_breakpoints(env, true);
+ raise_exception(env, EXCP01_DB);
}
}
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] target/i386: Use cpu_breakpoint_test in breakpoint_handler
2021-06-20 6:23 [PATCH] target/i386: Use cpu_breakpoint_test in breakpoint_handler Richard Henderson
@ 2021-07-09 16:00 ` Richard Henderson
2021-07-09 20:04 ` Eduardo Habkost
0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2021-07-09 16:00 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, ehabkost
Ping.
On 6/19/21 11:23 PM, Richard Henderson wrote:
> 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>
> ---
> target/i386/tcg/sysemu/bpt_helper.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/target/i386/tcg/sysemu/bpt_helper.c b/target/i386/tcg/sysemu/bpt_helper.c
> index 9bdf7e170b..f1fb479ad9 100644
> --- a/target/i386/tcg/sysemu/bpt_helper.c
> +++ b/target/i386/tcg/sysemu/bpt_helper.c
> @@ -210,7 +210,6 @@ void breakpoint_handler(CPUState *cs)
> {
> X86CPU *cpu = X86_CPU(cs);
> CPUX86State *env = &cpu->env;
> - CPUBreakpoint *bp;
>
> if (cs->watchpoint_hit) {
> if (cs->watchpoint_hit->flags & BP_CPU) {
> @@ -222,14 +221,9 @@ void breakpoint_handler(CPUState *cs)
> }
> }
> } else {
> - QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
> - if (bp->pc == env->eip) {
> - if (bp->flags & BP_CPU) {
> - check_hw_breakpoints(env, true);
> - raise_exception(env, EXCP01_DB);
> - }
> - break;
> - }
> + if (cpu_breakpoint_test(cs, env->eip, BP_CPU)) {
> + check_hw_breakpoints(env, true);
> + raise_exception(env, EXCP01_DB);
> }
> }
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] target/i386: Use cpu_breakpoint_test in breakpoint_handler
2021-07-09 16:00 ` Richard Henderson
@ 2021-07-09 20:04 ` Eduardo Habkost
0 siblings, 0 replies; 3+ messages in thread
From: Eduardo Habkost @ 2021-07-09 20:04 UTC (permalink / raw)
To: Richard Henderson; +Cc: pbonzini, qemu-devel
On Fri, Jul 09, 2021 at 09:00:30AM -0700, Richard Henderson wrote:
> Ping.
>
> On 6/19/21 11:23 PM, Richard Henderson wrote:
> > 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>
cpu_breakpoint_test() logic matches the existing code being
replaced, so:
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
I wouldn't have objected if you simply merged this without
waiting for review from others, though. I believe you know this
code better than anybody else.
--
Eduardo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-09 20:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-20 6:23 [PATCH] target/i386: Use cpu_breakpoint_test in breakpoint_handler Richard Henderson
2021-07-09 16:00 ` Richard Henderson
2021-07-09 20:04 ` Eduardo Habkost
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.