|
From: David M. <dm...@gm...> - 2005-11-18 07:05:18
|
Hi everyone,
I and a colleagure are attempting to write a simple Valgrind tool that
prints out the PC of every instruction executed, the address of every store
to memory, and the address of every load to memory. I am running into an
issue where the addresses I see from my tool don't seem to match up with th=
e
addresses I see in gdb or when using logrind 2.
For example, I followed the example of the cachegrind source code and
iterate over all IRStmt * in the incoming basic block. I then have the code
switch(st->tag) {
case Ist_IMark: {
Addr instrAddr =3D (Addr) ULong_to_Ptr(st->Ist.IMark.addr);
and I add a new statement to the BB that passes a list with
mkIRExpr_HWord(instrAddr) to a callback which then prints the instrAddr wit=
h
a VG_(message). believe this should print out the PC for the instruction.
The problem I see is that in gdb on a Linux 2.4 machine is that each PC has
a PC starting with 0x800... (as expected). My tool reports each PC starts
with 0x3A966F... . The logrind 2 tool of C. January agrees with gdb.
Is there some kind of function I need to call to map instrumented addresses
to host addresses? I am seeing similar disreprancies for the memory
addresses of loads and stores.
Thanks very much,
-David Molnar
|