ROSE 0.11.145.147
Classes | Typedefs
Rose::BinaryAnalysis::InstructionSemantics::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:

BaseSemantics::RiscOperatorsPtr ops = SymbolicSemantics::RiscOperators::instance(....);
ops = TraceSemantics::RiscOperators::instance(ops); // this turns on tracing
static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.

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);
static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x)
Run-time promotion of a base RiscOperators pointer to trace operators.

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.
 
typedef void RegisterState
 
typedef boost::shared_ptr< void > RegisterStatePtr
 Shared-ownership pointer to trace-semantics register state.
 
typedef void MemoryState
 
typedef boost::shared_ptr< void > MemoryStatePtr
 Shared-ownership pointer to trace-semantics memory state.
 
typedef boost::shared_ptr< class RiscOperatorsRiscOperatorsPtr
 Shared-ownership pointer to trace-semantics RISC operations.
 

Typedef Documentation

◆ SValue

typedef void Rose::BinaryAnalysis::InstructionSemantics::TraceSemantics::SValue

Definition at line 60 of file TraceSemantics.h.

◆ SValuePtr

Shared-ownership pointer to trace-semantics values.

Definition at line 63 of file TraceSemantics.h.

◆ RegisterState

typedef void Rose::BinaryAnalysis::InstructionSemantics::TraceSemantics::RegisterState

Definition at line 70 of file TraceSemantics.h.

◆ RegisterStatePtr

Shared-ownership pointer to trace-semantics register state.

Definition at line 73 of file TraceSemantics.h.

◆ MemoryState

typedef void Rose::BinaryAnalysis::InstructionSemantics::TraceSemantics::MemoryState

Definition at line 80 of file TraceSemantics.h.

◆ MemoryStatePtr

Shared-ownership pointer to trace-semantics memory state.

Definition at line 83 of file TraceSemantics.h.

◆ RiscOperatorsPtr

Shared-ownership pointer to trace-semantics RISC operations.

Definition at line 91 of file TraceSemantics.h.