B2R2


EvalState Type

The main evaluation state that will be updated by evaluating every statement encountered during the course of execution.

Constructors

Constructor Description

EvalState(?reader, ?ignoreundef)

Full Usage: EvalState(?reader, ?ignoreundef)

Parameters:
Returns: EvalState
?reader : Addr -> Addr -> Result<byte, ErrorCase>
?ignoreundef : bool
Returns: EvalState

Instance members

Instance member Description

this.AbortInstr()

Full Usage: this.AbortInstr()

Stop evaluating further statements of the current instruction, and move on the next instruction.

this.Callbacks

Full Usage: this.Callbacks

Returns: EvalCallBacks

Callback functions.

Returns: EvalCallBacks

this.CleanUp()

Full Usage: this.CleanUp()

Delete temporary states variables and get ready for evaluating the next block of isntructions.

this.ContextSwitch(tid)

Full Usage: this.ContextSwitch(tid)

Parameters:
    tid : int

Thread context switch. If the given thread ID does not exist, we create a new context for it.

tid : int

this.Contexts

Full Usage: this.Contexts

Per-thread context.

this.GetContext(tid)

Full Usage: this.GetContext(tid)

Parameters:
    tid : int

Returns: Context

Get the context of a specific thread.

tid : int
Returns: Context

this.GetCurrentContext()

Full Usage: this.GetCurrentContext()

Returns: Context

Get the current context of the current thread.

Returns: Context

this.GetMode()

Full Usage: this.GetMode()

Returns: ArchOperationMode

Get the current architecture operation mode.

Returns: ArchOperationMode

this.GetPC

Full Usage: this.GetPC

Returns: Addr

Get the program counter (PC).

Returns: Addr

this.GetReg(r)

Full Usage: this.GetReg(r)

Parameters:
Returns: BitVector

Get the value of the given register.

r : RegisterID
Returns: BitVector

this.GetTmp(n)

Full Usage: this.GetTmp(n)

Parameters:
    n : int

Returns: BitVector

Get the value of the given temporary variable.

n : int
Returns: BitVector

this.GoToLabel(lbl)

Full Usage: this.GoToLabel(lbl)

Parameters:

Go to the statement of the given label.

lbl : Symbol

this.IgnoreUndef

Full Usage: this.IgnoreUndef

Returns: bool

Whether to ignore statements that cannot be evaluated due to undef values. This is particularly useful to quickly check some constants.

Returns: bool

this.InPrematureState

Full Usage: this.InPrematureState

Indicate whether we are in an abnormal state. If so, the rest of the evaluation should be aborted. This flag should never be set in normal situation.

this.IncPC(amount)

Full Usage: this.IncPC(amount)

Parameters:
    amount : uint32

amount : uint32

this.IsInstrTerminated

Full Usage: this.IsInstrTerminated

Indicate whether to terminate the current instruction or not. This flag is set to true when we encounter an inter-jump statement, so that we can ignore the rest of the statements.

this.Memory

Full Usage: this.Memory

Returns: Memory

Memory.

Returns: Memory

this.NextStmt()

Full Usage: this.NextStmt()

Update the current statement index to be the next (current + 1) statement.

this.PC

Full Usage: this.PC

Current PC.

this.PrepareContext(tid) (pc) (regs)

Full Usage: this.PrepareContext(tid) (pc) (regs)

Parameters:

Prepare the initial context of the given thread id (tid). This function will set the current thread to be tid.

tid : int
pc : Addr
regs : (RegisterID * 'a) list

this.PrepareInstrEval(stmts)

Full Usage: this.PrepareInstrEval(stmts)

Parameters:

Get ready for evaluating an instruction.

stmts : Stmt[]

this.SetMode(mode)

Full Usage: this.SetMode(mode)

Parameters:

Set the architecture operation mode.

mode : ArchOperationMode

this.SetPC(addr)

Full Usage: this.SetPC(addr)

Parameters:

Set the program counter (PC).

addr : Addr

this.SetReg(r) (v)

Full Usage: this.SetReg(r) (v)

Parameters:

Set the value for the given register.

r : RegisterID
v : BitVector

this.SetTmp(n) (v)

Full Usage: this.SetTmp(n) (v)

Parameters:

Set the value for the given temporary variable.

n : int
v : BitVector

this.StartInstr()

Full Usage: this.StartInstr()

Start evaluating the instruction.

this.ThreadId

Full Usage: this.ThreadId

The current thread ID. We use thread IDs starting from zero. We assign new thread IDs by incrementing it by one at a time. The first thread is 0, the second is 1, and so on.

this.TryGetReg(r)

Full Usage: this.TryGetReg(r)

Parameters:
Returns: EvalValue

Get the value of the given register.

r : RegisterID
Returns: EvalValue

this.TryGetTmp(n)

Full Usage: this.TryGetTmp(n)

Parameters:
    n : int

Returns: EvalValue

Get the value of the given temporary variable.

n : int
Returns: EvalValue

this.UnsetReg(r)

Full Usage: this.UnsetReg(r)

Parameters:

Unset the given register.

r : RegisterID

this.UnsetTmp(n)

Full Usage: this.UnsetTmp(n)

Parameters:
    n : int

Unset the given temporary variable.

n : int