Next: Syntax, Previous: Errors and Warnings, Up: Top [Index]
The C-INTERCAL distribution contains a runtime debugger
called ‘yuk’. Unlike most other debuggers, it is stored as
object code rather than as an executable, and it is compiled into the
code rather than operating on it. To debug code, add -y
(see -y) to the command line of
ick
when invoking it; that tells it to compile the
debugger into the code and then execute the resulting combination. (The
resulting hybrid debugger/input executable is deleted afterwards; this
is to prevent it being run by mistake, and to prevent spreading the
debugger’s licence onto the code it was compiled with.)
yuk can also be used as a profiler using the -p option (see -p); this produces a file yuk.out containing information on how much time was spent running each command in your program, and does not prompt for debugger commands.
Note that some command line arguments are incompatible with the debugger, such as -m and -f. In particular, this means that multithreaded programs and programs that use backtracking cannot be debugged using this method; the +printflow option (see +printflow) to a compiled program may or may not be useful for debugging multithreaded programs.
When the debugger starts, it will print a copyright message and a message on how to access online help; then you can enter commands to run/debug the program. The debugger will show a command prompt, ‘yuk007 ’, to let you know you can input a command.
Here are the commands available. Commands are single characters
followed by newlines, or followed by a line number (in decimal) and a
newline or a variable name (a .
, ,
,
:
or ;
followed by a number in decimal; note
that some commands only allow onespot and twospot variables as
arguments).
Command | Description |
---|---|
aLINE | All non-abstained commands on line LINE become abstained from once. |
bLINE | A breakpoint is set on line LINE. The breakpoint causes execution with ‘c’ to stop when it is reached. |
c | The program is run until it ends (which also ends the debugger) or a breakpoint is reached. |
dLINE | Any breakpoint that may be on line LINE is removed. |
eLINE | An explanation of the main expression in each command on line LINE is printed to the screen. The explanation is in the same format as the format produced by -h (see -h) and shows what the optimiser optimised the expression to (or the original expression if the optimiser wasn’t used). |
fLINE | Removes the effect of the ‘m’ command on line LINE. |
gLINE |
Causes the current command to be the first command on
LINE (if not on that line already) or the next command
on LINE, as if that line was NEXT ed to and
then that NEXT stack item was forgotten.
|
h | Lists 10 lines either side of the current line; if there aren’t 10 lines to one or the other side of the current line, instead more lines will be shown on the other side to compensate, if available. |
iVAR |
Causes variable VAR to become IGNORE d,
making it read-only.
|
jVAR |
Causes variable VAR to become REMEMBER ed,
making it no longer read-only.
|
k |
Continues executing commands until the NEXT stack is
the same size or smaller than it was before. In other words, if the
current command is not a NEXT and doesn’t have a
NEXT FROM aiming at it, one command is executed; but
if a NEXT does happen, execution will continue until
that NEXT returns or is forgotten. A breakpoint or the
end of the program also end this.
|
lLINE | Lists 10 lines of source code either side of line LINE, the same way as with ‘h’, but using a line stated in the command rather than the current line. |
mLINE | Produces a message onscreen every time a command on line LINE is executed, but without interrupting the program. |
n |
Show the NEXT stack on the screen.
|
o |
Continue executing commands until the NEXT stack is
smaller than it was before. If you are using NEXT s
like procedures, then this effectively means that the procedure
will run until it returns. A breakpoint or the end of the program
also end this.
|
p | Displays the value of all onespot and twospot variables. |
q | Aborts the current program and exits the debugger. |
rLINE | Reinstates once all abstained commands on line LINE. |
s | Executes one command. |
t | Continues execution until the end of the program or a breakpoint: each command that executes is displayed while this command is running. |
uLINE | Continues execution of the program until just before a command on line LINE is run (or a breakpoint or the end of the program). |
vVAR | Adds a ‘view’ on variable VAR (which must be onespot or twospot), causing its value to be displayed on the screen whenever a command is printed on screen (for instance, because the command has just been stepped past, or due to the ‘m’ or ‘t’ commands). |
w | Displays the current line and current command onscreen. |
xVAR | Removes any view and any action that may be associated with it on variable VAR (which must be onespot or twospot). |
yVAR | Adds a view on variable VAR; also causes a break, as if a breakpoint was reached, whenever the value of that variable changes. |
zVAR | Adds a view on variable VAR; also causes a break, as if a breakpoint was reached, whenever that variable’s value becomes 0. |
VAR | A onespot or twospot variable written by itself prints out the value of that variable. |
<VAR |
WRITEs IN a new value for variable VAR.
Note that input must be in the normal ‘ONE TWO
THREE’ format; input in any other format will cause
error E579 (see E579) and as that
is a fatal error, the debugger and program it’s debugging
will end.
|
* |
Displays the license conditions under which ick is
distributed.
|
? | Displays a summary of what each command does. (‘@’ does the same thing.) |
While the code is executing (for instance, during a ‘c’, ‘k’, ‘o’, ‘t’ or ‘u’ command), it’s possible to interrupt it with CTRL-C (on UNIX/Linux) or CTRL-BREAK (on Windows/DOS); this will cause the current command to finish running and the debugger prompt to come back up.
Next: Syntax, Previous: Errors and Warnings, Up: Top [Index]