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.wpplto 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
webpplexecutable. This might be in thelibfolder of yournodedirectory 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
contorc. At any break point, you can typereplto interact with the variables. Here’s some documentation for this debugger.