Standard Library/debug

From J Wiki
Jump to navigation Jump to search
Overview | android | break | colib | compare | coutil | dates | debug | dir | dll | files | jade | jal | stdlib | strings | sysenv | text | unxlib

This script defines debug utilities and is included in the J standard library. Definitions are loaded into the z locale.

Definitions

D dbctx, dberm, dberr, dbg, dbhelp, dbjmp, dblocals, dblxq, dblxs, dbnxt, dbq, dbr, dbret, dbrr, dbrrx, dbrun, dbs, dbsig, dbsq, dbss, dbst, dbstack, dbstk, dbstop, dbstopme, dbstopnext, dbstops, dbtrace, dbview

dberm v last error message
dberr v last error number
dbg v turn debugging window on/off
dbhelp n display help message
dbjmp v jump to line number
dblxq v latent expression query
dblxs v latent expression set
dbnxt v run next (skip line and run)
dbq v queries suspension mode (set by dbr)
dbr v reset, set suspension mode (0=disable, 1=enable)
dbret v exit and return argument
dbrr v re-run with specified arguments
dbrrx v re-run with specified executed arguments
dbrun v run again (from current stop)
dbs v display stack
dbsig v signal error
dbsq v stop query
dbss v stop set
dbst v returns stack text
dbstk v call stack
dbtrace v trace control
dbview v view stack

dbctx (verb)

Display context as character matrix

y is ignored

x is the number of lines before and after the current stop

dblocals (verb)

Display names and locals on stack.

Syntax:

[namelist] dblocals stack_indices

If indices is empty, defaults to all

Example:

 dblocals ''            NB. display all local names in stack
'abc Z' dblocals i.5    NB. display names abc and Z where found in first 5 definitions on stack

dbstack (verb)

Displays call stack with header

Ignores definition and source script (default)

y is the number of lines to display, all if empty or a name on the stack

limits display to screenwidth

dbstop (verb)

Set stops on all lines in namelist

Adds to current set of stops.

dbstopme (verb)

Set stops on current definition if y.

Does nothing if suspension is off.

dbstopnext (verb)

Set stop on next line of current definition if y.

Does nothing if suspension is off.

dbstops (verb)

Set stops on all lines in namelist

Replaces current set of stops