trace example

Trace runs the Java language program passed as an argument and generates a trace of its execution. Trace is a simple command line tool that uses the Java Debug Interface (JDI). Programs need not be compiled for debugging since this information is not used.

Trace can be invoked as follows:

        java com.sun.tools.example.trace.Trace options class args
Your classpath must include the JDI Library (see set-up), the path to the compiled trace class files, and the path for the application being traced.

Available options are:

  -output filename   
        Set destination for output trace. By default output
        goes to the terminal.

  -all                 
        Include system classes in output.  By default
        java.*, javax.*, sun.* and com.sun.* events are
        not diplayed.

  -fields
        Also show assignments into fields.

  -help              
        Print a help message

class is the program to trace. args are the arguments to class.

Source for trace

Full source code for trace is included in the trace directory of examples.jar. Source code for these example applications is included to provide concrete examples for debugger developers. Example code may be used, modified and redistributed by debugger developers providing they adhere to the terms in the COPYRIGHT notice.

Building trace

To completely rebuild the trace classes from the provided source files in the trace directory, you need only to compile them. No special options are required, aside from those which set your classpath to include the JDI Library.


[email protected]