ROSE  0.9.9.109
Classes | Typedefs
Rose::BinaryAnalysis::InstructionSemantics2::TraceSemantics Namespace Reference

Description

A semantics domain wrapper that prints and checks all RISC operators as they occur.

This semantics domain provides only a RiscOperators class, which chains most methods to a subdomain specified either with its constructor or via set_subdomain(). In order to add tracing to any domain, simply wrap that domain's RiscOperators object inside a TraceSemantics' RiscOperators:

When an instruction is processed, it will emit traces on standard output (by default; see set_stream()). The messages look something like this (the exact format depends on the subdomain being traced):

Symbolic@0x28470a0 insn@0x080480a0[0]: startInstruction(mov al, BYTE PTR ss:[ebp + 0x10])
Symbolic@0x28470a0 insn@0x080480a0[0]: number_(32, 3) = 3[32]
Symbolic@0x28470a0 insn@0x080480a0[0]: number_(32, 134512800) = 0x080480a0[32]
Symbolic@0x28470a0 insn@0x080480a0[0]: add(0x080480a0[32], 3[32]) = 0x080480a3[32]
Symbolic@0x28470a0 insn@0x080480a0[0]: writeRegister(eip, 0x080480a3[32])
Symbolic@0x28470a0 insn@0x080480a0[0]: readRegister(ebp) = v3284[32]
Symbolic@0x28470a0 insn@0x080480a0[0]: number_(8, 16) = 16[8]
Symbolic@0x28470a0 insn@0x080480a0[0]: signExtend(16[8], 32) = 16[32]
Symbolic@0x28470a0 insn@0x080480a0[0]: add(v3284[32], 16[32]) = (add[32] v3284[32] 16[32])
Symbolic@0x28470a0 insn@0x080480a0[0]: boolean_(1) = 1[1]
Symbolic@0x28470a0 insn@0x080480a0[0]: readMemory(ss, (add[32] v3284[32] 16[32]), v3286[8], 1[1]) = v3285[8]
Symbolic@0x28470a0 insn@0x080480a0[0]: writeRegister(al, v3285[8])
Symbolic@0x28470a0 insn@0x080480a0[0]: finishInstruction(mov al, BYTE PTR ss:[ebp + 0x10])

The TraceSemantics also checks for problems with operand and return value widths and reports them in the output also. Tracing can be turned off either by specifying a NULL file pointer for set_stream(), or by unwrapping the subdomain's RISC operators, something along these lines:

ops = TraceSemantics::RiscOperators::promote(ops)->get_subdomain();
dispatcher->set_operators(ops);

Classes

class  RiscOperators
 Wraps RISC operators so they can be traced. More...
 

Typedefs

typedef void SValue
 
typedef boost::shared_ptr< void > SValuePtr
 Shared-ownership pointer to trace-semantics values. More...
 
typedef void RegisterState
 
typedef boost::shared_ptr< void > RegisterStatePtr
 Shared-ownership pointer to trace-semantics register state. More...
 
typedef void MemoryState
 
typedef boost::shared_ptr< void > MemoryStatePtr
 Shared-ownership pointer to trace-semantics memory state. More...
 
typedef boost::shared_ptr< class RiscOperatorsRiscOperatorsPtr
 Shared-ownership pointer to trace-semantics RISC operations. More...
 

Typedef Documentation

Shared-ownership pointer to trace-semantics values.

See Shared ownership.

Definition at line 60 of file TraceSemantics2.h.

Shared-ownership pointer to trace-semantics register state.

See Shared ownership.

Definition at line 70 of file TraceSemantics2.h.

Shared-ownership pointer to trace-semantics memory state.

See Shared ownership.

Definition at line 80 of file TraceSemantics2.h.

Shared-ownership pointer to trace-semantics RISC operations.

See Shared ownership.

Definition at line 88 of file TraceSemantics2.h.