Alexander Mikhailov wrote:
> I'm trying to learn debugging in J.
You get a debugger with J:
require 'debug'
dbr 1 NB. recovers from any pending error and requests the debugger
NB. to be active for breakpoints and error events.
dbss 'CC 4' NB. set a breakpoint ("set stop") on line 5 (zero-based: 4)
NB. of (monadic?) CC.
AA ... NB. run your code.
The system will become interactive again prior to executing the
stopped line. Just use any J expressions you like at that point.
To get a backtrace including local variables, use
dbstack''
SEE ALSO: dbs/dblocals/dbnxt/dbrun. This is all in all pretty
much like, say, C debuggers work.
The underlying 13!: debugging primitves are described under
http://jsoftware.com/help/dictionary/dx013.htm The 'debug' library
provides the db* cover names for the various foreigns. Their
documentation was always too lacking in the past years for my taste,
but these days it gets even worse:
http://jsoftware.com/help/user/debugs.htm
has been revised to describe the newer GUI front-end in the
IDE, and information on the db* functions has been mostly
killed. Another example that jconsole users get only
second rate treatment.
It would be sooo helpful if a jconsole user could say:
require 'scriptdoc'
scriptdoc 'debug'
without just getting a
|value error: wdisparent
| wdisparent'sdoc'
So it's back to:
2!:0 'grep ''^NB\.\*'' j701/system/main/debug.ijs'
NB.*dbr v reset, set suspension mode (0=disable, 1=enable)
NB.*dbs v display stack
NB.*dbsq v stop query
NB.*dbss v stop set
NB.*dbrun v run again (from current stop)
NB.*dbnxt v run next (skip line and run)
NB.*dbret v exit and return argument
NB.*dbjmp v jump to line number
NB.*dbsig v signal error
NB.*dbrr v re-run with specified arguments
[...]
and variations.
Martin
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm