From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, ehabkost@redhat.com
Subject: Re: [PATCH] target/i386: Use cpu_breakpoint_test in breakpoint_handler
Date: Fri, 9 Jul 2021 09:00:30 -0700 [thread overview]
Message-ID: <c0e97e2b-44e0-b1dc-e629-cbb6bb319502@linaro.org> (raw)
In-Reply-To: <20210620062317.1399034-1-richard.henderson@linaro.org>
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);
> }
> }
> }
>
next prev parent reply other threads:[~2021-07-09 16:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-20 6:23 [PATCH] target/i386: Use cpu_breakpoint_test in breakpoint_handler Richard Henderson
2021-07-09 16:00 ` Richard Henderson [this message]
2021-07-09 20:04 ` Eduardo Habkost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c0e97e2b-44e0-b1dc-e629-cbb6bb319502@linaro.org \
--to=richard.henderson@linaro.org \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).