Package daikon.chicory
Class DTraceWriter
- Object
-
- DaikonWriter
-
- DTraceWriter
-
public class DTraceWriter extends DaikonWriter
DTraceWriter writes.dtrace
program points to an output stream. It uses the trees created by theDeclWriter
.
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
classClassName
protected static String
stringClassName
-
Fields inherited from class DaikonWriter
lineSep, no_modifiers_ppt
-
-
Constructor Summary
Constructors Constructor Description DTraceWriter(PrintWriter writer)
Initializes the DTraceWriter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clinitEntry(String pptname, int nonceVal)
Prints an entry program point for a static initializer in the dtrace file.void
clinitExit(String pptname, int nonceVal)
Prints an exit program point for a static initializer in the dtrace file.static List<Object>
getFieldValues(Field field, List<Object> theObjects)
Returns a list of values of the field for each Object in theObjects.static List<Object>
getListFromArray(Object arrayVal)
Return a List derived from an aray.static Object
getStaticValue(Field classField)
Similar togetValue(java.lang.reflect.Field, java.lang.Object)
, but used for static fields.static @Nullable List<String>
getTypeNameList(List<Object> theVals)
Returns a list of Strings which are the names of the run-time types in the theVals param.static Object
getValue(Field classField, Object theObj)
Get the value of a certain field in theObj.void
methodEntry(MethodInfo mi, int nonceVal, @Nullable Object obj, Object[] args)
Prints the method entry program point in the dtrace file.void
methodExit(MethodInfo mi, int nonceVal, @Nullable Object obj, Object[] args, Object ret_val, int lineNum)
Prints the method exit program point in the dtrace file.static @Nullable Class<?>
removeWrappers(Object val, Class<?> declared, boolean runtime)
Get the type of val, removing any PrimitiveWrapper if it exists For example, if we execute removeWRappers(val, boolean.class, true) where (val instanceof Runtime.PrimitiveWrapper), then the method returns boolean.class-
Methods inherited from class DaikonWriter
escape, isStaticConstField, methodEntryName, methodEntryName, methodExitName, methodExitName, shouldInstrumentMethod, stdClassName
-
-
-
-
Field Detail
-
classClassName
protected static final String classClassName
- See Also:
- Constant Field Values
-
stringClassName
protected static final String stringClassName
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DTraceWriter
public DTraceWriter(PrintWriter writer)
Initializes the DTraceWriter.- Parameters:
writer
- stream to write to
-
-
Method Detail
-
methodEntry
public void methodEntry(@GuardSatisfied DTraceWriter this, MethodInfo mi, int nonceVal, @Nullable Object obj, Object[] args)
Prints the method entry program point in the dtrace file.
-
clinitEntry
public void clinitEntry(@GuardSatisfied DTraceWriter this, String pptname, int nonceVal)
Prints an entry program point for a static initializer in the dtrace file.
-
methodExit
public void methodExit(@GuardSatisfied DTraceWriter this, MethodInfo mi, int nonceVal, @Nullable Object obj, Object[] args, Object ret_val, int lineNum)
Prints the method exit program point in the dtrace file.
-
clinitExit
public void clinitExit(@GuardSatisfied DTraceWriter this, String pptname, int nonceVal)
Prints an exit program point for a static initializer in the dtrace file.
-
getFieldValues
public static List<Object> getFieldValues(Field field, List<Object> theObjects)
Returns a list of values of the field for each Object in theObjects.- Parameters:
theObjects
- list of Objects, each must have the Field fieldfield
- which field of theObjects we are probing
-
getValue
public static Object getValue(Field classField, Object theObj)
Get the value of a certain field in theObj.- Parameters:
classField
- which field we are interested intheObj
- the object whose field we are examining. TheoObj must be null, Nonsensical, or of a type which contains the field classField.- Returns:
- the value of the classField field in theObj
-
getStaticValue
public static Object getStaticValue(Field classField)
Similar togetValue(java.lang.reflect.Field, java.lang.Object)
, but used for static fields.- Parameters:
classField
- the field whose static value to return- Returns:
- the static value of the field
-
getListFromArray
public static List<Object> getListFromArray(Object arrayVal)
Return a List derived from an aray.- Parameters:
arrayVal
- must be an array type- Returns:
- a List (with correct primitive wrappers) corresponding to the array
-
getTypeNameList
public static @Nullable List<String> getTypeNameList(List<Object> theVals)
Returns a list of Strings which are the names of the run-time types in the theVals param.- Parameters:
theVals
- list of ObjectReferences- Returns:
- a list of Strings which are the names of the run-time types in the theVals param
-
removeWrappers
public static @Nullable Class<?> removeWrappers(Object val, Class<?> declared, boolean runtime)
Get the type of val, removing any PrimitiveWrapper if it exists For example, if we execute removeWRappers(val, boolean.class, true) where (val instanceof Runtime.PrimitiveWrapper), then the method returns boolean.class- Parameters:
val
- the object whose type we are examiningdeclared
- the declared type of the variable corresponding to valruntime
- should we use the run-time type or declared type?- Returns:
- the variable's type, with primitive wrappers removed, or null if the value is non-null
-
-