In some cases it is interesting to have access to the WAM data structures. This sub-debugger allows the user to inspect/modify the contents of any stack or register of the WAM. The WAM debugger is invoked using the built-in predicate wam_debug/0 (section 4.3.1) or the W debugger command (section 4.5). The following table presents the specific commands of the WAM debugger:
Command | Description |
write A [N] | write N terms starting at the address A using write/1 (section 7.14.6) |
data A [N] | display N words starting at the address A |
modify A [N] | display and modify N words starting at the address A |
where A | display the real address corresponding to A |
what RA | display what corresponds to the real address RA |
deref A | display the dereferenced word starting at the address A |
envir [SA] | display the contents of the environment located at SA (or the current one) |
backtrack [SA] | display the contents of the choice-point located at SA (or the current one) |
backtrack all | display all choice-points |
quit | quit the WAM debugger |
help | display a summary of available commands |
In the above table the following conventions apply:
It is possible to only use the first letters of a commands and bank names when there is no ambiguity. Also the square brackets [ ] enclosing the index of a bank name can be omitted. For instance the following command (showing the contents of 25 consecutive words of the global stack from the index 3): data global[3] 25 can be abbreviated as: d g 3 25.