public class ReferenceTracingValueFactory extends java.lang.Object implements InstructionVisitor, ValueFactory
ValueFactory tags newly created reference values so they can be traced
throughout the execution of a method.TracedReferenceValue,
InstructionOffsetValue| Constructor and Description |
|---|
ReferenceTracingValueFactory(ValueFactory valueFactory)
Creates a new ReferenceTracingValueFactory that attaches instruction
offset values based on being used as an instruction visitor.
|
ReferenceTracingValueFactory(ValueFactory valueFactory,
boolean preserveTraceValueOnCasts)
Creates a new ReferenceTracingValueFactory that attaches instruction
offset values based on being used as an instruction visitor.
|
| Modifier and Type | Method and Description |
|---|---|
TracedReferenceValue |
cast(TracedReferenceValue referenceValue,
java.lang.String type,
Clazz referencedClass,
boolean alwaysCast)
Casts a given traced reference value to the given type, either keeping
its trace value or setting a new one.
|
ReferenceValue |
createArrayReferenceValue(java.lang.String type,
Clazz referencedClass,
IntegerValue arrayLength)
Creates a new ReferenceValue that represents a non-null array with
elements of the given type, with the given length.
|
ReferenceValue |
createArrayReferenceValue(java.lang.String type,
Clazz referencedClass,
IntegerValue arrayLength,
Value elementValue)
Creates a new ReferenceValue that represents an array with elements of
the given type, with the given length and initial element values.
|
DoubleValue |
createDoubleValue()
Creates a new DoubleValue with an undefined value.
|
DoubleValue |
createDoubleValue(double value)
Creates a new DoubleValue with a given particular value.
|
FloatValue |
createFloatValue()
Creates a new FloatValue with an undefined value.
|
FloatValue |
createFloatValue(float value)
Creates a new FloatValue with a given particular value.
|
IntegerValue |
createIntegerValue()
Creates a new IntegerValue with an undefined value.
|
IntegerValue |
createIntegerValue(int value)
Creates a new IntegerValue with a given particular value.
|
IntegerValue |
createIntegerValue(int min,
int max)
Creates a new IntegerValue with a given possible range.
|
LongValue |
createLongValue()
Creates a new LongValue with an undefined value.
|
LongValue |
createLongValue(long value)
Creates a new LongValue with a given particular value.
|
ReferenceValue |
createReferenceValue()
Creates a new ReferenceValue of an undefined type.
|
ReferenceValue |
createReferenceValue(java.lang.String type,
Clazz referencedClass,
boolean mayBeExtension,
boolean mayBeNull)
Creates a new ReferenceValue that represents the given type.
|
ReferenceValue |
createReferenceValue(java.lang.String type,
Clazz referencedClass,
boolean mayBeExtension,
boolean mayBeNull,
Clazz creationClass,
Method creationMethod,
int creationOffset)
Creates a new ReferenceValue that represents the given type, created at the
specified code location.
|
ReferenceValue |
createReferenceValue(java.lang.String type,
Clazz referencedClass,
boolean mayBeExtension,
boolean mayBeNull,
Clazz creationClass,
Method creationMethod,
int creationOffset,
java.lang.Object value)
Creates a new ReferenceValue that represents the given type, created at the
specified code location.
|
ReferenceValue |
createReferenceValue(java.lang.String type,
Clazz referencedClass,
boolean mayBeExtension,
boolean mayBeNull,
java.lang.Object value)
Creates a new ReferenceValue that represents the given type.
|
ReferenceValue |
createReferenceValueForId(java.lang.String type,
Clazz referencedClass,
boolean mayBeExtension,
boolean mayBeNull,
java.lang.Object id)
Creates a new ReferenceValue that represents the given type with a specified ID.
|
ReferenceValue |
createReferenceValueForId(java.lang.String type,
Clazz referencedClass,
boolean mayBeExtension,
boolean mayBeNull,
java.lang.Object id,
java.lang.Object value)
Creates a new ReferenceValue that represents the given type with a specified ID.
|
ReferenceValue |
createReferenceValueNull()
Creates a new ReferenceValue that represents
null. |
Value |
createValue(java.lang.String type,
Clazz referencedClass,
boolean mayBeExtension,
boolean mayBeNull)
Creates a new Value of the given type.
|
void |
setTraceValue(Value traceValue) |
ReferenceValue |
trace(ReferenceValue referenceValue)
Attaches the current trace value to given reference value.
|
Value |
trace(Value value)
Attaches the current trace value to given value, if it is a reference
value.
|
void |
visitAnyInstruction(Clazz clazz,
Method method,
CodeAttribute codeAttribute,
int offset,
Instruction instruction)
Visits any Instruction instance.
|
void |
visitConstantInstruction(Clazz clazz,
Method method,
CodeAttribute codeAttribute,
int offset,
ConstantInstruction constantInstruction) |
void |
visitSimpleInstruction(Clazz clazz,
Method method,
CodeAttribute codeAttribute,
int offset,
SimpleInstruction simpleInstruction) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvisitAnySwitchInstruction, visitBranchInstruction, visitLookUpSwitchInstruction, visitTableSwitchInstruction, visitVariableInstructioncreateReferenceValue, createReferenceValuepublic ReferenceTracingValueFactory(ValueFactory valueFactory)
cast(proguard.evaluation.value.TracedReferenceValue, java.lang.String, proguard.classfile.Clazz, boolean) method.valueFactory - the value factory that creates the actual values.public ReferenceTracingValueFactory(ValueFactory valueFactory, boolean preserveTraceValueOnCasts)
valueFactory - the value factory that creates the
actual values.preserveTraceValueOnCasts - specifies whether to preserve the
trace value for reference values that
are passed to the cast(proguard.evaluation.value.TracedReferenceValue, java.lang.String, proguard.classfile.Clazz, boolean) method.public void setTraceValue(Value traceValue)
public TracedReferenceValue cast(TracedReferenceValue referenceValue, java.lang.String type, Clazz referencedClass, boolean alwaysCast)
public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction)
InstructionVisitorvisitAnyInstruction in interface InstructionVisitorpublic void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
visitSimpleInstruction in interface InstructionVisitorpublic void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
visitConstantInstruction in interface InstructionVisitorpublic Value createValue(java.lang.String type, Clazz referencedClass, boolean mayBeExtension, boolean mayBeNull)
ValueFactorycreateValue in interface ValueFactorypublic IntegerValue createIntegerValue()
ValueFactorycreateIntegerValue in interface ValueFactorypublic IntegerValue createIntegerValue(int value)
ValueFactorycreateIntegerValue in interface ValueFactorypublic IntegerValue createIntegerValue(int min, int max)
ValueFactorycreateIntegerValue in interface ValueFactorypublic LongValue createLongValue()
ValueFactorycreateLongValue in interface ValueFactorypublic LongValue createLongValue(long value)
ValueFactorycreateLongValue in interface ValueFactorypublic FloatValue createFloatValue()
ValueFactorycreateFloatValue in interface ValueFactorypublic FloatValue createFloatValue(float value)
ValueFactorycreateFloatValue in interface ValueFactorypublic DoubleValue createDoubleValue()
ValueFactorycreateDoubleValue in interface ValueFactorypublic DoubleValue createDoubleValue(double value)
ValueFactorycreateDoubleValue in interface ValueFactorypublic ReferenceValue createReferenceValue()
ValueFactorycreateReferenceValue in interface ValueFactorypublic ReferenceValue createReferenceValueNull()
ValueFactorynull.createReferenceValueNull in interface ValueFactorypublic ReferenceValue createReferenceValue(java.lang.String type, Clazz referencedClass, boolean mayBeExtension, boolean mayBeNull)
ValueFactorynull, the ReferenceValue represents null.createReferenceValue in interface ValueFactorypublic ReferenceValue createReferenceValue(java.lang.String type, Clazz referencedClass, boolean mayBeExtension, boolean mayBeNull, java.lang.Object value)
ValueFactorynull, the ReferenceValue represents null.
The object is the actual value of the reference during execution (can be null).createReferenceValue in interface ValueFactorypublic ReferenceValue createReferenceValue(java.lang.String type, Clazz referencedClass, boolean mayBeExtension, boolean mayBeNull, Clazz creationClass, Method creationMethod, int creationOffset)
ValueFactorynull, the ReferenceValue represents null.
The object is the actual value of the reference during execution (can be null).createReferenceValue in interface ValueFactorypublic ReferenceValue createReferenceValue(java.lang.String type, Clazz referencedClass, boolean mayBeExtension, boolean mayBeNull, Clazz creationClass, Method creationMethod, int creationOffset, java.lang.Object value)
ValueFactorynull, the ReferenceValue represents null.
The object is the actual value of the reference during execution (can be null).createReferenceValue in interface ValueFactorypublic ReferenceValue createReferenceValueForId(java.lang.String type, Clazz referencedClass, boolean mayBeExtension, boolean mayBeNull, java.lang.Object id)
ValueFactorynull, the ReferenceValue represents null.createReferenceValueForId in interface ValueFactorypublic ReferenceValue createReferenceValueForId(java.lang.String type, Clazz referencedClass, boolean mayBeExtension, boolean mayBeNull, java.lang.Object id, java.lang.Object value)
ValueFactorynull, the ReferenceValue represents null.
The object is the actual value of the reference during execution (can be null).createReferenceValueForId in interface ValueFactorypublic ReferenceValue createArrayReferenceValue(java.lang.String type, Clazz referencedClass, IntegerValue arrayLength)
ValueFactorycreateArrayReferenceValue in interface ValueFactorypublic ReferenceValue createArrayReferenceValue(java.lang.String type, Clazz referencedClass, IntegerValue arrayLength, Value elementValue)
createArrayReferenceValue in interface ValueFactorypublic Value trace(Value value)
public ReferenceValue trace(ReferenceValue referenceValue)