On Wednesday 20 February 2008 09:26, you wrote:
> In fact, i think i've explained my problem in a very silly way (and i'm
> sorry for that ...).
> Let's suppose we're given a input IRSB with a t3 = Add32(t2,t5) statement.
> What i intend to do is to access, at run-time, the value of t3.
> My first idea was to use a helper c function which would, at run time,
> access the temporaries (via pointers f.e.). But how to access this
> temporaries at run time, via pointers ?

You can't access them via pointers.  The temporaries are stored in
registers by a later stage of the compilation (JIT) pipeline.

Your instrumentation function will scan the input IRSB.  It must
copy all the input code into a new IRSB (else the program won't
work properly).  But when it does the copy, it can add new code of
its own.  For example, if it sees

  t3 = Add32(t2,t5)

then after that you can create an IRStmt which contains an 
IRExpr_RdTmp(t3).

For example, you could create an IRStmt which calls a C helper
function, passing it the value of t3.  Many tools do that kind
of thing.  Try studying lackey, it is relatively simple.  Try
to understand the output of --trace-flags=10001000.

It is better to generate in-inline IR instrumentation than to
generate many calls to C helper functions, since calling C helpers
a lot will make your programs run slowly.

J

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Valgrind-developers mailing list
Valgrind-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to