# Interface: com.pnfsoftware.jeb.core.units.code.android.ir.IDState

`dexdec` IR state \(referred as "State"\), used to perform IR evaluations, emulation and sandboxing. After use, a state must be [disposed](#dispose()) to prevent resource leaks. 

 This interface exposes a significant subset of the State functionalities, but not all. In particular, the sandbox itself cannot be manipulated \(it can only be enabled or disabled\). Future API extensions may allow third\-party clients to access those controls. 

 A State can be created or retrieved via the global IR context \(the `g` attribute in optimizers inheriting [AbstractDOptimizer](AbstractDOptimizer)\), see methods [IDGlobalContext#createState()](IDGlobalContext#createState()) and [IDGlobalContext#getThreadSharedState()](IDGlobalContext#getThreadSharedState()). 

 The emulation of code takes place within a `context`. Each context has a stack of `frame`s, holding the emulator state relative to the method being executed \(the top frame for the current method, the second frame for the caller of the current method, etc.\). 

 Note the special role of [IDImm](IDImm) objects: they represent both immediate values, as well as object references living in a State object.

## Static Field: DEFAULT_MAX_DURATION
Type: `int`

Constant value: `1000`
Description: Default maximum duration, in milliseconds.

## Static Field: DEFAULT_MAX_INVOCATION_DEPTH
Type: `int`

Constant value: `50`
Description: Default maximum depth for method invocations.

## Static Field: DEFAULT_MAX_ITERCOUNT
Type: `int`

Constant value: `100`
Description: Default maximum iteration count.

## Static Field: FIELDACCESS_ALLOW_ALL
Type: `int`

Constant value: `255`

## Static Field: FIELDACCESS_ALLOW_READ_EXTERNAL_INSTANCE
Type: `int`

Constant value: `1`

## Static Field: FIELDACCESS_ALLOW_READ_EXTERNAL_STATIC
Type: `int`

Constant value: `16`

## Static Field: FIELDACCESS_ALLOW_READ_INTERNAL_INSTANCE
Type: `int`

Constant value: `4`

## Static Field: FIELDACCESS_ALLOW_READ_INTERNAL_STATIC
Type: `int`

Constant value: `64`

## Static Field: FIELDACCESS_ALLOW_WRITE_EXTERNAL_INSTANCE
Type: `int`

Constant value: `2`

## Static Field: FIELDACCESS_ALLOW_WRITE_EXTERNAL_STATIC
Type: `int`

Constant value: `32`

## Static Field: FIELDACCESS_ALLOW_WRITE_INTERNAL_INSTANCE
Type: `int`

Constant value: `8`

## Static Field: FIELDACCESS_ALLOW_WRITE_INTERNAL_STATIC
Type: `int`

Constant value: `128`

## Static Field: FIELDACCESS_DENY_ALL
Type: `int`

Constant value: `0`

## Static Field: SUBEXEC_ALLOW_ALL
Type: `int`

Constant value: `255`
Description: Sub\-routine execution policy: this special flag allows everything.

## Static Field: SUBEXEC_ALLOW_EXTERNAL
Type: `int`

Constant value: `2`
Description: Sub\-routine execution policy: this flag allows external routines.

## Static Field: SUBEXEC_ALLOW_INTERNAL
Type: `int`

Constant value: `1`
Description: Sub\-routine execution policy: this flag allows internal routines.

## Static Field: SUBEXEC_DENY_ALL
Type: `int`

Constant value: `0`
Description: Sub\-routine execution policy: this flag forbids the emulation of sub\-routines.

## Method: addClassfilesToSandbox
- parameter: `f`, type: `java.io.File`

Description: Convenience method to add class files \(single class or Jar\) to the sandbox classloader.
parameter: f: 
throws: 

## Method: canRun
- return type: `boolean`

Description: Quickly determine whether this State is usable, that is, can code be emulated \(e.g. did we reach the max iteration count or timeout?\)
return: 

## Method: cloneArray
- parameter: `arrayRef`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Clone an array.
parameter: arrayRef: source array reference
return: the cloned array \(as defined by the JLS's `array.clone` protected method\)
throws: 

## Method: createArray
- parameter: `type`, type: `com.pnfsoftware.jeb.core.units.code.java.IJavaType`
- parameter: `len`, type: `int`
- parameter: `initialValues`, type: `java.util.List<? extends com.pnfsoftware.jeb.core.units.code.android.ir.IDImm>`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Create an array. The array object will live in this emulator.
parameter: type: the array type e.g. int\[\]\[\]\[\], or String\[\]\[\], or X\[\]
parameter: len: the length of the first dimension, re\-using the examples above, would indicate an            array int\[N\]\[\]\[\], String\[N\]\[\], X\[N\]
parameter: initialValues: a list of initial values, non\-null, whose length must in \[0, N\]
return: the IR constant wrapping the array
throws: 

## Method: createArray
- parameter: `typesig`, type: `java.lang.String`
- parameter: `len`, type: `int`
- parameter: `initialValues`, type: `java.util.List<? extends com.pnfsoftware.jeb.core.units.code.android.ir.IDImm>`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Create an array. The array object will live in this emulator.
parameter: type: the array type signature, '\[\[\[I' or '\[\[Ljava/lang/String;'
parameter: len: the length of the first dimension
parameter: initialValues: a list of initial values, non\-null, whose length must in \[0, N\]
return: the IR constant wrapping the array
throws: 

## Method: createNewInstance
- parameter: `constructorSignature`, type: `java.lang.String`
- parameter: `constructorParameters`, type: `java.util.Collection<com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression>`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Create a new instance of an object. This method is similar to [Class#newInstance()](Class#newInstance()); it allocates an object and executes a constructor method.
parameter: constructorSignature: full signature, e.g. `Lcom/abc/Foo-><init>(II)V`
parameter: constructorParameters: parameters
return: the newly\-created instance
throws: 

## Method: createNewInstance
- parameter: `classSignature`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: 
parameter: classSignature: 
return: 
throws: 

## Method: deleteTopContext
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDEmuContext`

Description: Delete the most recent \(top\) execution context.
return: 

## Method: deleteTopFrame
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDEmuFrame`

Description: Delete the most recent \(top\) frame of the current execution context.
return: 

## Method: deleteVariable
- parameter: `varid`, type: `int`
- return type: `boolean`

Description: Convenience method to remove a defined variable in the current frame \(top frame of the top context\).
parameter: varid: variable id
return: true if the variable was removed
throws: 

## Method: dispose

Description: Dispose of this emulator's resources.

## Method: enableEmulator
- parameter: `enabled`, type: `boolean`

Description: Enable or disable the emulator. The emulator must be enabled to permit the execution of [IDInstruction#evaluate()](IDInstruction#evaluate()).

## Method: enableExceptionHandling
- parameter: `enabled`, type: `boolean`

Description: 
deprecated: use [#setExceptionHandlingEnabled(boolean)](#setExceptionHandlingEnabled(boolean)) instead

## Method: enableNativeCodeEmulator
- parameter: `enabled`, type: `boolean`

Description: Enable or disable the native code emulator. The native code emulator relies on other JEB modules, mainly the native code analysis pipeline, `gendec` \(JEB's generic decompiler\), and specific architecture plugins \(such as the x86 or arm processor plugins\). The native code emulator must be enabled to allow the emulation of code invoking native routines through JNI \(Java Native Interfaces\).
parameter: enabled: true to enable the native code emulator, false to disable it \(note that the            initial setting is likely to be pulled from your dexdec configuration file,            `dexdec-emu.cfg`\)

## Method: enableSandbox
- parameter: `enabled`, type: `boolean`
- return type: `boolean`

Description: Enable or disable the sandbox. The sandbox is used to safely execute external code \(not present in the form of dex bytecode in the application\).
parameter: enabled: 
return: success indicator

## Method: execute
- parameter: `info`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.DExecutionParameters`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Execute some IR. 

 The execution takes place in the current frame \(i.e. no new context or frame is created, it is the responsibility of the caller to do so\). That current frame is popped only if the method execution completes fully and no [PC\-end value](DExecutionParameters#pcExpectedTermination) was provided in the parameter. On other cases \(e.g., an exception is raised, null is returned return because `pcExpectedTermination` was provided and was reached, etc.\), the current frame is left as\-is to allow client code to examine it.
parameter: info: execution parameters, including the IR instructions
return: the execution return value
throws: 

## Method: executeDexMethod
- parameter: `m`, type: `com.pnfsoftware.jeb.core.units.code.android.dex.IDexMethod`
- parameter: `args`, type: `java.util.List<com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression>`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Execute \(emulate\) an IR method within a new context. Upon completion \(success or error\), the newly\-created context is auto\-discarded. The execution result is provided; global objects created by the execution can be reviewed with methods like [#getObject(IDImm)](#getObject(IDImm)); the rest \(frame variables, etc.\) is discarded. 

 NOTE: This method is currently limited to the execution of dex internal methods \(not pure references, not abstract or native\). This method is not meant to execute constructor code \(`<init>` methods\); to create new objects, use [#createNewInstance(String, Collection)](#createNewInstance(String, Collection)).
parameter: m: a dex internal method
parameter: args: method arguments
return: the return value upon completion, if there is one
throws: an evaluation exception occurred

## Method: getAndroidAppEmulator
- return type: `com.pnfsoftware.jeb.core.units.code.android.IAndroidAppEmulator`

Description: Retrieve a reference to the lower\-level Android app emulator. That component is used to emulate the Android Linux subsystem used to run an application.
return: 

## Method: getApk
- return type: `com.pnfsoftware.jeb.core.units.code.android.IApkUnit`

Description: Retrieve the parent APK unit of the Dex unit that is being emulated.
return: an apk unit; maybe null

## Method: getArrayElement
- parameter: `arrayRef`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- parameter: `index`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Read an array element.
parameter: arrayRef: 
parameter: index: 
return: 
throws: 

## Method: getArrayObject
- parameter: `ref`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `java.lang.Object`

Description: Retrieve an array by reference.
parameter: ref: 
return: 
throws: 

## Method: getArrayObjectLength
- parameter: `ref`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `int`

Description: Get the length of an array.
parameter: ref: 
return: 
throws: 

## Method: getClassReference
- parameter: `classname`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Retrieve a classref reference by name. The class is not initialized.
parameter: classname: fully\-qualified name, e.g. `Lcom/abc/Foo;`
return: 
throws: 

## Method: getContexts
- return type: `java.util.Collection<com.pnfsoftware.jeb.core.units.code.android.ir.IDEmuContext>`

Description: Retrieve a read\-only collection of emulation contexts.
return: 

## Method: getCountOfContexts
- return type: `int`

Description: A convenience method to get the count of contexts.
return: 

## Method: getCurrentContext
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDEmuContext`

Description: Convenience method to retrieve the current \(newest\) context.
return: 

## Method: getCurrentDuration
- return type: `long`

Description: Set the emulator timeout value. 

 If a run exceeds the timeout, the emulation fails and a [DexDecEvalTimeoutExceededException](DexDecEvalTimeoutExceededException) exception is raised.
return: in ms

## Method: getCurrentFrame
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDEmuFrame`

Description: Convenience method to retrieve the top frame of the current \(newest\) context.
return: 

## Method: getCurrentIterationCount
- return type: `int`

Description: Retrieve the current total iteration count, that is, the total number of statements emulated or executed by this object. 

 If the maximum iteration count is reached, a [DexDecEvalItercountExceededException](DexDecEvalItercountExceededException) exception is be raised.
return: 

## Method: getData
- parameter: `key`, type: `java.lang.String`
- return type: `java.lang.Object`

Description: Get \(retrieve\) a piece of data attached to this emulator object.
parameter: key: non\-null key
return: the data, null if none

## Method: getDecompiler
- return type: `com.pnfsoftware.jeb.core.units.code.android.IDexDecompilerUnit`

Description: Convenience method.
return: never null

## Method: getDex
- return type: `com.pnfsoftware.jeb.core.units.code.android.IDexUnit`

Description: Convenience method.
return: never null

## Method: getEmulatedEnvironment
- return type: `com.pnfsoftware.jeb.core.units.code.android.IEmulatedAndroid`

Description: Retrieve the optional "emulated Android" manager of this dex code emulator.
return: 

## Method: getExecutionHelpers
- return type: `java.util.Collection<com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodExecutionHelper>`

Description: Retrieve the collection of all registered method execution helpers.
return: 

## Method: getExternalPolicy
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.DEmuExternalPolicy`

Description: Retrieve the current emulation policy for environment\-related, time and date\-related, and other API methods yielding unpredictable results.
return: may be null

## Method: getFieldAccessPolicy
- return type: `int`

Description: Retrieve the emulation policy for accessing fields.
return: a combination of `FIELDACCESS_xxx` flags

## Method: getGlobalContext
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDGlobalContext`

Description: Retrieve the global IR context that was used to create this State.
return: 

## Method: getInstanceField
- parameter: `fsig`, type: `java.lang.String`
- parameter: `instance`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Retrieve the value of an instance field.
parameter: fsig: 
parameter: instance: 
return: 
throws: 

## Method: getIterationCountLeft
- return type: `int`

Description: Retrieve the number of iterations left.
return: 

## Method: getMaxDuration
- return type: `long`

Description: Retrieve the emulator timeout value.
return: max duration in ms

## Method: getMaxInvocationDepth
- return type: `int`

Description: Get the maximum allowed depth for method invocations.
return: the current maximum depth \(defaults to [#DEFAULT_MAX_INVOCATION_DEPTH](#DEFAULT_MAX_INVOCATION_DEPTH)\)

## Method: getMaxIterationCount
- return type: `int`

Description: Retrieve the max iteration count value.
return: max iteration count

## Method: getNativeEmulator
- return type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.emulator.EEmulator`

Description: Retrieve the native emulator. This method will throw if native code emulation is disabled.
return: the emulator or null if the emulator is not ready \(the native emulator is initialized         lazily, on the first attempt to load a native JNI library\)

## Method: getNativeLibraries
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.android.INativeLibrary>`

Description: Get the list of native libraries loaded in the native emulator.
return: a list of library objects, possibly empty
throws: 

## Method: getObject
- parameter: `ref`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `java.lang.Object`

Description: Retrieve an object value by its reference.
parameter: ref: a wrapped reference or a string immediate
return: an object
throws: 

## Method: getObject
- parameter: `ref`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- parameter: `provideNativeObject`, type: `boolean`
- return type: `java.lang.Object`

Description: Retrieve an object value by its reference.
parameter: ref: a wrapped reference or a string immediate
parameter: provideNativeObject: 
return: an object, or null \(which does not indicate an error, but the null reference\)
throws: 

## Method: getObject
- parameter: `objid`, type: `int`
- return type: `java.lang.Object`

Description: Convenience method to retrieve an object by its reference id.
parameter: objid: an object id
return: the object \(null if the provided id was 0 \- the null reference\)
throws: if no object with the provided id exists

## Method: getObjectClass
- parameter: `objid`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDEmuClass`

Description: Retrieve the emulated class object for the provided object.
parameter: objid: an object reference id
return: the emulated class object \(null if the provided id was 0 \- the null reference\)
throws: if no object with the provided id exists

## Method: getObjectClassId
- parameter: `objid`, type: `int`
- return type: `int`

Description: Retrieve the class object reference id of the provided object. Be careful: the class will be loaded in the emulator if it hasn't been already.
parameter: objid: an object reference id
return: the object's class object reference id \(null if the provided id was 0 \- the null         reference\)
throws: if no object with the provided id exists

## Method: getPC
- return type: `int`

Description: Convenience method to read the IR program counter in the current frame \(top frame of the top context\).
return: 

## Method: getRegisteredNatives
- return type: `java.util.Map<java.lang.String,java.lang.Long>`

Description: Retrieve the list of native methods registered via JNI. This method will throw if native code emulation is disabled.
return: a map; key= is the native Java method signature, value= native address in the         emulated process space

## Method: getSandboxClassLoader
- return type: `java.net.URLClassLoader`

Description: Retrieve the classloader used by the sandbox.
return: 

## Method: getSandboxDropFolder
- return type: `java.io.File`

Description: Retrieve the sandbox folder containing dropped files.
return: the drop box folder, or null if none was set

## Method: getStaticField
- parameter: `fsig`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Retrieve the value of a static field. 

 Note: field resolution is performed, just as the `sget` opcode does. Example: if type Y extends type X, X contains field i, and the caller attempts to read Y.i, this method will resolve the field to X.i.
parameter: fsig: 
return: 
throws: 

## Method: getStringObject
- parameter: `strOrRef`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `java.lang.String`

Description: Retrieve a string by reference.
parameter: strOrRef: 
return: 
throws: 

## Method: getSubRoutineInvocationPolicy
- return type: `int`

Description: Retrieve the emulation policy for invoking sub\-routines.
return: a combination of `SUBEXEC_xxx` flags

## Method: getTimeLeft
- return type: `long`

Description: Retrieve the amount of emulation time left.
return: in ms, always \>= 0

## Method: getTypeAdapter
- return type: `com.pnfsoftware.jeb.core.units.code.android.IJLSTypeAdapter`

Description: Provide the type adapter used by the emulator and sandbox. Only internal, fully\-qualified names are accepted by this adapter, e.g. `Lcom/abc/Foo;`
return: 

## Method: getVariable
- parameter: `varid`, type: `int`
- parameter: `softFail`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Convenience method to read the value of a variable in the current frame \(top frame of the top context\).
parameter: varid: variable id
parameter: softFail: 
return: the value \(non\-null\)
throws: 

## Method: getVariable
- parameter: `varid`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Convenience method to read the value of a variable in the current frame \(top frame of the top context\). The variable must exist.
parameter: varid: variable id
return: the value \(non\-null\)
throws: thrown if the variable is not set

## Method: getWatchdog
- return type: `com.pnfsoftware.jeb.util.concurrent.Watchdog`

Description: 
return: the current watchdog, possibly null

## Method: hasVariable
- parameter: `varid`, type: `int`
- return type: `boolean`

Description: Determine whether a variable is set \(has a value\).
parameter: varid: variable id
return: 
throws: 

## Method: invokeMethod
- parameter: `methodSignature`, type: `java.lang.String`
- parameter: `methodParameters`, type: `java.util.Collection<com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression>`
- parameter: `invokeType`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.DInvokeType`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Invoke \(execute\) a method. The method cannot be a constructor method. If the method is non\-static \(direct or virtual method\), the first element in the method parameters list must be the object itself.
parameter: methodSignature: full signature, e.g. `Lcom/abc/Foo->bar(I)L`
parameter: methodParameters: parameters \(for non\-static methods, the first entry must be the            target object reference\)
parameter: invokeType: invocation type \(it cannot be [NEW](DInvokeType#NEW)\)
return: the returned value \(null for `void` methods\)
throws: 

## Method: invokeMethod
- parameter: `invokeType`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.DInvokeType`
- parameter: `methodSignature`, type: `java.lang.String`
- parameter: `methodParameters`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression[]`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Invoke \(execute\) a method. The method cannot be a constructor method. If the method is non\-static \(direct or virtual method\), the first element in the method parameters list must be the object itself.
parameter: invokeType: invocation type \(it cannot be [NEW](DInvokeType#NEW)\)
parameter: methodSignature: full signature, e.g. `Lcom/abc/Foo->bar(I)L`
parameter: methodParameters: parameters \(for non\-static methods, the first entry must be the            target object reference\)
return: the returned value \(null for `void` methods\)
throws: 

## Method: isEmulatorEnabled
- return type: `boolean`

Description: Determine whether the emulator is enabled. The emulator must be enabled to permit the execution of [IDInstruction#evaluate()](IDInstruction#evaluate()).

## Method: isExceptionHandlingEnabled
- return type: `boolean`

Description: Determine whether handling of exceptions generated by the emulated code is enabled. If not, any exception raised during emulation will bubble up as a [DexDecEvaluationException](DexDecEvaluationException).
return: 

## Method: isInstanceOf
- parameter: `obj`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- parameter: `clz`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `boolean`

Description: Determine whether an object is assignment\-compatible with a class type.
parameter: obj: 
parameter: clz: 
return: 
throws: 

## Method: isLazyJNIOnLoadExec
- return type: `boolean`

Description: 
return: 

## Method: isNativeCodeEmulatorEnabled
- return type: `boolean`

Description: Determine whether the native code emulator is enabled.The native code emulator relies on other JEB modules, mainly the native code analysis pipeline, `gendec` \(JEB's generic decompiler\), and specific analysis plugins \(such as the x86 or arm processors\). The native code emulator must be enabled to allow the emulation of code invoking native routines through JNI \(Java Native Interfaces\).
return: true if the native code emulator is enabled, false otherwise \(note that the initial         setting is likely to be pulled from your dexdec configuration file,         `dexdec-emu.cfg`\)

## Method: isPerformDirectUnreflection
- return type: `boolean`

Description: Determine if direct unreflection is enabled.
return: 

## Method: isRequireNonNullObjectForNonStaticInvoke
- return type: `boolean`

Description: 
return: 

## Method: isSandboxEnabled
- return type: `boolean`

Description: Determine whether the sandbox is enabled.
return: 

## Method: isStrictClassInit
- return type: `boolean`

Description: Determine how the emulator should behave if the initialization of a class failed.
return: if true, if the initialization of a class to be emulated fails, it is fully removed         from the emulator; otherwise, it is kept and considered loaded \(best\-effort\), and the         fields that were initialized before the class\-initializer failed are kept as well as         their values

## Method: loadClass
- parameter: `csig`, type: `java.lang.String`
- return type: `java.lang.Class<?>`

Description: Find, load and initialize a class. The class may be internal \(defined in dex\) or external.
parameter: csig: fully\-qualified signature, e.g. `Lcom/abc/Foo;`
return: the `Class` object
throws: 

## Method: loadClass
- parameter: `csig`, type: `java.lang.String`
- parameter: `initialize`, type: `boolean`
- return type: `java.lang.Class<?>`

Description: Find a class. The class may be internal \(defined in dex\) or external.
parameter: csig: fully\-qualified signature, e.g. `Lcom/abc/Foo;`
parameter: initialize: if true, the class will be initialized
return: the `Class` object
throws: 

## Method: loadNativeLibrary
- parameter: `lib`, type: `com.pnfsoftware.jeb.core.units.codeobject.IELFUnit`
- return type: `com.pnfsoftware.jeb.core.units.code.android.INativeLibrary`

Description: Load \(or retrieve a reference to an already\-loaded\) native SO library. This low\-level method works with a direct ELF unit. For a high\-level version of this method, see [#loadNativeLibrary(String)](#loadNativeLibrary(String)). 

 Upon successful load, the `JNI_OnLoad` method is emulated. The emulator as well as native emulator must be enabled.
parameter: lib: ELF Shared Objec unit located in the project
return: a library description object
throws: 

## Method: loadNativeLibrary
- parameter: `libname`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.units.code.android.INativeLibrary`

Description: Load \(or retrieve a reference to an already\-loaded\) native SO library. This high\-level method is looking for libraries in the APK's standard library folder, `lib/[arch]/`. 

 Upon successful load, the `JNI_OnLoad` method is emulated. The emulator as well as native emulator must be enabled.
parameter: libname: a library name, as provided to a call to [System#loadLibrary(String)](System#loadLibrary(String))
return: a library description object
throws: 

## Method: loadNativeLibrary
- parameter: `libname`, type: `java.lang.String`
- parameter: `isPath`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.android.INativeLibrary`

Description: Load \(or retrieve a reference to an already\-loaded\) native SO library. This high\-level method is looking for libraries in the APK's standard library folder, `lib/[arch]/`. 

 Upon successful load, the `JNI_OnLoad` method is emulated. The emulator as well as native emulator must be enabled.
parameter: libname: a library path or library name
parameter: isPath: if true, the provide name must be a full path; else, it must be a simple            library name of an SO file located in the app's libs folder \(not mentioning the            architecture, 'lib' prefix, or '.so' suffix\)
return: a library description object
throws: 

## Method: pushContext
- parameter: `name`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDEmuContext`

Description: Create and push a new execution context. IR emulation takes place within the top emulation context.
parameter: name: 
return: 

## Method: pushFrame
- parameter: `methodSignature`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDEmuFrame`

Description: Create and push a frame within the current \(top\) emulation context. A frame \(method frame\) contains the current PC, variables, etc.
parameter: methodSignature: 
return: 

## Method: registerEmulatorHooks
- parameter: `hooks`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDEmulatorHooks`
- return type: `int`

Description: Register emulator hooks. Refer to [IDEmulatorHooks](IDEmulatorHooks) for details.
parameter: hooks: an emulator sandbox hooks object
return: the hooks object id

## Method: registerExecutionHelper
- parameter: `helper`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodExecutionHelper`

Description: Register a method execution helper. A helper is preferred over bytecode emulation or sandbox execution. 

 Example: if a helper is provided for `Ljava/lang/String;->indexOf(I)I`, any attempt to emulate `indexOf()` will result in the helper being called. The helper is responsible for providing the result of execution.
parameter: helper: 

## Method: registerNativeEmulatorHooks
- parameter: `hooks`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.emulator.IEEmulatorHooks`
- return type: `int`

Description: Register a native emulator hooks.
parameter: hooks: an evaluation hooks object registered with the native emulator
return: the hooks object id

## Method: registerNativeEmulatorMemoryHooks
- parameter: `hooks`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.IEStateHooks`
- return type: `int`

Description: Register a native emulator memory hooks.
parameter: hooks: an evaluation hooks object registered with the native emulator
return: the hooks object id

## Method: registerObject
- parameter: `o`, type: `java.lang.Object`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Register an object.
parameter: o: 
return: 

## Method: registerSandboxHooks
- parameter: `hooks`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDSandboxHooks`
- return type: `int`

Description: Register sandbox hooks. Refer to [IDSandboxHooks](IDSandboxHooks) for details.
parameter: hooks: an emulator sandbox hooks object
return: the hooks object id

## Method: releaseObject
- parameter: `ref`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- return type: `java.lang.Object`

Description: Release an object currently living in this State. Watch out\! References are not checked. Other objects may use the deleted object.
parameter: ref: 
return: 
throws: 

## Method: setArrayElement
- parameter: `arrayRef`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- parameter: `index`, type: `int`
- parameter: `val`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Write an array element.
parameter: arrayRef: 
parameter: index: 
parameter: val: 
throws: 

## Method: setData
- parameter: `key`, type: `java.lang.String`
- parameter: `value`, type: `java.lang.Object`

Description: Set \(attach\) a piece data to this emulator object.
parameter: key: non\-null key
parameter: value: non\-null value

## Method: setExceptionHandlingEnabled
- parameter: `enabled`, type: `boolean`
- return type: `boolean`

Description: Enable or disable the handling of exceptions generated by the emulated code.
parameter: enabled: 
return: the previous value of this setting

## Method: setExternalPolicy
- parameter: `policy`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.DEmuExternalPolicy`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.DEmuExternalPolicy`

Description: Set an emulation policy for environment\-related, time and date\-related, and other API methods yielding unpredictable results.
parameter: policy: the new policy
return: the former policy \(if any, may be null\)

## Method: setFieldAccessPolicy
- parameter: `fieldAccessPolicy`, type: `int`
- return type: `int`

Description: Set the emulation policy for accessing fields.
parameter: fieldAccessPolicy: a combination of `FIELDACCESS_xxx` flags
return: the previous value of this setting

## Method: setInstanceField
- parameter: `fsig`, type: `java.lang.String`
- parameter: `instance`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`
- parameter: `val`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Update the value of an instance field.
parameter: fsig: 
parameter: instance: 
parameter: val: 
throws: 

## Method: setLazyJNIOnLoadExec
- parameter: `lazy`, type: `boolean`
- return type: `boolean`

Description: 
parameter: lazy: 
return: the previous value of this setting

## Method: setMaxDuration
- parameter: `maxDuration`, type: `long`
- return type: `long`

Description: Set the emulator timeout value. 

 If a run exceeds the timeout, the emulation fails and a [DexDecEvalTimeoutExceededException](DexDecEvalTimeoutExceededException) exception is raised.
parameter: maxDuration: duration in ms \(a negative value means the maximum\)
return: the previous value of this setting

## Method: setMaxInvocationDepth
- parameter: `maxInvocationDepth`, type: `int`
- return type: `int`

Description: Set the maximum depth for method invocations. 

 This attribute is also used as a safety mechanism to prevent stack overflows during emulation.
parameter: maxInvocationDepth: a positive value
return: the previous value of this setting

## Method: setMaxIterationCount
- parameter: `maxInsnCount`, type: `int`
- return type: `int`

Description: Set or reset the max iteration count. 

 If the maximum iteration count is reached, a [DexDecEvalItercountExceededException](DexDecEvalItercountExceededException) exception is be raised.
parameter: maxInsnCount: iteration count \(a negative value means the maximum\)
return: the previous value of this setting

## Method: setPC
- parameter: `pc`, type: `int`

Description: Convenience method to write the IR program counter in the current frame \(top frame of the top context\).
parameter: pc: 

## Method: setPerformDirectUnreflection
- parameter: `performDirectUnreflection`, type: `boolean`
- return type: `boolean`

Description: Enable or disable direct unreflection \(disabled by default\). When enabled, a non\-constructor method invocation or field access \(read, write\) done by reflection, which execution would normally go through the sandbox, will be attempted to be resolved. If the resolution is successful, direct execution may be attempted, thereby saving a potentially costly context\-switch to the sandbox.
parameter: performDirectUnreflection: 
return: the previous value of this setting

## Method: setRequireNonNullObjectForNonStaticInvoke
- parameter: `required`, type: `boolean`
- return type: `boolean`

Description: 
parameter: required: 
return: the previous value of this setting

## Method: setStaticField
- parameter: `fsig`, type: `java.lang.String`
- parameter: `val`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Update the value of a static field. 

 Note: field resolution is performed, just as the `sput` opcode does. Example: if type Y extends type X, X contains field i, and the caller attempts to write Y.i, this method will resolve the field to X.i.
parameter: fsig: 
parameter: val: 
throws: 

## Method: setStrictClassInit
- parameter: `strictClassInit`, type: `boolean`
- return type: `boolean`

Description: Set how the emulator should behave if the initialization of a class failed.
parameter: strictClassInit: if true, if the initialization of a class to be emulated fails, it is            fully removed from the emulator; otherwise, it is kept and considered loaded            \(best\-effort\), and the fields that were initialized before the class\-initializer            failed are kept as well as their values
return: the previous value of this setting

## Method: setSubRoutineInvocationPolicy
- parameter: `subRoutineInvocationPolicy`, type: `int`
- return type: `int`

Description: Set the emulation policy for invoking sub\-routines.
parameter: subRoutineInvocationPolicy: a combination of `SUBEXEC_xxx` flags
return: the previous value of this setting

## Method: setVariable
- parameter: `varid`, type: `int`
- parameter: `value`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDImm`

Description: Convenience method to write the value of a variable in the current frame \(top frame of the top context\).
parameter: varid: variable id
parameter: value: the value to be written
throws: 

## Method: setWatchdog
- parameter: `watchdog`, type: `com.pnfsoftware.jeb.util.concurrent.Watchdog`
- return type: `com.pnfsoftware.jeb.util.concurrent.Watchdog`

Description: Set a watchdog. Similarly to the max\-iteration count or max\-duration limits, the watchdog is regularly checked and an emulation may throw [OperationTimedOutException](OperationTimedOutException) is the watchdog timed\-out.
parameter: watchdog: an optional watchdog
return: the previous value

## Method: shallowCopy
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDState`

Description: Reserved for internal use. 

 Generate a partial copy of this state.
return: 

## Method: unregisterEmulatorHooks
- parameter: `hookId`, type: `int`
- return type: `boolean`

Description: Unregister emulator hooks.
parameter: hookId: hooks object id, returned by [registerEmulatorHooks](#registerEmulatorHooks(IDEmulatorHooks))
return: success indicator

## Method: unregisterExecutionHelper
- parameter: `methodSignature`, type: `java.lang.String`
- return type: `boolean`

Description: Remove a method execution helper.
parameter: methodSignature: 
return: 

## Method: unregisterNativeEmulatorHooks
- parameter: `id`, type: `int`
- return type: `boolean`

Description: Unregister a native emulator hooks.
parameter: id: hooks object id
return: success indicator

## Method: unregisterNativeEmulatorMemoryHooks
- parameter: `id`, type: `int`
- return type: `boolean`

Description: Unregister a native emulator memory hooks.
parameter: id: hooks object id
return: success indicator

## Method: unregisterSandboxHooks
- parameter: `hookId`, type: `int`
- return type: `boolean`

Description: Unregister sandbox hooks.
parameter: hookId: hooks object id, returned by [registerSandboxUserHooks](#registerSandboxHooks(IDSandboxHooks))
return: success indicator

