ROSE 0.11.145.192
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 &=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 &)
Run-time promotion of a base RiscOperators pointer to trace operators.

Classes

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

Typedefs

using SValue = void
 
using SValuePtr = boost::shared_ptr< void >
 Shared-ownership pointer to trace-semantics values.
 
using RegisterState = void
 
using RegisterStatePtr = boost::shared_ptr< void >
 Shared-ownership pointer to trace-semantics register state.
 
using MemoryState = void
 
using MemoryStatePtr = boost::shared_ptr< void >
 Shared-ownership pointer to trace-semantics memory state.
 
using RiscOperatorsPtr = boost::shared_ptr< class RiscOperators >
 Shared-ownership pointer to trace-semantics RISC operations.
 

Typedef Documentation

◆ SValue

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

Definition at line 59 of file TraceSemantics.h.

◆ SValuePtr

Shared-ownership pointer to trace-semantics values.

Definition at line 62 of file TraceSemantics.h.

◆ RegisterState

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

Definition at line 69 of file TraceSemantics.h.

◆ RegisterStatePtr

Shared-ownership pointer to trace-semantics register state.

Definition at line 72 of file TraceSemantics.h.

◆ MemoryState

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

Definition at line 79 of file TraceSemantics.h.

◆ MemoryStatePtr

Shared-ownership pointer to trace-semantics memory state.

Definition at line 82 of file TraceSemantics.h.

◆ RiscOperatorsPtr

Shared-ownership pointer to trace-semantics RISC operations.

Definition at line 90 of file TraceSemantics.h.