Debug

From J Wiki
Jump to: navigation, search
Overview   Commands   Stops   Watch

Debug is a JQt GUI for the debug foreign conjunction, available from J803. After Debug is turned on, then if execution is halted because of a stop or execution error, the Debug window shows the current execution environment.

Panels in the Debug window show the code being executed, the stack, and values of various names:

  • any watch names
  • the arguments of the current definition
  • any names on the current line of code

For an introduction to Debug, see the Debug lab. For information on the debug foreign conjunction, see the Dictionary entry for the 13!:x family. In addition to the Debug GUI, several debug verbs are defined in the standard library, see the debug script.

Load Debug

To load Debug, use menu Run|Debug..., or press Ctrl-K when the J session has focus.

This displays the Debug window, enables suspension (dbr 1), and sets the debug latent expression (dblxs) to run the verb debug in the jdebug locale.

Then run your program. If execution is halted because of a stop or execution error, the execution state is shown in the Debug window. Several commands let you step through the execution session.

To turn Debug off and disable suspension, close the Debug window.

Debug Settings

Debug is active when suspension is on, and the debug latent expression is set. The Debug window is displayed when Debug is activated, so this provides a visual indication that Debug is active.

However, if you change either of these directly, for example, by entering:

   dbr 0

then Debug will no longer be active, even if the Debug window is still displayed. You can reactivate Debug by pressing Ctrl-K.