Janet 1.38.0-73334f3 Documentation
(Other Versions:
1.37.1
1.36.0
1.35.0
1.34.0
1.31.0
1.29.1
1.28.0
1.27.0
1.26.0
1.25.1
1.24.0
1.23.0
1.22.0
1.21.0
1.20.0
1.19.0
1.18.1
1.17.1
1.16.1
1.15.0
1.13.1
1.12.2
1.11.1
1.10.1
1.9.1
1.8.1
1.7.0
1.6.0
1.5.1
1.5.0
1.4.0
1.3.1
)
Debug Module
Index
debug/arg-stack debug/break debug/fbreak debug/lineage debug/stack debug/stacktrace debug/step debug/unbreak debug/unfbreak
(debug/arg-stack fiber)
Gets all values currently on the fiber's argument stack. Normally, this should be empty unless the fiber signals while pushing arguments to make a function call. Returns a new array.
(debug/break source line col)
Sets a breakpoint in source
at a given line and column. Will throw an error if the breakpoint location cannot
be found. For example
(debug/break "core.janet" 10 4)
will set a breakpoint at line 10, 4th column of the file core.janet.
(debug/fbreak fun &opt pc)
Set a breakpoint in a given function. pc is an optional offset, which is in bytecode instructions. fun is a function value. Will throw an error if the offset is too large or negative.
(debug/lineage fib)
Returns an array of all child fibers from a root fiber. This function is useful when a fiber signals or errors to an ancestor fiber. Using this function, the fiber handling the error can see which fiber raised the signal. This function should be used mostly for debugging purposes.
(debug/stack fib)
Gets information about the stack as an array of tables. Each table in the array contains information about a stack frame. The top-most, current stack frame is the first table in the array, and the bottom-most stack frame is the last value. Each stack frame contains some of the following attributes:
:c - true if the stack frame is a c function invocation
:source-column - the current source column of the stack frame
:function - the function that the stack frame represents
:source-line - the current source line of the stack frame
:name - the human-friendly name of the function
:pc - integer indicating the location of the program counter
:source - string with the file path or other identifier for the source code
:slots - array of all values in each slot
:tail - boolean indicating a tail call
(debug/stacktrace fiber &opt err prefix)
Prints a nice looking stacktrace for a fiber. Can optionally provide an error value to print the stack trace
with. If prefix
is nil or not provided, will skip the error line. Returns the fiber.
(debug/step fiber &opt x)
Run a fiber for one virtual instruction of the Janet machine. Can optionally pass in a value that will be passed as the resuming value. Returns the signal value, which will usually be nil, as breakpoints raise nil signals.
(debug/unbreak source line column)
Remove a breakpoint with a source key at a given line and column. Will throw an error if the breakpoint cannot be found.
(debug/unfbreak fun &opt pc)
Unset a breakpoint set with debug/fbreak.