![]() |
JSwat ProjectTesting the Commands |
Much of the supported functionality of JSwat is available via typed commands.
Shows the about information for JSwat.
about
- shows program about information.help about
Create a command alias, or display alias definitions.
alias
- shows all defined aliases.alias <name>
- shows the defined
alias.alias <bad-name>
- indicates that the
named alias is not defined.alias <name> <definition>
- defines
an alias with the given name. Invoking the alias by typing its
name at the command input prompt should run the alias
definition.help alias
Searches the command descriptions for keywords.
apropos
- complains about missing arguments.apropos nothere
- shows nothing.apropos thread
- shows commands involving threads.help apropos
Attach remotely to a running VM.
attach
- attempts to reconnect using previous
values.attach <port>
- connects to the running
VM.attach <host:port>
- connects to the
running VM.attach <host>
- displays error about
missing arguments.help attach
Show information regarding a breakpoint.
brkinfo
- complains about missing arguments.brkinfo abc
- complains about invalid breakpoint number format.brkinfo 12345
- indicates no such breakpoint.brkinfo 1
- shows details about breakpoint '1'.help brkinfo
Break when the specified exception is thrown.
catch
- displays error about missing
arguments.catch <exception>
- sets a breakpoint to
stop all threads when the exception is thrown.catch go <exception>
- sets a breakpoint
to report when the exception is thrown.catch thread <exception>
- sets a
breakpoint to stop the event thread when the exception is
thrown.help catch
Display information about a class or interface.
class
- complains about missing arguments.class <class>
- if not active, complains
about inactive session.class <bad-class>
- if active, complains
about unknown class 'o'.class *<class>
- if active, displays the
definition of the class that matches the wild-carded name,
including superclass, supported interfaces, and inner
classes.class <class>*
- if active, displays the
definition of the class that matches the wild-carded name,
including superclass, supported interfaces, and inner
classes.class <class>
- if active, displays the
definition of the named class, including superclass, supported
interfaces, and inner classes.help class
List all classes loaded in the debuggee VM.
classes
- if not active, complains about
inactive session.classes
- displays all loaded classes.classes *<class>
- displays all loaded classes
that match the wild-carded name.classes <class>*
- displays all loaded classes
that match the wild-carded name.help classes
Displays or sets the classpath of the debuggee VM.
classpath
- displays classpath.classpath <path>
- if active, complains
that classpath cannot be set while session is active.classpath <path>
- changes classpath to
that given.classpath "<path space>"
-
changes classpath to that given in quotes (with a space in the
path).help classpath
Clear a breakpoint.
clear
- displays defined breakpoints.clear abc123
- complains about invalid
breakpoint (bad number format).clear <bad-n>
- complains about invalid
breakpoint (it does not exist).clear <n>
- clears the given
breakpoint.help clear
Closes the currently active debugging session.
close
- if not active, complains about inactive
session.close
- if active, closes the active
session.help close
Add or remove conditions from breakpoints.
condition
- complains about missing arguments.condition duh "condition" 12345
- indicates no such breakpoint.condition duh "condition" 1
- complains about poorly formatted condition expression.condition duh "var = val" 1
- complains about unknown action.condition add "var = val" 1
- adds the given condition to breakpoint '1'.condition del "var = val" 1
- removes the given condition from breakpoint '1'.help condition
Detaches from the remote VM without terminating it.
detach
- if not active, complains about inactive
session.detach
- if active, detaches from the remote
debuggee.help detach
Disables a breakpoint.
disable
- displays defined breakpoints.disable abc123
- complains about invalid
breakpoint (bad number format).disable <bad-n>
- complains about invalid
breakpoint (it does not exist).disable <n>
- disables the given
breakpoint.help disable
Disables garbage collection for an object.
disablegc
- if not active, complains about
inactive session.disablegc
- if active, complains about missing
arguments.disablegc <obj>
- if active, complains
that current thread is not set.disablegc <obj>
- if active and thread
set, complains about invalid stack frame (because the thread is
not running yet).disablegc <obj>
- if active and thread
running, complains that current thread is not suspended.disablegc <obj>
- if active, thread
suspended, and native method, complains about native method.disablegc <bad-obj>
- if active and thread
suspended, complains that object was not found.disablegc <obj>
- if active, thread
suspended, and no variable information, complains.disablegc <obj>
- if active and thread
suspended and object exists, disables garbage collection on
object.help disablegc
Move down the stack frame.
down
- if not active, complains about inactive
session.down
- if active but no current thread,
complains about current thread not being set.down
- if active and thread set, complains about
invalid stack frame (because thread has no stack yet)down
- if active, thread set, and thread
running,down
- if active, thread set and suspended,
moves one frame down.down 1000
- if active, thread set and suspended,
complains about invalid stack frame (probably not a 1000th
frame).down 5
- if active, thread set and suspended,
moves down five frames.help down
Prints all fields of an object.
dump
- if not active, complains about inactive
session.dump
- if active, complains about missing
arguments.dump <obj>
- if active, complains that
current thread is not set.dump <obj>
- if active and thread set,
complains about invalid stack frame (because the thread is not
running yet).dump <obj>
- if active and thread running,
complains that current thread is not suspended.dump <obj>
- if active, thread suspended,
and native method, complains about native method.dump <obj>
- if active, thread suspended,
and no variable information, complains.dump <bad-obj>
- if active, complains that
field does not exist.dump <obj>
- if active and 'obj'
exists, prints all the fields of 'obj'.help dump
Enables a breakpoint.
enable
- displays defined breakpoints.enable abc123
- complains about invalid
breakpoint (bad number format).enable <bad-n>
- complains about invalid
breakpoint (it does not exist).enable <n>
- enables the given
breakpoint.help enable
Enables garbage collection for an object.
enablegc
- if not active, complains about
inactive session.enablegc
- if active, complains about missing
arguments.enablegc <obj>
- if active, complains that
current thread is not set.enablegc <obj>
- if active and thread set,
complains about invalid stack frame (because the thread is not
running yet).enablegc <obj>
- if active and thread
running, complains that current thread is not suspended.enablegc <obj>
- if active, thread
suspended, and native method, complains about native method.enablegc <obj>
- if active and thread
suspended, complains that object was not found.enablegc <obj>
- if active, thread
suspended, and no variable information, complains.enablegc <obj>
- if active and thread
suspended and object exists, enables garbage collection on
object.help enablegc
Displays and manages the single-step class exclusion filters.
exclude
- displays current exclusion set.exclude -
- complains about invalid syntax.exclude +
- complains about invalid syntax.exclude ..
- complains about invalid
syntax.exclude *..Foo*
- complains about invalid
syntax.exclude *Foo*
- adds the class exclusion filter
for all classes with "Foo" in their name.exclude *.Foo
- adds the class exclusion filter
for all classes named "Foo" in any package.exclude java.*
- adds the class exclusion filter
for all classes in the "java" package.exclude java.lang.String
- adds the class
exclusion filter for the exact class named
"java.lang.String".exclude - *.Foo
- removes the class exclusion
filter from the filter list.help exclude
Closes the active debugging session, and exits JSwat if there are no more sessions.
exit
- terminates the session and exits the
program if no other sessions exist.help exit
Print names of data members of a class.
fields
- if not active, complains about inactive
session.fields
- if active, complains about missing
arguments.fields <bad-class>
- if active, complains
about unknown class 'o'.fields *<class>
- if active, prints the
files of the class that matches the wild-carded name.fields <class>*
- if active, prints the
files of the class that matches the wild-carded name.fields <class>
- prints fields of class
'class'.help fields
Set the current stack frame.
frame
- if not active, complains about inactive
session.frame
- if active, complains about missing
arguments.frame 1
- if active but no current thread,
complains that current thread not set.frame 1
- if active and current thread set,
complains about invalid stack frame (because thread is not yet
running).frame 1
- if active and thread running,
complains that thread is not suspended.frame 3
- if active and thread suspended and
set, sets current frame to number given.help frame
Explains how to use JSwat commands.
help
- enters interactive help mode.help nothere
- complains about unknown command.help commands
- shows all command descriptions,
and defined aliases and macros.help <alias>
- explains that the named
alias is an alias.help <macro>
- explains that the named
macro is a macro.help threads
- enters interactive help mode
starting with the threads help category.help help
Shows a command history.
history
- shows command history.help history
Interrupts a given thread.
interrupt
- if not active, complains about
inactive session.interrupt
- if active, complains of missing
arguments.interrupt <bad-id>
- if active, complains
of invalid thread identifier.interrupt <id>
- if active, interrupts the
given thread.help interrupt
Terminate one or all threads in the debuggee VM.
kill
- if not active, complains about inactive
session.kill
- if active, terminates running VM.kill <bad-id>
- if active, complains of
invalid thread identifier.kill <id>
- if active, complains that
thread is not suspended. This is always the case. There seems to
be some difficulty with killing a running thread. And worse, the
thread must be suspended by the debuggee VM, not the
debugger.help kill
Print the line numbers of a method.
lines
- if not active, complains about inactive
session.lines
- if active, complains about missing
arguments.lines <bad-class>
- if active, complains
about unknown class 'bad-class'.lines <class>
- if active, shows line
numbers of all methods in class 'class'.lines <class> <bad-method>
- if
active, complains about invalid method specification.lines *<class> <method>
- if
active, shows line numbers of the method in the class that
matches the wild-carded name.lines <class>* <method>
- if
active, shows line numbers of the method in the class that
matches the wild-carded name.lines <class> <method>
- if active,
shows line numbers of 'method' in class 'class',
including superclasses.help lines
Listens for a connection from a debuggee VM.
listen
- starts listening at the displayed
address.listen <bad-port>
- complains about the
invalid port number.listen <port>
- starts listening at the
given port number.help listen
Create a debuggee VM to be debugged, without starting it.
load
- relaunches previosly launched
debuggee.load <class>
- loads debuggee VM to debug
class.load -classic <class>
- loads debuggee VM
with Classic VM to debug class.load -hotspot <class>
- loads debuggee VM
with HotSpot VM to debug class.load <class> arg1 arg2 arg3
- loads
debuggee VM to debug class, passing the class three
arguments.load -cp <classpath> <class>
- loads
debuggee VM to debug class, using the given classpath.load -cp "<classpath>"
<class>
- loads debuggee VM to debug class, using
the given quoted classpath (quoted to allow for spaces).load -cp "<classpath> <class>
-
attempts to load debuggee VM but fails because of missing
quote.help load
Display visible local variables and field variables.
locals
- if not active, complains about inactive
session.locals
- if active, complains that current
thread is not set.locals
- if active and thread set, complains
about invalid stack frame (because thread is not yet
running).locals
- if active and thread running, complains
that thread is not suspended.locals
- if active, thread suspended, and native
method, complains about native method.locals
- if active, thread suspended, and no
variable information, complains.locals
- if active, thread suspended, and
variable information exists, displays all visible variables.help locals
Display monitor and waiting thread information for an object.
lock
- if not active, complains about inactive
session.lock
- if active, complains about missing
arguments.lock <obj>
- if active, complains that
current thread is not set.lock <obj>
- if active and thread set,
complains about invalid stack frame (because the thread is not
running yet).lock <obj>
- if active and thread running,
complains that current thread is not suspended.lock <obj>
- if active, thread suspended,
and native method, complains about native method.lock <obj>
- if active, thread suspended,
and no variable information, complains.lock <obj>
- if active and thread
suspended, complains that object was not found.lock <obj>
- if active, thread suspended,
and HotSpot VM, unsupported operation exception is reported.help lock
Create a command macro.
macro
- complains of missing arguments.macro <name>
- starts defining a macro
with the given name.help macro
List methods of a class.
methods
- if not active, complains about
inactive session.methods
- if active, complains about missing
arguments.methods <bad-class>
- if active, complains
about unknown class.methods *<class>
- if active, shows
methods of the class matching the wild-carded name (includes
superclasses).methods <class>*
- if active, shows
methods of the class matching the wild-carded name (includes
superclasses).methods <class>
- if active, shows methods
of named class (includes superclasses).help methods
Add or remove monitors from breakpoints.
monitor
- complains about missing arguments.monitor duh "command" 12345
- indicates no such breakpoint.monitor duh "command" 1
- complains about unknown action.monitor add "command" 1
- adds the given monitor to breakpoint '1'.monitor del "command" 1
- removes the given monitor from breakpoint '1'.help monitor
Step one line, stepping over method calls.
Step one instruction, stepping over method calls.
Show and modify program options.
options
- displays all options and their
values.options arg1
- complains about missing
arguments.options <undefined> <value>
- should
complain about unknown option name.options <name> <value>
- sets the
value for the named option. Check that the change takes effect
immediately and sends out a change event.help options
Print a local or field variable value.
print
- if not active, complains about inactive
session.print
- if active, complains about missing
arguments.print <obj>
- if active, complains that
current thread is not set.print <obj>
- if active and thread set,
complains about invalid stack frame (because the thread is not
running yet).print <obj>
- if active and thread
running, complains that current thread is not suspended.print <obj>
- if active, thread suspended,
and native method, complains about native method.print <obj>
- if active, thread suspended,
and no variable information, complains.print <bad-obj>
- if active, complains
that field does not exist.print <obj>
- if active and 'obj'
exists, prints named variable as a String.print <char>
- if active and
'char' exists, prints character and its hexadecimal
value.help print
Executes the commands in the given command file.
read
- complains of missing arguments.read <bad-name>
- complains that file was
not found (same if file not readable).read <name>
- reads file and parses
commands contained therein. Lines beginning with #
are skipped as comments.help read
Resume execution of one or all threads.
resume
- if not active, complains about inactive
session.resume
- if active, resumes all threads.resume <bad-id>
- if active, complains of
invalid thread identifier.resume <id>
- if active, resumes the
thread.help resume
Create a debuggee VM to be debugged and immediately start it.
run
- relaunches previosly launched
debuggee.run <class>
- loads debuggee VM to debug
class and resumes all threads.run -classic <class>
- loads debuggee VM
with Classic VM to debug class and resumes all threads.run -hotspot <class>
- loads debuggee VM
with HotSpot VM to debug class and resumes all threads.run <class> arg1 arg2 arg3
- loads
debuggee VM to debug class, passing the class three arguments and
resumes all threads.run -cp <classpath> <class>
- loads
debuggee VM to debug class, using the given classpath and resumes
all threads.run -cp "<classpath>"
<class>
- loads debuggee VM to debug class, using
the given quoted classpath (quoted to allow for spaces).run -cp "<classpath> <class>
-
attempts to load debuggee VM but fails because of missing
quote.help run
Sets a temporary breakpoint at the given location and resumes the debuggee VM.
runto
- complains about missing arguments.runto <class>:<line>
- sets
breakpoint at given line in the class and resumes.runto <class>.<method>([<arg
list>])
- sets breakpoint at the start of the specified
method in the class and resumes.help runto
Changes the value of a variable.
set
- if not active, complains about inactive
session.set
- if active, complains about missing
arguments.set <obj> = <value>
- if active,
complains that current thread is not set.set <obj> = <value>
- if active and
thread set, complains about invalid stack frame (because the
thread is not running yet).set <obj> = <value>
- if active and
thread running, complains that current thread is not
suspended.set <obj> = <value>
- if active,
thread suspended, and native method, complains about native
method.set <obj> = <value>
- if active,
thread suspended, and no variable information, complains.set <bad-obj> = <value>
- if active,
complains that field does not exist.set <obj> = <value>
- if active and
'obj' exists, sets named variable to new value.set <obj> = "<string>"
-
if active and 'obj' exists and is a String, sets the
variable to the given text.set <obj> = null
- if active and
'obj' exists and is an Object, sets the variable to
null.help set
Displays or sets the source path.
sourcepath
- displays sourcepath.sourcepath <path>
- changes sourcepath to
that given.help sourcepath
Prints a message to standard error of the JSwat JVM.
stderr
- prints a blank line to JSwat's
standard error stream.stderr <message>
- prints the message
(followed by a newline) to JSwat's standard error
stream.help stderr
Sends text to the debuggee VM's standard input stream.
stdin
- if not active, complains about inactive
session.stdin <input>
- if active and remote
debuggee, complains about remote debuggee.stdin <input>
- if active and launched
debuggee, sends input to debuggee VM's standard input
stream.help stdin
Prints a message to standard output of the JSwat JVM.
stdout
- prints a blank line to JSwat's
standard output stream.stdout <message>
- prints the message
(followed by a newline) to JSwat's standard output
stream.help stdout
Execute a single line, stepping into methods.
step
- if not active, complains about inactive
session.step
- if active, complains about no current
thread.step
- if active and thread running, complains
that thread is not suspended.step
- if active and thread set, executes next
line, stepping into methods.step out
- if active and thread set, finishes the
current method.step up
- if active and thread set, finishes the
current method.step thread
- if active and thread set, executes next
line, stepping into methods, suspending the current thread only.step up thread
- if active and thread set, finishes
the current method, suspending the current thread only.Execute a single instruction, stepping into methods.
Set a breakpoint at some location.
stop
- displays defined breakpoints.stop <class>:<line>
- sets
breakpoint at given line in the class.stop go <class>:<line>
- sets
breakpoint at given line in the class, but does not stop when
hit.stop thread <class>:<line>
- sets
breakpoint at given line in the class, stopping the event thread
when hit.stop <class>.<method>([<arg
list>])
- sets breakpoint at the start of the specified
method in the class.stop go <class>.<method>([<arg
list>])
- sets breakpoint at the start of the specified
method in the class, but does not stop when hit.stop thread <class>.<method>([<arg
list>])
- sets breakpoint at the start of the specified
method in the class, stopping the event thread when hit.help stop
Suspend execution of one or all threads.
suspend
- if not active, complains about
inactive session.suspend
- if active, suspends all threads.suspend <bad-id>
- if active, complains of
invalid thread identifier.suspend <id>
- if active, suspends the
thread.help suspend
Set the current thread.
thread
- if not active, complains about inactive
session.thread
- if active, displays currently set
thread.thread <bad-tid>
- if active, complains of
invalid identifier.thread <tid>
- if active, sets current
thread.help thread
List all known thread groups.
threadgroups
- if not active, complains about
inactive session.threadgroups
- if active, lists all known thread
groups.help threadgroups
Display thread lock information.
threadlocks
- if not active, complains about
inactive session.threadlocks
- if active but no current thread,
complains about no current thread.threadlocks all
- if active but threads no
suspended, complains about threads not being suspended.threadlocks all
- if active, threads suspended,
and HotSpot VM, unsupported operation exception is reported.threadlocks <bad-tid>
- if active,
complains about invalid thread identifier.threadlocks <tid>
- if active, thread
suspended, and Classic VM, shows thread lock information.help threadlocks
List all known threads.
threads
- if not active, complains about
inactive session.threads
- if active, lists all known threads.
Current thread is indicated with an asterisk (*).threads nothere
- if active, indicates the named
thread group does not exist.threads main
- if active, lists all threads in the
thread group named 'main'. Current thread is indicated with an
asterisk (*).threads 1
- if active, lists all threads in the
thread group numbered '1'. Current thread is indicated with an
asterisk (*).help threads
Remove a command alias.
unalias
- complains about missing argument.unalias <bad-name>
- complains about
unknown alias.unalias <name>
- removes alias
definition.help unalias
Move up by one in the stack frame.
up
- if not active, complains about inactive
session.up
- if active but no current thread, complains
about current thread not being set.up
- if active and thread set, complains about
invalid stack frame (because thread has no stack yet)up
- if active, thread set, and thread
running,up
- if active, thread set and suspended, moves
one frame up.up 1000
- if active, thread set and suspended,
complains about invalid stack frame (probably not a 1000th
frame).up 5
- if active, thread set and suspended,
moves up five frames.help up
Display version information.
version
- if not active, prints JSwat version
and information about JSwat JVM.version
- if active, prints JSwat version and
information about JSwat JVM, plus additional JPDA version
information.help version
View a source file.
view
- complains about missing arguments.view <file>
- views named file, if
supported by UI adapter (console mode does not support file
viewing).view *<class>
- opens view of source file
for the class that matches the wild-carded name.view <class>*
- opens view of source file
for the class that matches the wild-carded name.view <class>
- opens view of source file
for named class.view <class> abc
- complains about invalid
line number.view <class> 50
- opens view of source file
for named class, scrolling to show line 50.view <class> 50 60
- opens view of source file
for named class, scrolling to show line 50 through 60.help view
Shows a list of running VMs that are debuggable.
vmlist
- shows a list of attachable debuggee
VMs.help vmlist
Display stack frame of thread(s).
where
- if not active, complains about inactive
session.where
- if active but no current thread,
complains about no current thread.where
- if active and current thread running,
complains that thread is not suspended.where
- if active, current thread set and
suspended, shows thread's stack.where all
- if active, shows the stack for all
threads (that are not suspended).where <tid>
- if active and thread
suspended, shows stack for given thread.help where
Display stack frame of thread(s) with pc info.
wherei
- if not active, complains about inactive
session.wherei
- if active but no current thread,
complains about no current thread.wherei
- if active and current thread running,
complains that thread is not suspended.wherei
- if active, current thread set and
suspended, shows thread's stack.wherei all
- if active, shows the stack for all
threads (that are not suspended).wherei <tid>
- if active and thread
suspended, shows stack for given thread.help wherei