[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Physical address debugging
From: |
Lluís |
Subject: |
Re: [Qemu-devel] Physical address debugging |
Date: |
Mon, 29 Aug 2011 14:45:47 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
Zeus Gómez Marmolejo writes:
> So, for you that you know very well the QEMU code, and suppose that I
> want to do a quick modification to stop on an address write and print
> the backtrace. How I could do it?? I want a one line modification to
> the code (with the address hardcoded) to stop the monitor. That should
> be easy, right?
I'm not sure if this will work, but here's a possibility.
You can edit the 'tlb_set_page' routine in exec.c. Just before the
"QTAILQ_FOREACH(wp, &env->watchpoints, entry) {" line, check if the
'paddr' argument matches your hard-coded conditions and, if true, inject
a new watchpoint with the virtual address of the translation. This
should insert a memory write watchpoint on all virtual addresses mapping
to your physical address of interest.
if (my__is_interesting(paddr)) {
cpu_watchpoint_insert(env, vaddr, my__access_size,
BP_MEM_WRITE, NULL);
}
BTW, if you plan to "activate" the watchpoint after some time running
(i.e., not from the beggining, because you may not know yet the physical
address), remember to call 'tlb_flush(env, 1)' on all CPUState
structures in order to flush any previous "non-watchpointed"
translations.
This is obviously not tested, but at least should take you near to what
you want.
Lluis
--
"And it's much the same thing with knowledge, for whenever you learn
something new, the whole world becomes that much richer."
-- The Princess of Pure Reason, as told by Norton Juster in The Phantom
Tollbooth