|
From: Leung Ngai-H. Z. <leu...@co...> - 2006-01-07 10:47:57
|
Hi
I'm trying to record instruction reads as well as data reads and writes.
Lackey and Cachegrind contain code that does this, so I was looking
through it. I would like to print to screen the address of every
instruction read by the CPU, but I can't figure out how to make an IRExpr*
from an Addr64. How do I do that? I've attached the relevant parts of
my code below.
Zac
st = bb_in->stmts[i];
switch (st->tag) {
case Ist_IMark:
cia = (Addr) st->Ist.IMark.addr;
addr_expr = mkIRExpr_HWord( sizeofIRType( cia ) );
// addr_expr = mkIRExpr_HWord( sizeofIRType(
st->Ist.IMark.addr ) );
argv = mkIRExprVec_1( addr_expr );
di = unsafeIRDirty_0_N( /*regparms*/1,
"trace_ins_read",
VG_(fnptr_to_fnentry)( trace_ins_read
),
argv );
addStmtToIRBB( bb, IRStmt_Dirty(di) );
|
|
From: Julian S. <js...@ac...> - 2006-01-07 12:46:57
|
On Saturday 07 January 2006 10:47, Leung Ngai-Hang Zachary wrote:
> Hi
>
> I'm trying to record instruction reads as well as data reads and writes.
> Lackey and Cachegrind contain code that does this, so I was looking
> through it. I would like to print to screen the address of every
> instruction read by the CPU, but I can't figure out how to make an IRExpr*
> from an Addr64. How do I do that? I've attached the relevant parts of
> my code below.
>
> Zac
>
> st = bb_in->stmts[i];
>
> switch (st->tag) {
> case Ist_IMark:
> cia = (Addr) st->Ist.IMark.addr;
> addr_expr = mkIRExpr_HWord( sizeofIRType( cia ) );
> // addr_expr = mkIRExpr_HWord( sizeofIRType(
> st->Ist.IMark.addr ) );
> argv = mkIRExprVec_1( addr_expr );
> di = unsafeIRDirty_0_N( /*regparms*/1,
> "trace_ins_read",
> VG_(fnptr_to_fnentry)( trace_ins_read
> ),
> argv );
> addStmtToIRBB( bb, IRStmt_Dirty(di) );
What you want is probably
addr_expr = mkIRExpr_HWord( st->Ist.IMark.addr );
Does that work?
J
|