From: Andre Pech <andre.pech@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Fix to gdb - wrong translation block invalidated when setting gdb breakpoints
Date: Fri, 23 Dec 2005 11:57:42 -0800 [thread overview]
Message-ID: <16af12af0512231157n4efb01eemd4afbca65dea9d4@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2146 bytes --]
Hi all,
I had been running into problems using gdb to debug the virtual machine
kernel. The problem I was experiencing is that I would set a breakpoint, but
that gdb would only sometimes get notified that the breakpoint was hit.
I finally tracked down the problem to exec.c:breakpoint_invalidate. The
problem is that breakpoint_invalidate, which is supposed to invalidate the
translation block for the address you want to break at, was actualling
invalidating the translation block for the base address of the page that
contained your breakpoint address. The fix is actually very simple and is
attached below.
Thanks
Andre Pech
diff -dc exec.c{.old,}
*** exec.c.old 2005-12-23 11:40:47.000000000 -0800
--- exec.c 2005-12-23 11:41:13.000000000 -0800
***************
*** 996,1001 ****
--- 996,1002 ----
target_ulong phys_addr;
phys_addr = cpu_get_phys_page_debug(env, pc);
+ phys_addr += pc & (~TARGET_PAGE_MASK);
tb_invalidate_phys_page_range(phys_addr, phys_addr + 1, 0);
}
#endif
On 12/21/05, Mulyadi Santosa <a_mulyadi@softhome.net> wrote:
>
> Hello Andre...
>
> > I'm running into problems using qemu to debug a kernel module. My
> > host and virtual machine are both x86 running Fedora Core 4. After
> > insmoding the module in the virtual machine, starting gdbserver,
> > running gdb on the host with the module sections loaded at the right
> > place, and setting a breakpoint in the module code, gdb does not
> > always get notified when the code is exectuted. After adding
>
> I'm not doing module debugging, only core kernel code debugging, but
> more or less I run into same situation (last time confirmed with Qemu
> 0.7.1)
>
> For additional info, sometimes I also suffered the other condition.
> Breakpoint is hit, but even if I delete it, the emulation still stops
> whenever the code at related physical address is hit. I tried to
> printf() every gdb command received by Qemu's gdbstub and it confirmed
> that breakpoint deletion command is actually received, but I can't
> confirm what is the real bug there.
>
> regards
>
> Mulyadi
>
>
[-- Attachment #2: Type: text/html, Size: 2755 bytes --]
next reply other threads:[~2005-12-23 19:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-23 19:57 Andre Pech [this message]
2005-12-28 8:22 ` [Qemu-devel] [PATCH] Fix to gdb - wrong translation block invalidated when setting gdb breakpoints Mulyadi Santosa
[not found] ` <16af12af0512301218k48fecbdcr6ec41640b303689@mail.gmail.com>
2006-01-01 8:10 ` Mulyadi Santosa
2006-01-03 20:12 ` Andre Pech
2006-01-04 10:29 ` Mulyadi Santosa
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=16af12af0512231157n4efb01eemd4afbca65dea9d4@mail.gmail.com \
--to=andre.pech@gmail.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).