Interface IEGlobalContext
Global IR context. A native decompiler instance holds a single global IR context. The global
context is also a factory for non-local IR objects, such as IR constants or IR operations.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Register a routine context with this global context.default EState
Create a machine state for IR emulation.default EState
Create a machine state for IR emulation with all defined registers, symbols, and globals reset to 0.buildState
(boolean initRegisters, boolean initSymbols, boolean initGlobals) Create a machine state for IR emulation.boolean
canCreateVariable
(int id, int bitsize) createBranchDetails
(List<IEVar> def, List<IEVar> use, List<IEVar> spoiled, int fallbackStackPointerDelta) Create basic branch details information.createBranchDetails
(List<IEVar> def, List<IEVar> use, List<IEVar> spoiled, int fallbackStackPointerDelta, IPrototypeItem nativePrototypeHint, List<IBranchTarget> dynamicTargetCandidates) Create basic branch details information.createCompose
(IEGeneric... elts) Create a composition of IR elements.createCompose
(Collection<IEGeneric> elts) createCond
(IEGeneric p, IEGeneric a, IEGeneric b) createConversionOperation
(OperationType convOperator, IEGeneric src, int dstSize) Create a conversion operation: an integer truncation, integer extension (zero or signed), float truncation or extension, float-to-int and int-to-float conversion.createFunctionType
(String name, int flags, int minOpndCount, int maxOpndCount, int resultBitsize) Create a new function operation type.createGlobalReference
(String name, Long address) Create or retrieve a variable referencing a global element.createGlobalVariable
(long address, int bitsize) Create a global, memory-mapped variable.createGroupElt
(IEGroup collection, IEGeneric index) createImm
(byte[] v, int bitsize) createImm
(double v) createImm
(float v) createImm
(long v, int bitsize) createImm
(BigInteger v, int bitsize) createOperation
(FunctionOptype functionOptype, IEGeneric... opnds) createOperation
(OperationType optype, IEGeneric op1) createOperation
(OperationType optype, IEGeneric op1, IEGeneric op2) createRange
(int begin, int end) createRegister
(int id, String name, int bitsize) Create a physical register with a manually assigned id (use with care).createRegister
(String name, int bitsize) Create a physical register.createResizeOperation
(IEGeneric opnd, int bitsize, boolean signed) Create a resize operation operation: truncation, zero-extension, or sign-extension.Create a new routine-less routine context.createRoutineContext
(INativeMethodItem routine) Create a new routine context.createSlice
(IEGeneric e, int bitstart, int bitend) createSlice
(IEGeneric e, IERange range) createSymbolForData
(INativeDataItem data, IERoutineContext userctx) createSymbolForRoutine
(INativeMethodItem routine, IERoutineContext userctx) createVirtualRegister
(int id, String name, int bitsize) Create a virtual register with a manually assigned id (use with care).createVirtualRegister
(String name, int bitsize) Create a virtual register.int
getAllRegisters
(Set<Integer> exclusions) getCandidatePrototype
(INativeMethodItem routine) Retrieve a piece of transient data.getFunctionType
(String name) Retrieve a function operation type by name.getGlobalVariable
(long address) Retrieve the list of globals (memory) variables defined in this context.Convenience method.int
getRoutineContext
(int index) Retrieve a list of all converted routines.getVar
(int id) Retrieve a global contextIEVar
by id.getVariableByName
(String name) Retrieve a global-scope variable by name.getVariables
(int idStart, int idEnd) getVarSafe
(int id) boolean
boolean
removeRoutineContext
(IERoutineContext ctx, boolean stopTrackingNativeDeps) Delete a converted routine.boolean
setCandidatePrototype
(INativeMethodItem routine, IWildcardPrototype proto, int guarantee) void
Store a piece of transient data.
-
Method Details
-
getNativeMemory
IVirtualMemory getNativeMemory()Convenience method.- Returns:
-
getWildcardTypeManager
IWildcardTypeManager getWildcardTypeManager() -
getCandidatePrototype
-
setCandidatePrototype
- Parameters:
routine
-proto
-guarantee
- use 0 for an unknown guarantee- Returns:
-
createRoutineContext
IERoutineContext createRoutineContext()Create a new routine-less routine context. The newly created routine context is not attached to this global context. UseaddRoutineContext(IERoutineContext)
to add it to the global context.- Returns:
-
createRoutineContext
Create a new routine context. The newly created routine context is not attached to this global context. UseaddRoutineContext(IERoutineContext)
to add it to the global context.- Parameters:
routine
-- Returns:
-
getRoutineContexts
List<IERoutineContext> getRoutineContexts()Retrieve a list of all converted routines.- Returns:
-
getRoutineContext
-
addRoutineContext
Register a routine context with this global context.- Parameters:
ctx
-
-
removeRoutineContext
Delete a converted routine.- Parameters:
ctx
-stopTrackingNativeDeps
-- Returns:
-
getRegisterBitsize
int getRegisterBitsize() -
getAddressBitsize
int getAddressBitsize() -
isBigEndian
boolean isBigEndian() -
getConverter
AbstractConverter<?> getConverter() -
getNativeContext
INativeContext getNativeContext() -
getObjectTracker
INativeObjectTracker getObjectTracker() -
createBranchDetails
IEBranchDetails createBranchDetails(List<IEVar> def, List<IEVar> use, List<IEVar> spoiled, int fallbackStackPointerDelta) Create basic branch details information.- Parameters:
def
-use
-spoiled
-fallbackStackPointerDelta
- the provided SP delta will have unknown guarantee and unknown origin- Returns:
-
createBranchDetails
IEBranchDetails createBranchDetails(List<IEVar> def, List<IEVar> use, List<IEVar> spoiled, int fallbackStackPointerDelta, IPrototypeItem nativePrototypeHint, List<IBranchTarget> dynamicTargetCandidates) Create basic branch details information.- Parameters:
def
-use
-spoiled
-fallbackStackPointerDelta
-nativePrototypeHint
-dynamicTargetCandidates
-- Returns:
-
createCompose
Create a composition of IR elements.- Parameters:
elts
- at least two elements, from lowest-significant to highest-significant- Returns:
-
createCompose
-
createCond
-
createGroupElt
-
createImm
-
createImm
-
createImm
-
createImm
-
createImm
-
createImm
-
createMem
-
createMem
-
createOperation
-
createOperation
-
createOperation
-
createFunctionType
FunctionOptype createFunctionType(String name, int flags, int minOpndCount, int maxOpndCount, int resultBitsize) Create a new function operation type.- Parameters:
name
- function name (cannot be blank)flags
- function flags, seeFLAG_xxx
inFunctionOptype
for a list of legal flagsminOpndCount
- 0+maxOpndCount
- 0+resultBitsize
- leave to 0 to signify that the resulting bitsize must be the same as the first operand's (in which case minOpndCount must be at least 1), else a valid positive bitsize must be specified- Returns:
- the function (never null; this method throws on error)
-
getFunctionType
Retrieve a function operation type by name.- Parameters:
name
- function name- Returns:
- the function, null if it does not exist (was not previously created)
-
createResizeOperation
Create a resize operation operation: truncation, zero-extension, or sign-extension.- Parameters:
opnd
- the source to be extended (dstSize > srcSize) or truncated (dstSize < srcSize)bitsize
- the destination size; should be different than the source'ssigned
- for extensions, else N/A- Returns:
- the operation IRE
-
createConversionOperation
Create a conversion operation: an integer truncation, integer extension (zero or signed), float truncation or extension, float-to-int and int-to-float conversion.- Parameters:
convOperator
- one of for whichOperationType.isConversion()
returns true (eg,OperationType.CAST
,OperationType.CAST_S
,OperationType.FP2FP
,OperationType.FP2INT
,OperationType.INT2FP
)src
- operand to be extended, truncated, or converteddstSize
- resulting bitsize- Returns:
- the operation IRE
-
createRange
-
createSlice
-
createSlice
-
createRegister
Create a physical register with a manually assigned id (use with care). Shared across routines boundaries. No address, no type.- Parameters:
id
-name
-bitsize
-- Returns:
-
createRegister
Create a physical register. Shared across routines boundaries. No address, no type.- Parameters:
name
-bitsize
-- Returns:
-
createVirtualRegister
Create a virtual register with a manually assigned id (use with care). Preserved/not shared across routines boundaries. No address, no type.- Parameters:
id
-name
-bitsize
-- Returns:
-
createVirtualRegister
Create a virtual register. Preserved/not shared across routines boundaries. No address, no type.- Parameters:
name
-bitsize
-- Returns:
-
createGlobalReference
Create or retrieve a variable referencing a global element. Reference variables cannot be assigned to. The reference is not tracked.- Parameters:
name
- optional nameaddress
- optional address referenced (e.g. if the reference is a concrete data element); if the name is null, an address must be specified- Returns:
- a reference variable
-
getGlobalVariable
-
createGlobalVariable
Create a global, memory-mapped variable.- Parameters:
address
-bitsize
-- Returns:
-
getGlobalVariables
Collection<IEVar> getGlobalVariables()Retrieve the list of globals (memory) variables defined in this context.- Returns:
-
createSymbolForRoutine
-
retrieveRoutineFromSymbol
-
createSymbolForData
-
retrieveDataFromSymbol
-
getVariableByName
Retrieve a global-scope variable by name.- Parameters:
name
-- Returns:
- the variable or null
-
getVarSafe
-
getVar
Retrieve a global contextIEVar
by id. Throws if does not exist.- Parameters:
id
-- Returns:
-
canCreateVariable
boolean canCreateVariable(int id, int bitsize) -
getVariables
-
getAllVariables
Collection<IEVar> getAllVariables() -
getAllRegisters
Collection<IEVar> getAllRegisters() -
getAllRegisters
-
buildState
Create a machine state for IR emulation.- Parameters:
initRegisters
- initialize all global IEVar-registers to 0initSymbols
- initialize all global symbols IEVars to 0initGlobals
- initialize all global memory IEVars to 0- Returns:
- a fresh state
-
buildState
Create a machine state for IR emulation with all defined registers, symbols, and globals reset to 0.Same as
buildState(true, true, true)
- Returns:
- a fresh state
-
buildEmptyState
Create a machine state for IR emulation.Same as
buildState(false, false, false)
- Returns:
- a fresh state
-
setData
Store a piece of transient data.- Parameters:
key
-value
-
-
getData
Retrieve a piece of transient data.- Parameters:
key
-- Returns:
-