[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Breakpoints just calling a function
From: |
Raphael Voisin |
Subject: |
[Qemu-devel] Breakpoints just calling a function |
Date: |
Wed, 29 Apr 2009 22:22:30 +0200 |
User-agent: |
Mozilla-Thunderbird 2.0.0.19 (X11/20090103) |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] Breakpoints just calling a function,
Raphael Voisin <=