fish debug command

Syntax

fish debug s keyword

Launch the FISH function s in debug mode. Debugging is discussed FISH Debugging. [CS: given its prevalence in the below, a introduction/definition of the term pseudo-code (or possibly a glossary entry for it) might be nice]

break keyword ...

This function sets and clears breakpoints in a number of ways. A breakpoint is set in a pseudo-code object, and causes FISH to stop before the object is executed, and to provide the Debug> prompt. Note that breakpoints only function in debug mode.

clear

Remove all breakpoints from all pseudo-code objects.

code <i > b

Set or clear a breakpoint at a pseudo-code object with ID number i. If i is not specified, then the current pseudo-code object is used.

fish b

Set or clear a breakpoint at the first pseudo-code object in the FISH function.

line <i > on/off

Set or clear a breakpoint at the first pseudo-code object from line i in the current source file. If i is not specified, then the current line is used.

codeinto

Execute a single pseudo-code object. If a function call is made in that object, then execution is stopped at the start of that function.

codeover

Execute a single pseudo-code object, and execution is not stopped if a function call is made in that object.

codeto i

Execute until the pseudo-code object with ID i is about to be executed. If that object is never reached, then the original function call will end, as will the debugging mode.

lineinto

Execute all pseudo-code objects originating from the current source line, and stop when the next pseudo-code object would have originated from the next line. If a function call is made, the debugger stops upon entry to that function.

lineover

Execute all pseudo-code objects originating from the current source line, and stop when the next pseudo-code object originates from the next line. It does not stop if function calls that cause code to be executed in other functions are made.

lineto i

Execute until code originating from the current source file at line i is reached. If that line is never reached, then the original function call will end, as will the debugging mode.

list keyword ...
call

Output the current call stack. For instance, if function fred calls function george, and execution is halted in function george, the call stack will read:

fred
george
code <i1 > <i2 >

Output the pseudo-code object with ID i1; or if i1 is not specified, output the pseudo-code object that will be executed next. If i2 is specified, the pseudo-code from i1 to i2 is to be output.

fish

Output the current value of FISH symbol fish. The leading @ symbol is not necessary here, but it will be accepted. If the symbol is a function, it will not be executed; instead, its current value will be used.

register

Output the current contents of the register. The register is used to store FISH values that are going to be passed as arguments to FISH intrinsics, used for array access, or passed as arguments to functions.

source <i1 > <i2 >

Output the line from the source file that was used to create the FISH function. If the source file is unavailable, an error will occur. If i1 is not specified, then the line corresponding to the current execution point is used. If i2 is specified, then lines from i1 to i2 are output.

stack

The current contents of the stack are output. The stack is used to store local variables and arguments during function execution. At present, the names of stack variables are not available.

run

Continue execution until a breakpoint is reached, or until the original function ends.