|
From: Julio M. M. V. <jm...@ac...> - 2007-10-20 22:22:36
|
On Oct 19, 2007, at 11:24 AM, Julio M. Merino Vidal wrote: > Hello, > > I'm currently writing an instrumentation tool for a class assignment > using Valgrind. I'm interested in tracking all memory loads and > stores to later depict them in some form of graph. So far I've added > the necessary "hooks" to Store statements and Load expressions to the > guest code. For example, this is for the Store: > > UInt size = sizeofIRType(typeOfIRExpr(sb->tyenv, st- >> Ist.Store.data)); > argv = mkIRExprVec_2(mkIRExpr_HWord((HWord)st- > >Ist.Store.addr), > mkIRExpr_HWord(size)); > di = unsafeIRDirty_0_N(1, "trace_mem", > VG_(fnptr_to_fnentry)(&trace_mem), > argv); > addStmtToIRSB(sb, IRStmt_Dirty(di)); > > But I can't find the correct way to interpret the address expressions > I pass to the trace_mem function. How am I supposed to process the > value of Ist.Store.addr (or the address of the Load in its case) to > get the real address where the guest program is going to access? OOOK, I reply myself after having read memcheck's code for a while. That conversion of the address to an HWord is bogus. Removing that and leaving the addr parameter alone makes things work as expected :-) Sorry for the noise, -- Julio M. Merino Vidal <jm...@ac...> |