From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EtsY0-0003DQ-Qe for qemu-devel@nongnu.org; Tue, 03 Jan 2006 15:14:20 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EtsXs-00037c-Qg for qemu-devel@nongnu.org; Tue, 03 Jan 2006 15:14:20 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EtsXs-00037W-KP for qemu-devel@nongnu.org; Tue, 03 Jan 2006 15:14:12 -0500 Received: from [64.233.162.199] (helo=zproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EtsZ9-0008Rd-Na for qemu-devel@nongnu.org; Tue, 03 Jan 2006 15:15:31 -0500 Received: by zproxy.gmail.com with SMTP id r28so1933790nza for ; Tue, 03 Jan 2006 12:12:23 -0800 (PST) Message-ID: <16af12af0601031212g2ffb9fa0xc1c154aaf8eb46cf@mail.gmail.com> Date: Tue, 3 Jan 2006 12:12:22 -0800 From: Andre Pech Subject: Re: Re: [Qemu-devel] [PATCH] Fix to gdb - wrong translation block invalidated when setting gdb breakpoints In-Reply-To: <200601011510.20548.a_mulyadi@softhome.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_3954_1887167.1136319142935" References: <16af12af0512231157n4efb01eemd4afbca65dea9d4@mail.gmail.com> <200512281522.35505.a_mulyadi@softhome.net> <16af12af0512301218k48fecbdcr6ec41640b303689@mail.gmail.com> <200601011510.20548.a_mulyadi@softhome.net> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: a_mulyadi@softhome.net Cc: qemu-devel@nongnu.org ------=_Part_3954_1887167.1136319142935 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Mulyadi, The problem that you are running into here is that sys_uname has been replaced by sys_newuname in kernel/sys.c. When I put a breakpoint in this function, everything works correctly when I run uname in the virtual machine. I'm not sure I exactly understand your concern that breakpoints could be missed. When you set the breakpoint, tb_invalidate_phys_page_range is called, invalidating the translation block block for the address where you are placing the breakpoint. At this point, the next time that the address i= s hit, translate.c:gen_intermediate_code will have to be called, and the breakpoint will be hit. Let me know if I've missed something here. Thanks, Andre On 1/1/06, Mulyadi Santosa wrote: > > Hello Andre... > > > Not a problem. I only started using qemu a month ago, so it took me a > > while to get oriented in the code and understand what was going on. I > > must say that I've been really impressed with qemu so far. > > There was an interesting case I had found recently. In Linux kernel for > i386 arch, you will see that sys_uname is placed to return kernel > version/name. Funny thing is, even if I use your patch (against qemu > 0.7.1) and I put a breakpoint at sys_uname and issue "uname" at bash > prompt, the Qemu VM doesn't stop. Can you kindly check it? > > NB: Please see target-i386/translate.c, there you will see lines like > these (around line 6306): > if (env->nb_breakpoints > 0) { > for(j =3D 0; j < env->nb_breakpoints; j++) { > if (env->breakpoints[j] =3D=3D pc_ptr) { > gen_debug(dc, pc_ptr - dc->cs_base); > break; > } > } > } > What I understand from this code is, VM is stop if breakpoint address > matches with pc_ptr, which tb->pc and AFAIK that is the start address > of the translation block. So in other word, in some cases Qemu might > still miss the breakpoint (does it explain the sys_uname case?) Please > CMIIW > > regards > > Mulyadi > > ------=_Part_3954_1887167.1136319142935 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Mulyadi,

The problem that you are running into here is that sys_uname has been replaced by sys_newuname in kernel/sys.c. When I put a breakpoint in this function, everything works correctly when I run uname in the virtual machine.

I'm not sure I exactly understand your concern that breakpoints could be missed. When you set the breakpoint, tb_invalidate_phys_page_range is called, invalidating the translation block block for the address where you are placing the breakpoint. At this point, the next time that the address is hit, translate.c:gen_intermediate_code will have to be called, and the breakpoint will be hit. Let me know if I've missed something here.

Thanks,
Andre

On 1/1/06, Mulyadi Santosa <a_mulyadi@softhome.net> wrote:
Hello Andre...

> Not a problem. I only started using qemu a month= ago, so it took me a
> while to get oriented in the code and underst= and what was going on. I
> must say that I've been really impressed w= ith qemu so far.

There was an interesting case I had found recently. In Linux kernel= for
i386 arch, you will see that sys_uname is placed to return kernelversion/name. Funny thing is, even if I use your patch (against qemu
0.7.1) and I put a breakpoint at sys_uname and issue "uname" at b= ash
prompt, the Qemu VM doesn't stop. Can you kindly check it?

NB= : Please see target-i386/translate.c, there you will see lines like
these (around line 6306):
if (env->nb_breakpoints > 0) {
 =            for(j =3D= 0; j < env->nb_breakpoints; j++) {
     =            if (env->breakpoints[j] =3D=3D pc_ptr) {
     &= nbsp;           &nbs= p;  gen_debug(dc, pc_ptr - dc->cs_base);
       &nbs= p;            b= reak;
           =      }
      &nbs= p;     }
      &n= bsp; }
What I understand from this code is, VM is stop if breakpoin= t address
matches with pc_ptr, which tb->pc and AFAIK that is the sta= rt address
of the translation block. So in other word, in some cases Qemu mightstill miss the breakpoint (does it explain the sys_uname case?) Please
= CMIIW

regards

Mulyadi


------=_Part_3954_1887167.1136319142935--