Debugging¶
WebPPL provides error messages that try to be informative. In addition there is debugging software you can use for WebPPL programs.
To debug WebPPL programs running in Chrome, enable pause on JavaScript exceptions in the Chrome debugger.
To debug WebPPL programs running in nodejs, use node debugger as follows:
Add
debugger;
statements tomy-program.wppl
to indicate breakpoints.Run your compiled program in debug mode:
node debug path/to/webppl my-program.wppl
Note that you will need the full path to the
webppl
executable. This might be in thelib
folder of yournode
directory if you installed withnpm
. On many systems you can avoid entering the path manually by using the following command:node debug `which webppl` my-program.wppl
To navigate to your breakpoint within the debugger interface, type
cont
orc
. At any break point, you can typerepl
to interact with the variables. Here’s some documentation for this debugger.