From: Raphael Voisin <raphael.voisin@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Breakpoints just calling a function
Date: Wed, 29 Apr 2009 22:22:30 +0200 [thread overview]
Message-ID: <49F8B706.9090904@gmail.com> (raw)
I need to create a new type of breakpoint (like the existing "struct
CPUBreakpoint") that doesn't stop the VM each time it's reached, but
just call a function.
For the first test, I tried to modify the function
"translate.c:gen_intermediate_code_internal(...)" function where cpu
breakpoint Program Counters (pc) are compared to equivalent arch
register (EIP under i386).
The current code is:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
if (unlikely(!TAILQ_EMPTY(&env->breakpoints))) {
TAILQ_FOREACH(bp, &env->breakpoints, entry) {
if (bp->pc == pc_ptr) {
gen_debug(dc, pc_ptr - dc->cs_base);
break;
}
}
}
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
If I understand, the "gen_debug(...)" function generate a kind of
exception that stop the VM. That is what is use for gdb stubs.
I tried to modify the code to simply print a message (equivalent to call
a function later) instead of call "gen_debug(...)" like this:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
if (unlikely(!TAILQ_EMPTY(&env->breakpoints))) {
TAILQ_FOREACH(bp, &env->breakpoints, entry) {
if (bp->pc == pc_ptr) {
printf("Simulate function calling\n");
//gen_debug(dc, pc_ptr - dc->cs_base);
//break; // tried commenting or uncommenting
}
}
}
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The fact is the message is correctly printed the first time the
breakpoint is reached, but it's not printed anymore after that, although
my guest system really hit the program counter several times.
I don't really know how Translation Blocks are managed and how TCG works
for that part. It's maybe a question of TB invalidation or something like.
I think that current breakpoint mechanism has been much harder to
implement than the new types of breakpoint i wish (i called them
"Controlpoints" on IRC), so I think i'm maybe missing something simple.
Thanks in advance for any help, explication, suggestion or advice.
Raphaël
reply other threads:[~2009-04-29 20:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=49F8B706.9090904@gmail.com \
--to=raphael.voisin@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).