Package jisd.debug
Class Debugger
- java.lang.Object
-
- jisd.debug.Debugger
-
public class Debugger extends java.lang.Object
The JISDLab's main debugger.
-
-
Field Summary
Fields Modifier and Type Field Description static int
defaultSleepTime
Default sleep time when executes run()/cont()/restart()
-
Constructor Summary
Constructors Constructor Description Debugger(int port)
Debugger(int port, boolean usesProbeJ)
Debugger(java.lang.String host, int port)
Debugger(java.lang.String host, int port, boolean usesProbeJ)
Debugger(java.lang.String main, java.lang.String options)
Debugger(java.lang.String main, java.lang.String options, boolean usesProbeJ)
Debugger(java.lang.String main, java.lang.String options, int port, boolean usesProbeJ)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear(int lineNumber)
Remove breakpoint with a line number.void
clear(java.lang.String methodName)
Remove breakpoint with a method name.void
clear(java.lang.String className, int lineNumber)
Remove breakpoint with a class name and a line number.void
clear(java.lang.String className, java.lang.String methodName)
Remove breakpoint with a class name and a method name.void
clearExporters()
Clear all exportersvoid
clearResults()
Clear debug results all.java.lang.String
cont()
Continue execution from breakpointjava.lang.String
cont(int sleepTime)
Continue execution from breakpointjava.util.HashMap<java.lang.String,DebugResult>
drs()
Get DebugResults at the current location (alias of getCurrentDebugResults())void
exit()
Shutdown the debugger.java.lang.String
finish()
Execute "step out"/"step return"java.lang.String
finish(int times)
Execute "step out"/"step return" multiple timesjava.util.HashMap<java.lang.String,DebugResult>
getCurrentDebugResults()
Get DebugResults at the current locationstatic int
getDefaultSleepTime()
Default sleep time when executes run()/cont()/restart()java.util.List<IExporter>
getExporters()
observer(exporter)java.lang.String
getHost()
java.lang.String
getMain()
java.lang.String
getOptions()
java.util.ArrayList<Point>
getPoints()
Get observation points.int
getPort()
java.util.ArrayList<DebugResult>
getResults()
Get debug results.java.util.ArrayList<DebugResult>
getResults(java.lang.String varName)
Get debug results a variable name matches.java.util.List<java.lang.String>
getSrcDir()
VMManager
getVmManager()
VM managerjava.lang.String
list()
Print source codejava.lang.String
list(java.lang.String srcDir)
Print source codeLocation
loc()
Return a current file location.void
locals()
Print all local variables in current stack framejava.lang.String
next()
Execute "step over"java.lang.String
next(int times)
Execute "step over" multiple timesint
notifyExporters(ValueInfo valueInfo)
Notify all exporters to update debug datavoid
quit()
Shutdown the debugger.(alias of exit())Debugger
redef()
Redefine the debugger so that the parameters are the same (breakpoints NOT inherited).
Inherited parameters: main options host port break or probe srcDir exportersvoid
removeExporter(IExporter exporter)
Remove an exportervoid
reset()
Reset this debugger own (breakpoints NOT inherited).java.lang.String
restart()
Restart the debugger at once.(equals to restart(0))java.lang.String
restart(int sleepTime)
Restart the debugger (breakpoints inherited).java.lang.String
run()
Start up the debugger.(equals to run(0))java.lang.String
run(int sleepTime)
Start up the debugger.static void
setDefaultSleepTime(int defaultSleepTime)
Default sleep time when executes run()/cont()/restart()void
setExporter(IExporter exporter)
Set an exportervoid
setHost(java.lang.String host)
void
setMain(java.lang.String main)
void
setOptions(java.lang.String options)
void
setPort(int port)
void
setSrcDir(java.lang.String... paths)
java.lang.String
step()
Execute "step in"/"step into"java.lang.String
step(int times)
Execute "step in"/"step into" multiple timesjava.lang.String
stepIn()
Execute "step in"/"step into" (alias of step())java.lang.String
stepIn(int times)
Execute "step in"/"step into" multiple times (alias of step(times))java.lang.String
stepInto()
Execute "step in"/"step into" (alias of step())java.lang.String
stepInto(int times)
Execute "step in"/"step into" multiple times (alias of step(times))java.lang.String
stepOut()
Execute "step out"/"step return" (alias of finish())java.lang.String
stepOut(int times)
Execute "step out"/"step return" multiple times (alias of finish(times))java.lang.String
stepOver()
Execute "step over" (alias of next())java.lang.String
stepOver(int times)
Execute "step over" multiple times (alias of next(times))java.lang.String
stepReturn()
Execute "step out"/"step return" (alias of finish())java.lang.String
stepReturn(int times)
Execute "step out"/"step return" multiple times (alias of finish(times))java.util.Optional<Point>
stopAt(int lineNumber)
Set a breakpoint by a line number.java.util.Optional<Point>
stopAt(int lineNumber, java.lang.String[] varNames)
Set a breakpoint by a line number.java.util.Optional<Point>
stopAt(java.lang.String methodName)
Set a breakpoint by a method name.java.util.Optional<Point>
stopAt(java.lang.String className, int lineNumber)
Set a breakpoint by a line number.java.util.Optional<Point>
stopAt(java.lang.String className, int lineNumber, java.lang.String[] varNames)
Set a breakpoint by a line number.java.util.Optional<Point>
stopAt(java.lang.String className, java.lang.String methodName)
Set a breakpoint by a method name.java.util.Optional<Point>
stopAt(java.lang.String methodName, java.lang.String[] varNames)
Set a breakpoint by a method name.java.util.Optional<Point>
stopAt(java.lang.String className, java.lang.String methodName, java.lang.String[] varNames)
Set a breakpoint by a method name.com.sun.jdi.ThreadReference
thread()
java.lang.String
uri()
Return a string which represents the current file location by VSCode-like format.java.lang.String
uri(int lineNumber)
Return current file location by VSCode-like format.java.lang.String
uri(Location loc, int lineNumber)
Return a string which represents the current file location by VSCode-like format.void
vars()
Print all variables in current stack framejava.util.Optional<Point>
watch(int lineNumber)
Set a watchpoint by a line number.java.util.Optional<Point>
watch(int lineNumber, java.lang.String[] varNames)
Set a watchpoint by a line number.java.util.Optional<Point>
watch(java.lang.String methodName)
Set a watchpoint by a method name.java.util.Optional<Point>
watch(java.lang.String className, int lineNumber)
Set a watchpoint by a line number.java.util.Optional<Point>
watch(java.lang.String className, int lineNumber, java.lang.String[] varNames)
Set a watchpoint or a probepoint by a line number.java.util.Optional<Point>
watch(java.lang.String className, java.lang.String methodName)
Set a watchpoint by a method name.java.util.Optional<Point>
watch(java.lang.String methodName, java.lang.String[] varNames)
Set a watchpoint by a method name.java.util.Optional<Point>
watch(java.lang.String className, java.lang.String methodName, java.lang.String[] varNames)
Set a watchpoint by a method name.void
where()
Print stacktrace in current stack frame.
-
-
-
Constructor Detail
-
Debugger
public Debugger(java.lang.String main, java.lang.String options)
-
Debugger
public Debugger(java.lang.String main, java.lang.String options, boolean usesProbeJ)
-
Debugger
public Debugger(java.lang.String main, java.lang.String options, int port, boolean usesProbeJ)
-
Debugger
public Debugger(int port)
-
Debugger
public Debugger(java.lang.String host, int port)
-
Debugger
public Debugger(int port, boolean usesProbeJ)
-
Debugger
public Debugger(java.lang.String host, int port, boolean usesProbeJ)
-
-
Method Detail
-
setPort
public void setPort(int port)
-
setSrcDir
public void setSrcDir(java.lang.String... paths)
-
setExporter
public void setExporter(IExporter exporter)
Set an exporter
-
notifyExporters
public int notifyExporters(ValueInfo valueInfo)
Notify all exporters to update debug data
-
clearExporters
public void clearExporters()
Clear all exporters
-
removeExporter
public void removeExporter(IExporter exporter)
Remove an exporter
-
stopAt
public java.util.Optional<Point> stopAt(int lineNumber)
Set a breakpoint by a line number.
-
stopAt
public java.util.Optional<Point> stopAt(int lineNumber, java.lang.String[] varNames)
Set a breakpoint by a line number.
-
stopAt
public java.util.Optional<Point> stopAt(java.lang.String className, int lineNumber)
Set a breakpoint by a line number.
-
stopAt
public java.util.Optional<Point> stopAt(java.lang.String className, int lineNumber, java.lang.String[] varNames)
Set a breakpoint by a line number.
-
stopAt
public java.util.Optional<Point> stopAt(java.lang.String methodName)
Set a breakpoint by a method name.
-
stopAt
public java.util.Optional<Point> stopAt(java.lang.String methodName, java.lang.String[] varNames)
Set a breakpoint by a method name.
-
stopAt
public java.util.Optional<Point> stopAt(java.lang.String className, java.lang.String methodName)
Set a breakpoint by a method name.
-
stopAt
public java.util.Optional<Point> stopAt(java.lang.String className, java.lang.String methodName, java.lang.String[] varNames)
Set a breakpoint by a method name.
-
watch
public java.util.Optional<Point> watch(int lineNumber)
Set a watchpoint by a line number.
-
watch
public java.util.Optional<Point> watch(int lineNumber, java.lang.String[] varNames)
Set a watchpoint by a line number.
-
watch
public java.util.Optional<Point> watch(java.lang.String className, int lineNumber)
Set a watchpoint by a line number.
-
watch
public java.util.Optional<Point> watch(java.lang.String className, int lineNumber, java.lang.String[] varNames)
Set a watchpoint or a probepoint by a line number.
-
watch
public java.util.Optional<Point> watch(java.lang.String methodName)
Set a watchpoint by a method name.
-
watch
public java.util.Optional<Point> watch(java.lang.String methodName, java.lang.String[] varNames)
Set a watchpoint by a method name.
-
watch
public java.util.Optional<Point> watch(java.lang.String className, java.lang.String methodName)
Set a watchpoint by a method name.
-
watch
public java.util.Optional<Point> watch(java.lang.String className, java.lang.String methodName, java.lang.String[] varNames)
Set a watchpoint by a method name.
-
step
public java.lang.String step()
Execute "step in"/"step into"- Returns:
-
step
public java.lang.String step(int times)
Execute "step in"/"step into" multiple times- Returns:
-
stepIn
public java.lang.String stepIn()
Execute "step in"/"step into" (alias of step())- Returns:
-
stepIn
public java.lang.String stepIn(int times)
Execute "step in"/"step into" multiple times (alias of step(times))- Returns:
-
stepInto
public java.lang.String stepInto()
Execute "step in"/"step into" (alias of step())- Returns:
-
stepInto
public java.lang.String stepInto(int times)
Execute "step in"/"step into" multiple times (alias of step(times))- Returns:
-
next
public java.lang.String next()
Execute "step over"- Returns:
-
next
public java.lang.String next(int times)
Execute "step over" multiple times- Returns:
-
stepOver
public java.lang.String stepOver()
Execute "step over" (alias of next())- Returns:
-
stepOver
public java.lang.String stepOver(int times)
Execute "step over" multiple times (alias of next(times))- Returns:
-
finish
public java.lang.String finish()
Execute "step out"/"step return"- Returns:
-
finish
public java.lang.String finish(int times)
Execute "step out"/"step return" multiple times- Returns:
-
stepOut
public java.lang.String stepOut()
Execute "step out"/"step return" (alias of finish())- Returns:
-
stepOut
public java.lang.String stepOut(int times)
Execute "step out"/"step return" multiple times (alias of finish(times))- Returns:
-
stepReturn
public java.lang.String stepReturn()
Execute "step out"/"step return" (alias of finish())- Returns:
-
stepReturn
public java.lang.String stepReturn(int times)
Execute "step out"/"step return" multiple times (alias of finish(times))- Returns:
-
cont
public java.lang.String cont()
Continue execution from breakpoint
-
cont
public java.lang.String cont(int sleepTime)
Continue execution from breakpoint
-
list
public java.lang.String list(java.lang.String srcDir)
Print source code
-
list
public java.lang.String list()
Print source code
-
locals
public void locals()
Print all local variables in current stack frame
-
vars
public void vars()
Print all variables in current stack frame
-
drs
public java.util.HashMap<java.lang.String,DebugResult> drs()
Get DebugResults at the current location (alias of getCurrentDebugResults())
-
getCurrentDebugResults
public java.util.HashMap<java.lang.String,DebugResult> getCurrentDebugResults()
Get DebugResults at the current location
-
where
public void where()
Print stacktrace in current stack frame.
-
loc
public Location loc()
Return a current file location.
-
uri
public java.lang.String uri()
Return a string which represents the current file location by VSCode-like format.
-
uri
public java.lang.String uri(Location loc, int lineNumber)
Return a string which represents the current file location by VSCode-like format.
-
uri
public java.lang.String uri(int lineNumber)
Return current file location by VSCode-like format.
-
clear
public void clear(int lineNumber)
Remove breakpoint with a line number.
-
clear
public void clear(java.lang.String className, int lineNumber)
Remove breakpoint with a class name and a line number.
-
clear
public void clear(java.lang.String methodName)
Remove breakpoint with a method name.- Parameters:
methodName
- A method name in a target java file
-
clear
public void clear(java.lang.String className, java.lang.String methodName)
Remove breakpoint with a class name and a method name.
-
run
public java.lang.String run()
Start up the debugger.(equals to run(0))
-
run
public java.lang.String run(int sleepTime)
Start up the debugger.- Parameters:
sleepTime
- Wait time after the debugger starts running
-
exit
public void exit()
Shutdown the debugger.
-
quit
public void quit()
Shutdown the debugger.(alias of exit())
-
restart
public java.lang.String restart()
Restart the debugger at once.(equals to restart(0))
-
restart
public java.lang.String restart(int sleepTime)
Restart the debugger (breakpoints inherited).- Parameters:
sleepTime
- Wait time after the debugger starts running
-
redef
public Debugger redef()
Redefine the debugger so that the parameters are the same (breakpoints NOT inherited).
Inherited parameters:- main
- options
- host
- port
- break or probe
- srcDir
- exporters
-
reset
public void reset()
Reset this debugger own (breakpoints NOT inherited).
-
clearResults
public void clearResults()
Clear debug results all.
-
getResults
public java.util.ArrayList<DebugResult> getResults()
Get debug results.- Returns:
- Debug results
-
getResults
public java.util.ArrayList<DebugResult> getResults(java.lang.String varName)
Get debug results a variable name matches.- Parameters:
varName
- variable name- Returns:
- Debug results
-
getPoints
public java.util.ArrayList<Point> getPoints()
Get observation points.- Returns:
- observation points
-
thread
public com.sun.jdi.ThreadReference thread()
-
getDefaultSleepTime
public static int getDefaultSleepTime()
Default sleep time when executes run()/cont()/restart()
-
setDefaultSleepTime
public static void setDefaultSleepTime(int defaultSleepTime)
Default sleep time when executes run()/cont()/restart()
-
getMain
public java.lang.String getMain()
-
getOptions
public java.lang.String getOptions()
-
setMain
public void setMain(java.lang.String main)
-
setOptions
public void setOptions(java.lang.String options)
-
getVmManager
public VMManager getVmManager()
VM manager
-
getExporters
public java.util.List<IExporter> getExporters()
observer(exporter)
-
getPort
public int getPort()
-
getHost
public java.lang.String getHost()
-
setHost
public void setHost(java.lang.String host)
-
getSrcDir
public java.util.List<java.lang.String> getSrcDir()
-
-