Class Instrument

  • All Implemented Interfaces:
    ClassFileTransformer

    public class Instrument
    extends InstructionListUtils
    implements ClassFileTransformer
    The Instrument class is responsible for modifying another class' bytecode. Specifically, its main task is to add "hooks" into the other class at method entries and exits for instrumentation purposes.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static SimpleLog debug_transform
      Debug information about which classes are transformed and why.
      • Fields inherited from class StackMapUtils

        debugInstrument, firstLocalIndex, initialLocalsCount, initialTypeList, liveRangeEnd, liveRangeOperandSize, liveRangeStart, liveRangeType, needStackMap, numberActiveLocals, pool, runningOffset, smta, stackMapTable, stackTypes
    • Constructor Summary

      Constructors 
      Constructor Description
      Instrument()
      Create a new Instrument.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dump_code_attributes​(MethodGen mg)  
      static boolean shouldIgnore​(String className, String methodName, String pptName)
      Returns true if the given ppt should be ignored.
      byte @Nullable [] transform​(ClassLoader loader, @InternalForm String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
      Given a class, return a transformed version of the class that contains "hooks" at method entries and exits.
      • Methods inherited from class InstructionListUtils

        append_inst, build_il, calculateLiveLocalTypes, calculateLiveStackTypes, delete_instructions, insertAtMethodStart, insertBeforeHandle, replaceInstructions
      • Methods inherited from class StackMapUtils

        addNewParameter, addString, adjust_code_for_locals_change, bcelCalcStackTypes, buildUninitializedNewMap, create_local_from_live_range, create_method_scope_local, createNewStackMapAttribute, findStackMapEqual, findStackMapIndexAfter, findStackMapIndexBefore, fixLocalVariableTable, gen_locals, gen_locals_from_byte_codes, gen_locals_from_byte_codes, generate_Type_from_StackMapType, generateStackMapTypeFromType, get_attribute_name, get_local_variable_type_table_attribute, getSize, getStackMapTable_attribute, is_local_variable_type_table, isStackMapTable, modifyStackMapsForSwitches, printStackMapTable, remove_local_variable_type_table, set_method_stackTypes, setCurrentStackMapTable, typeToClassGetName, update_full_frameStackMap_entries, updateStackMapOffset, updateUninitializedNewOffsets
    • Field Detail

      • debug_transform

        public static SimpleLog debug_transform
        Debug information about which classes are transformed and why.
    • Constructor Detail

      • Instrument

        public Instrument()
        Create a new Instrument. Sets up debug logging.