Wsd

A debugger for Whitespace assembler programs.

It can be hard to reason about the state of a Whitespace program. This debugger might give you some insight.

Usage

java Wsd [-x] myfile.wsa

...or, if you use the scripts in the bin directory...

wsd [-x] myfile.wsa

The optional -x flag enables extensions to the original Whitespace language.

The debugger will assemble the program. Then it will open the debugger at the point where the first instruction is about to be executed.

If you put some debugger commands in myfile.wsa.wsdrc they will be executed when the debugger starts. The format for these commands is the same as the interactive commands described below. For example, you could set some breakpoints and tell the debugger to run.

If your Whitespace program reads user input, that won't work because user input is going to the debugger. Instead, put the program's input into myfile.wsa.wsdin.

Debugger commands

stop n
sets a breakpoint at source line n
synonyms: s n, stop at n
clear n
removes a breakpoint at source line n
synonyms: cl n, clear at n
clear
list breakpoints
synonyms: stop, s, cl
stack
print the stack
setstack i v
set the value of stack element i to v - zero is the top of the stack
synonyms: ss i v
heap
print the heap
setheap a v
set the value of heap address a to v
synonyms: sh a v
analyse
print heap analysis
synonyms: a
analysefull
print heap analysis, including unallocated blocks
synonyms: af
calls
print the call stack
run
run the program
synonyms: r, cont, co
next
step to the next source line
synonyms: n, step, step in
out
step out of the current call
synonyms: o, step out, step up
list
show wsa source centred on the current line
synonyms: l
list n
show wsa source centred on the given line
synonyms: l n
Hint: to see the next chunk of code, add 10 to to the current line number.
monitor foo
run the command foo every time the debugger stops the program
sysnonyms: m foo
Note: you can add as many monitors as you like. The initial defaults are
"heap", "list", "stack", "analyse"
unmonitor
list monitors
synonyms: u, m, monitor
unmonitor foo
stop monitoring foo
synonyms: u foo
quit
abort the program and the debugger immediately
synonyms: q, exit, e, x
help
show this list of commands
synonyms: h, ?