B2R2


CodeManager Type

CodeManager manages all the processed information about the binary code including *parsed* instructions, their basic blocks, functions, as well as exception handling routines.

Constructors

Constructor Description

CodeManager(hdl)

Full Usage: CodeManager(hdl)

Parameters:
Returns: CodeManager
hdl : BinHandle
Returns: CodeManager

Instance members

Instance member Description

this.AddBBL(blkRange) (irLeaders) (funcEntry) (insAddrs)

Full Usage: this.AddBBL(blkRange) (irLeaders) (funcEntry) (insAddrs)

Parameters:

Add the given bbl information; update the instruction-to-bbl mapping information.

blkRange : AddrRange
irLeaders : Set<ProgramPoint>
funcEntry : Addr
insAddrs : Addr list

this.BBLCount

Full Usage: this.BBLCount

Returns: int

Get the current basic block count.

Returns: int

this.ExceptionTable

Full Usage: this.ExceptionTable

Returns: ExceptionTable

Return the exception table.

Returns: ExceptionTable

this.FoldBBLs(fn) (acc)

Full Usage: this.FoldBBLs(fn) (acc)

Parameters:
Returns: 'a

Fold every instruction stored in the CodeManager.

fn : 'a -> KeyValuePair<Addr, BBLInfo> -> 'a
acc : 'a
Returns: 'a

this.FoldInstructions(fn) (acc)

Full Usage: this.FoldInstructions(fn) (acc)

Parameters:
Returns: 'a

Fold every instruction stored in the CodeManager.

fn : 'a -> KeyValuePair<Addr, InstructionInfo> -> 'a
acc : 'a
Returns: 'a

this.FunctionMaintainer

Full Usage: this.FunctionMaintainer

Returns: FunctionMaintainer

Return the function maintainer.

Returns: FunctionMaintainer

this.GetBBL(addr)

Full Usage: this.GetBBL(addr)

Parameters:
Returns: BBLInfo

Find the corresponding BBL address from the given instruction address.

addr : Addr
Returns: BBLInfo

this.GetInstruction(addr)

Full Usage: this.GetInstruction(addr)

Parameters:
Returns: InstructionInfo

Access instruction at the given address.

addr : Addr
Returns: InstructionInfo

this.HasBBL(addr)

Full Usage: this.HasBBL(addr)

Parameters:
Returns: bool

Check if the manager contains a basic block starting at the given address.

addr : Addr
Returns: bool

this.HasInstruction(addr)

Full Usage: this.HasInstruction(addr)

Parameters:
Returns: bool

Check if the manager contains parsed InstructionInfo located at the given address.

addr : Addr
Returns: bool

this.HistoryManager

Full Usage: this.HistoryManager

Returns: HistoryManager

Return the history manager.

Returns: HistoryManager

this.InstructionCount

Full Usage: this.InstructionCount

Returns: int

Get the current instruction count.

Returns: int

this.ParseBBL(hdl) (mode) (leaderAddr) (func) (evts)

Full Usage: this.ParseBBL(hdl) (mode) (leaderAddr) (func) (evts)

Parameters:
Returns: Result<CFGEvents, ErrorCase>

Parse an instruction-level basic block starting from the given leader address. Return new CFG events to handle.

hdl : BinHandle
mode : ArchOperationMode
leaderAddr : Addr
func : RegularFunction
evts : CFGEvents
Returns: Result<CFGEvents, ErrorCase>

this.PromoteBBL(hdl) (bblAddr) (bbl) (dataMgr) (evts)

Full Usage: this.PromoteBBL(hdl) (bblAddr) (bbl) (dataMgr) (evts)

Parameters:
Returns: RegularFunction * CFGEvents

The BBL had been created as a non-function bbl; there was a jump edge to this BBL. However, we later found that this block was a function and the jump edge must be changed to a tail-call edge. So we turn the BBL into a function. We call this process as BBL promotion.

hdl : BinHandle
bblAddr : Addr
bbl : BBLInfo
dataMgr : DataManager
evts : CFGEvents
Returns: RegularFunction * CFGEvents

this.RemoveBBL(bblAddr)

Full Usage: this.RemoveBBL(bblAddr)

Parameters:

Remove the given BBL located at the bblAddr.

bblAddr : Addr

this.RemoveBBL(bbl)

Full Usage: this.RemoveBBL(bbl)

Parameters:

Remove the given BBLInfo.

bbl : BBLInfo

this.ReplaceInlinedAssemblyChunk(insAddrs) (chunk) (evts)

Full Usage: this.ReplaceInlinedAssemblyChunk(insAddrs) (chunk) (evts)

Parameters:
Returns: CFGEvents
insAddrs : Addr list
chunk : Instruction
evts : CFGEvents
Returns: CFGEvents

this.RollBack(evts, fnAddrs)

Full Usage: this.RollBack(evts, fnAddrs)

Parameters:
Returns: CFGEvents
evts : CFGEvents
fnAddrs : Addr list
Returns: CFGEvents

this.SplitBlock(bbl) (splitAddr) (evts)

Full Usage: this.SplitBlock(bbl) (splitAddr) (evts)

Parameters:
Returns: ProgramPoint option * CFGEvents

Split the given basic block into two at the given address (splitAddr), and returns a pair of (the address of the front bbl after the cut-out, and new events). The front bbl may not exist if the split point is at the address of an existing bbl leader.

bbl : BBLInfo
splitAddr : Addr
evts : CFGEvents
Returns: ProgramPoint option * CFGEvents

this.TryGetBBL(addr)

Full Usage: this.TryGetBBL(addr)

Parameters:
Returns: BBLInfo option

Try to find the corresponding BBL address from the given instruction address.

addr : Addr
Returns: BBLInfo option

this.UpdateFunctionEntry(bblAddr) (funcEntry)

Full Usage: this.UpdateFunctionEntry(bblAddr) (funcEntry)

Parameters:

Update function entry information for the basic block located at the given address.

bblAddr : Addr
funcEntry : Addr