Janet 1.32.1-cc5beda Documentation
(Other Versions: 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 cfunction source
(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.
Community Examples

debug/break cfunction source
(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.
Community Examples

debug/fbreak cfunction source
(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.
Community Examples

debug/lineage cfunction source
(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.
Community Examples

debug/stack cfunction source
(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
Community Examples

debug/stacktrace cfunction source
(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 `err` is nil or not provided, and no prefix is given, will skip the error line. Returns the fiber.
Community Examples

debug/step cfunction source
(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.
Community Examples

debug/unbreak cfunction source
(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.
Community Examples

debug/unfbreak cfunction source
(debug/unfbreak fun &opt pc)

Unset a breakpoint set with debug/fbreak.
Community Examples