Janet 1.15.3-6392b37 Documentation
(Other Versions: 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
(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
(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)

wil set a breakpoint at line 10, 4th column of the file core.janet.
Community Examples

debug/fbreak cfunction
(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
(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
(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

* :column - the current source column of the stack frame

* :function - the function that the stack frame represents

* :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
(debug/stacktrace fiber &opt err)

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, will skipp the error line. Returns the fiber.
Community Examples

debug/step cfunction
(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
(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
(debug/unfbreak fun &opt pc)

Unset a breakpoint set with debug/fbreak.
Community Examples