* [Qemu-devel] Breakpoints just calling a function
@ 2009-04-29 20:22 Raphael Voisin
0 siblings, 0 replies; only message in thread
From: Raphael Voisin @ 2009-04-29 20:22 UTC (permalink / raw)
To: qemu-devel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-04-29 20:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-29 20:22 [Qemu-devel] Breakpoints just calling a function Raphael Voisin
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).