Specification

Classes

Class Description
StackTraceVisualizer Launches the tracer and graphical user interface.
Tracer Communicates with the debugger and generates the stack trace.
TreeGUI Opens the graphical user interface that displays the stack tree.
StackEvent A data carrier class that holds stack event data.
TreeNode A data carrier class that holds tree node data.
ProcessRunner A runnable container to run a process on a separate thread.

Methods

StackTraceVisualizer

Method Description
public static void main(String[]) Runs the tracer.
private static void exit() Exits the program.

Tracer

Method Description
public Tracer(String) The Tracer constructor.
public Tracer(String, boolean) The Tracer constructor with a compiler flag.
public void closeWindow() Closes the TreeGUI window.
private int findPort() Finds an open port.
private void getOutputs() Gets the debugger output.
private Process getShell(File) Gets the shell process.
private PrintWriter getSTDIN() Gets the STDIN of jdb.
private Scanner getSTDOUT() Gets the STDOUT of jdb.
private void runCompiler() Runs the compiler.
private void runProgram() Runs the program.
public void runTrace() Gets the stack trace.
private void writeCommands(List<String>) Writes the specified command to the program.
private void writeToConsole(String) Writes a single line to the console.

TreeGUI (extends JFrame)

Method Description
public TreeGUI(String) The TreeGUI constructor.
private void expand(String, TreeNode) Expands a node on the graphical UI.
private DefaultTreeModel getModel() Gets the model.
private Stack<TreeNode> getStack(String) Gets the stack.
private DefaultMutableTreeNode newNode(StackEvent) Creates a new node.
private void onSelected() The callback function that runs when a node is clicked.
public void popIn(String, String) Jumps a layer into the stack.
public void popOut(String, String) Jumps out of a layer on the stack.
private void resizeToFit() Resizes the window to fit.

StackEvent

Method Description
public StackEvent(String, String) The StackEvent constructor.
public String getEventMethod() Gets the event method name.
public void setEventMethod(String) Sets the event method name.
public String getThread() Gets the event thread name.
public void setThread(String) Sets the event thread name.
public String getReturnValue() Gets the event return value.
public void setReturnValue(String) Sets the event return value.
public long getTime() Gets the event execution time.
public String toString() Returns a stringified version of the object.

TreeNode

Method Description
public TreeNode(StackEvent, TreeNode, DefaultMutableTreeNode) The TreeNode constructor.
public TreeNode getParent() Gets the parent node.
public void setParent(TreeNode) Sets the parent node.
public StackEvent getEvent() Gets the stack event.
public void setEvent(StackEvent) Sets the node stack event.
public DefaultMutableTreeNode getNode() Gets the current node.
public void setNode(DefaultMutableTreeNode) Sets the current node.

ProcessRunner

Method Description
public ProcessRunner(ProcessBuilder) The ProcessRunner constructor.
public void run() Runs the process specified in the constructor.

Class Diagram

Class Diagram