[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] i386: fix breakpoints handling in icount mode
From: |
Jan Kiszka |
Subject: |
Re: [Qemu-devel] [PATCH] i386: fix breakpoints handling in icount mode |
Date: |
Mon, 12 Jan 2015 09:03:22 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
On 2014-10-22 13:38, Pavel Dovgalyuk wrote:
> This patch fixes instructions counting when execution is stopped on
> breakpoint (e.g. set from gdb). Without a patch extra instruction is
> translated
> and icount is incremented by invalid value (which equals to number of
> executed instructions + 1).
>
> Signed-off-by: Pavel Dovgalyuk <address@hidden>
> ---
> target-i386/translate.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/target-i386/translate.c b/target-i386/translate.c
> index 1284173..193cf9f 100644
> --- a/target-i386/translate.c
> +++ b/target-i386/translate.c
> @@ -8000,7 +8000,7 @@ static inline void
> gen_intermediate_code_internal(X86CPU *cpu,
> if (bp->pc == pc_ptr &&
> !((bp->flags & BP_CPU) && (tb->flags & HF_RF_MASK))) {
> gen_debug(dc, pc_ptr - dc->cs_base);
> - break;
> + goto done_generating;
> }
> }
> }
> @@ -8049,6 +8049,7 @@ static inline void
> gen_intermediate_code_internal(X86CPU *cpu,
> break;
> }
> }
> +done_generating:
> if (tb->cflags & CF_LAST_IO)
> gen_io_end();
> gen_tb_end(tb, num_insns);
>
>
>
Didn't looked into why, just bisected that this patch breaks at least
certain guest-originated break- or watchpoints in TCG mode. Can be
triggered by booting a Linux kernel with kgdb self-tests enabled. The
result is some false reporting of a host-originated debug stop to
gdb_set_stop_cpu while gdbserver_state is NULL -> SEGV.
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
- Re: [Qemu-devel] [PATCH] i386: fix breakpoints handling in icount mode,
Jan Kiszka <=