qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Pavel Dovgaluk" <Pavel.Dovgaluk@ispras.ru>
To: 'Frederic Konrad' <fred.konrad@greensocs.com>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, zealot351@gmail.com,
	maria.klimushenkova@ispras.ru, mark.burton@greensocs.com,
	batuzovk@ispras.ru
Subject: Re: [Qemu-devel] [PATCH] i386: fix breakpoints handling in icount mode
Date: Thu, 23 Oct 2014 11:52:00 +0400	[thread overview]
Message-ID: <000e01cfee96$3a1ce130$ae56a390$@Dovgaluk@ispras.ru> (raw)
In-Reply-To: <5448B0B3.9040702@greensocs.com>

> From: Frederic Konrad [mailto:fred.konrad@greensocs.com]
> On 23/10/2014 07:57, Pavel Dovgaluk wrote:
> >> From: Frederic Konrad [mailto:fred.konrad@greensocs.com]
> >> On 22/10/2014 13:38, Pavel Dovgalyuk wrote:
> >>
> >> Hi Pavel,
> >>> 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 <pavel.dovgaluk@ispras.ru>
> >>> ---
> >>>    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;
> >> This makes sense to me.
> >> But I don't see why you don't just "break" like the other instruction in
> >> this loop?
> > Single break will just exit the breakpoints iteration loop. I'll need an additional flag
> > to break the translation loop. ARM does the same thing, anyway :)
> 
> Yes that's what I mentioned.
> >
> >>>                    }
> >>>                }
> >>>            }
> >>> @@ -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();
> >> Is there any reason why you don't jump over this two lines in case of a
> >> breakpoint?
> > Shouldn't we switch off can_do_io flag if it was switched on?
> 
> Yes but can we switch on can_do_io if we have a breakpoint?
> 
> The code is not shown in this patch but there is:
> 
>          if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
>              gen_io_start();
> 
> I think you can't reach this code if you exit the translation loop?

This is not the only gen_io_start call. It is called from some of the instructions'
translation functions, that could precede the breakpoint.

Pavel Dovgalyuk

  reply	other threads:[~2014-10-23  7:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-22 11:38 [Qemu-devel] [PATCH] i386: fix breakpoints handling in icount mode Pavel Dovgalyuk
2014-10-22 12:53 ` Frederic Konrad
2014-10-23  5:57   ` Pavel Dovgaluk
2014-10-23  7:39     ` Frederic Konrad
2014-10-23  7:52       ` Pavel Dovgaluk [this message]
2014-10-23  8:47         ` Frederic Konrad
2014-10-23  9:58           ` Pavel Dovgaluk
2014-10-31 15:41 ` Paolo Bonzini
2015-01-12  8:03 ` Jan Kiszka
2015-01-12  8:26   ` Pavel Dovgaluk
2015-01-12  8:30     ` Jan Kiszka
2015-01-12  8:55       ` Paolo Bonzini
2015-05-24 14:43         ` Jan Kiszka
2015-05-26 14:56           ` Paolo Bonzini

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='000e01cfee96$3a1ce130$ae56a390$@Dovgaluk@ispras.ru' \
    --to=pavel.dovgaluk@ispras.ru \
    --cc=batuzovk@ispras.ru \
    --cc=fred.konrad@greensocs.com \
    --cc=maria.klimushenkova@ispras.ru \
    --cc=mark.burton@greensocs.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zealot351@gmail.com \
    /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).