pnuts.tools
Class TerminalDebugger

java.lang.Object
  extended by pnuts.tools.TerminalDebugger
All Implemented Interfaces:
PnutsParserTreeConstants, CommandListener, ContextFactory, Debugger

public class TerminalDebugger
extends java.lang.Object
implements Debugger, ContextFactory, PnutsParserTreeConstants

This class implements a debugger for Pnuts interpreter. It is used through pnuts -d command.

 Commands:
   stop at [FILE:]LINENO
           Stop execution at the LINENO
   stop in FUNC[:NARGS]
           Stop execution when FUNC is called.
           When NARGS is specified, stop when FUNC with NARGS is called.
   clear
           Clear all breakpoints
   cont
           Continue execution
   trace
           Toggle trace mode
   trace function [FUNC]
           Toggle function call trace mode
   step [NUM]
           Single step NUM lines.  The default number is 1.
   step up
           Step out of the current function
   next [NUM]
           Step NUM line (step OVER calls).  The default number is 1.
   help
           Print a summary of commands
   ?
           Same as help.
  


Field Summary
 
Fields inherited from interface pnuts.lang.PnutsParserTreeConstants
JJTADDNODE, JJTANDNODE, JJTAPPLICATIONNODE, JJTARRAYNODE, JJTARRAYTYPE, JJTASSIGNMENT, JJTASSIGNMENTAA, JJTASSIGNMENTDA, JJTASSIGNMENTEA, JJTASSIGNMENTLA, JJTASSIGNMENTMA, JJTASSIGNMENTOA, JJTASSIGNMENTPA, JJTASSIGNMENTRA, JJTASSIGNMENTRAA, JJTASSIGNMENTSA, JJTASSIGNMENTTA, JJTBLOCK, JJTBREAK, JJTCASTEXPRESSION, JJTCATCHBLOCK, JJTCATCHNODE, JJTCHARACTERNODE, JJTCLASS, JJTCLASSDEF, JJTCLASSDEFBODY, JJTCLASSEXPR, JJTCLASSNAME, JJTCLASSSCRIPT, JJTCONTINUE, JJTDIVIDENODE, JJTDOSTATEMENT, JJTELSEIFNODE, JJTELSENODE, JJTEQUALNODE, JJTEXPRESSIONLIST, JJTEXTENDS, JJTFALSENODE, JJTFIELDDEF, JJTFINALLYBLOCK, JJTFINALLYNODE, JJTFLOATINGNODE, JJTFOREACHSTATEMENT, JJTFORENUM, JJTFORINIT, JJTFORSTATEMENT, JJTFORUPDATE, JJTFUNCTIONSTATEMENT, JJTGENODE, JJTGLOBAL, JJTGTNODE, JJTIDNODE, JJTIFSTATEMENT, JJTIMPLEMENTS, JJTIMPORT, JJTINDEXNODE, JJTINSTANCEOFEXPRESSION, JJTINTEGERNODE, JJTLENODE, JJTLISTELEMENTS, JJTLOCAL, JJTLOGANDNODE, JJTLOGNOTNODE, JJTLOGORNODE, JJTLTNODE, JJTMAPELEMENT, JJTMAPELEMENTS, JJTMEMBERNODE, JJTMETHODDEF, JJTMETHODNODE, JJTMODNODE, JJTMULTIASSIGNLHS, JJTMULTNODE, JJTNEGATIVENODE, JJTNEW, jjtNodeName, JJTNOTEQNODE, JJTNOTNODE, JJTNULLNODE, JJTORNODE, JJTPACKAGE, JJTPACKAGESTATEMENT, JJTPARAM, JJTPARAMLIST, JJTPOSTDECRNODE, JJTPOSTINCRNODE, JJTPREDECRNODE, JJTPREINCRNODE, JJTRANGENODE, JJTRETURN, JJTSHIFTARITHMETICNODE, JJTSHIFTLEFTNODE, JJTSHIFTRIGHTNODE, JJTSTART, JJTSTARTSET, JJTSTATICMEMBERNODE, JJTSTATICMETHODNODE, JJTSTRINGNODE, JJTSUBTRACTNODE, JJTSWITCHBLOCK, JJTSWITCHLABEL, JJTSWITCHSTATEMENT, JJTTERNARYNODE, JJTTHROWNODE, JJTTRUENODE, JJTTRYSTATEMENT, JJTTYPEDPARAM, JJTTYPEDPARAMLIST, JJTVOID, JJTWHILESTATEMENT, JJTXORNODE, JJTYIELD
 
Constructor Summary
TerminalDebugger()
           
TerminalDebugger(java.io.Reader reader)
           
 
Method Summary
 void clearBreakPoints()
          Remove all breakpoints
 Context createContext()
          Create a context
 void removeBreakPoint(java.lang.Object source, int lineno)
          Remove a breakpoint
 void setBreakPoint(java.lang.Object file, int lineno)
          Sets a breakpoint at the specified position
 void setBreakPointInFunction(java.lang.String func_name)
           
 void setBreakPointInFunction(java.lang.String func_name, int nargs)
           
 void signal(CommandEvent event)
          Some kind of event raised, e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TerminalDebugger

public TerminalDebugger()

TerminalDebugger

public TerminalDebugger(java.io.Reader reader)
Parameters:
reader - debug script to read in
Method Detail

createContext

public Context createContext()
Description copied from interface: ContextFactory
Create a context

Specified by:
createContext in interface ContextFactory

setBreakPoint

public void setBreakPoint(java.lang.Object file,
                          int lineno)
Sets a breakpoint at the specified position

Specified by:
setBreakPoint in interface Debugger
Parameters:
file - the script file
lineno - the line number

setBreakPointInFunction

public void setBreakPointInFunction(java.lang.String func_name)

setBreakPointInFunction

public void setBreakPointInFunction(java.lang.String func_name,
                                    int nargs)

removeBreakPoint

public void removeBreakPoint(java.lang.Object source,
                             int lineno)
Description copied from interface: Debugger
Remove a breakpoint

Specified by:
removeBreakPoint in interface Debugger

clearBreakPoints

public void clearBreakPoints()
Description copied from interface: Debugger
Remove all breakpoints

Specified by:
clearBreakPoints in interface Debugger

signal

public void signal(CommandEvent event)
Description copied from interface: CommandListener
Some kind of event raised, e.g. the line number has changed.

Specified by:
signal in interface CommandListener