Package daikon

Class Chicory


  • public class Chicory
    extends Object
    This is the main class for Chicory which transforms the class files of a program to instrument it for Daikon. The instrumentation uses the javaagent switch to java (which allows classes to be instrumented as they are loaded). This class parses the command line arguments, starts java with the javaagent switch on the target program and if requested starts Daikon on the result.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static @Nullable Pattern boot_classes
      Treat classes that match the regex as boot classes (do not instrument).
      static boolean checkStaticInit
      flag to use if we want to turn on the static initialization checks
      static @Nullable File comparability_file
      Decl formatted file containing comparability information.
      static @Nullable File config_dir
      Directory in which to find configuration files.
      static boolean daikon
      Run Daikon in a separate process after Chicory.
      static String daikon_args
      Specifies Daikon arguments to be used if Daikon is run on a generated trace file --daikon or online via a socket --daikon-online.
      static boolean daikon_online
      Send trace information to Daikon over a socket.
      static @MonotonicNonNull Process daikon_proc
      daikon process for --daikon command-line option
      static boolean debug
      Print debug information and save instrumented classes.
      static boolean debug_decl_print
      Print detailed information on variables being observed.
      static boolean debug_ppt_names
      Print information about each ppt name as it is created.
      static boolean debug_transform
      Print detailed information on which classes are transformed.
      static @MonotonicNonNull File dtrace_file
      File in which to put dtrace output.
      static @MonotonicNonNull StreamRedirectThread err_thread
      Thread that copies stderr from target to our stderr.
      static String heap_size
      Heap size for the target program, and for Daikon if Daikon is run.
      static boolean help
      Display usage information.
      static boolean instrument_clinit
      If true, no variable values are printed.
      static int nesting_depth
      Depth to examine structure components.
      static @Nullable Pattern omit_var
      Also see Daikon's --var-omit-pattern command-line argument.
      static @MonotonicNonNull StreamRedirectThread out_thread
      Thread that copies output from target to our output.
      static File output_dir
      Directory in which to create output files.
      static List<Pattern> ppt_omit_pattern
      Suppress program points that match the given regex.
      static List<Pattern> ppt_select_pattern
      Only emit program points that match the given regex.
      static @MonotonicNonNull File premain
      Path to Java agent jar file that performs the transformation.
      static @Nullable File purity_file
      The name of the file to read for a list of pure methods.
      static int sample_start
      When this option is chosen, Chicory will record each program point until that program point has been executed sample-cnt times.
      static long start
      starting time (msecs)
      static boolean std_visibility
      If false, every field in an instrumented class is visible.
      static String synopsis
      Synopsis for the Chicory command line.
      static boolean verbose
      Print information about the classes being transformed.
    • Constructor Summary

      Constructors 
      Constructor Description
      Chicory()  
    • Field Detail

      • help

        public static boolean help
        Display usage information.
      • verbose

        public static boolean verbose
        Print information about the classes being transformed.
      • debug

        public static boolean debug
        Print debug information and save instrumented classes.
      • dtrace_file

        public static @MonotonicNonNull File dtrace_file
        File in which to put dtrace output.
      • comparability_file

        public static @Nullable File comparability_file
        Decl formatted file containing comparability information.
      • output_dir

        public static File output_dir
        Directory in which to create output files.
      • config_dir

        public static @Nullable File config_dir
        Directory in which to find configuration files.
      • daikon

        public static boolean daikon
        Run Daikon in a separate process after Chicory.
      • daikon_online

        public static boolean daikon_online
        Send trace information to Daikon over a socket.
      • daikon_args

        public static String daikon_args
        Specifies Daikon arguments to be used if Daikon is run on a generated trace file --daikon or online via a socket --daikon-online. These arguments will be split on whitespace.
      • heap_size

        public static String heap_size
        Heap size for the target program, and for Daikon if Daikon is run.
      • sample_start

        public static int sample_start
        When this option is chosen, Chicory will record each program point until that program point has been executed sample-cnt times. Chicory will then begin sampling. Sampling starts at 10% and decreases by a factor of 10 each time another sample-cnt samples have been recorded. If sample-cnt is 0, then all calls will be recorded.
      • boot_classes

        public static @Nullable Pattern boot_classes
        Treat classes that match the regex as boot classes (do not instrument).
      • instrument_clinit

        public static boolean instrument_clinit
        If true, no variable values are printed. Static variables are not initialized yet when the routine is entered, and static variable are not necessarily initialized to their final values when the routine is exited. These .dtrace entries are purely for the benefit of tools that use Chicory for program tracing, to determine when methods are entered and exited.
      • nesting_depth

        public static int nesting_depth
        Depth to examine structure components.
      • omit_var

        public static @Nullable Pattern omit_var
        Also see Daikon's --var-omit-pattern command-line argument.
      • std_visibility

        public static boolean std_visibility
        If false, every field in an instrumented class is visible. If true, use standard Java behavior (if the field is in a class in a different package, it is only visible if public, etc.).
      • purity_file

        public static @Nullable File purity_file
        The name of the file to read for a list of pure methods. Should be 1 method per line. Each method should be in the same format as output by the purity analysis.
      • debug_transform

        public static boolean debug_transform
        Print detailed information on which classes are transformed.
      • debug_decl_print

        public static boolean debug_decl_print
        Print detailed information on variables being observed.
      • debug_ppt_names

        public static boolean debug_ppt_names
        Print information about each ppt name as it is created.
      • start

        public static long start
        starting time (msecs)
      • daikon_proc

        public static @MonotonicNonNull Process daikon_proc
        daikon process for --daikon command-line option
    • Constructor Detail

    • Method Detail

      • main

        public static void main​(String[] args)
        Entry point of Chicory.
        Parameters:
        args - see usage for argument descriptions
      • check_args

        public static void check_args​(Options options,
                                      String[] target_args)
        Check the command-line arguments for legality. Prints a message and exits if there was an error.
        Parameters:
        options - set of legal options to Chicory
        target_args - arguments being passed to the target program
      • doPurity

        public static boolean doPurity()
        Return true iff argument was given to run a purity analysis.

        You should only call this after parsing arguments.

      • get_purity_file

        @Pure
        public static @Nullable File get_purity_file()
        Return true iff a file name was specified to supply pure method names.
      • runDaikon

        @EnsuresNonNull("daikon_proc")
        public void runDaikon()
        Runs daikon either online or on the generated trace file.
      • redirect_wait

        public int redirect_wait​(Process p)
        Wait for stream redirect threads to complete and return their exit status.
        Parameters:
        p - the process to wait for completion
        Returns:
        process result
      • elapsed

        public static String elapsed()
        Returns string representation of elapsed time since the start of the program.
        Returns:
        string representation of elapsed time since the start of the program
      • elapsed_msecs

        public static long elapsed_msecs()
        Returns number of milliseconds since the start of the program.
        Returns:
        number of milliseconds since the start of the program
      • args_to_string

        public String args_to_string​(List<String> args)
        Convert a list of arguments into a command-line string. Only used for debugging output.