Janet 1.10.1-9cfc3d9 Documentation
(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 byte-offset) Sets a breakpoint with source a key at a given line and column. Will throw an error if the breakpoint location cannot be found. For example (debug/break "core.janet" 1000) wil set a breakpoint at the 1000th byte 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 :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
(debug/stacktrace fiber err) Prints a nice looking stacktrace for a fiber. The error message err must be passed to the function as fiber's do not keep track of the last error they have thrown. 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.