### 5.5 Debugger commands

When the debugger reaches a leashed port it shows the current goal followed by the `?` symbol. At this point there are many commands available. Typing `RETURN` will creep into the program. Continuing to creep will show all the control flow. The debugger shows every port for every predicate encountered during the execution. It is possible to select the ports at which the debugger will prompt the user using the built-in predicate `leash/1` (section 5.3.2). Each command is only one character long:

Command | Name | Description
`RET` or `c` | creep | single-step to the next port
`l` | leap | continue the execution only stopping when a goal with a spy-point is reached
`s` | skip | skip over the entire execution of the current goal. No message will be shown until control returns
`G` | go to | ask for an invocation number and continue the execution until a port is reached for that invocation number
`r` | retry | try to restart the invocation of the current goal by failing until reaching the invocation of the goal. The state of execution is the same as when the goal was initially invoked (except when using side-effect predicates)
`f` | fail | force the current goal to fail immediately
`w` | write | show the current goal using `write/2` (section 8.14.6)
`d` | display | show the current goal using `display/2` (section 8.14.6)
`p` | print | show the current goal using `print/2` (section 8.14.6)
`e` | exception | show the pending exception. Only applicable to an `exception` port
`g` | ancestors | show the list of ancestors of the current goal
`A` | alternatives | show the list of ancestors of the current goal combined with choice-points
`u` | unify | ask for a term and unify the current goal with this term. This is convenient for getting a specific solution. Only available at a `call` port
`.` | father file | show the Prolog file name and the line number where the current predicate is defined
`n` | no debug | switch the debugger off. Same as `nodebug/0` (section 5.3.1)
`=` | debugging | show debugger information. Same as `debugging/0` (section 5.3.1)
`+` | spy this | set a spy-point on the current goal. Uses `spy/1` (section 5.3.3)
`-` | nospy this | remove a spy-point on the current goal. Uses `nospy/1` (section 5.3.3)
`*` | spy conditionally | ask for a term `Goal, Port, Test` (terminated by a dot) and set a conditional spy-point on the current predicate. `Goal` and the current goal must have the same predicate indicator. Uses `spypoint_condition/3` (section 5.3.3)
`L` | listing | list all the clauses associated with the current predicate. Uses `listing/1` (section 8.23.3)
`a` | abort | abort the current execution. Same as `abort/0` (section 8.18.1)
`b` | break | invoke a recursive top-level. Same as `break/0` (section 8.18.1)
`@` | execute goal | ask for a goal and execute it
`<` | set print depth | ask for an integer and set the print depth to this value (`-1` for no depth limit)
`h` or `?` | help | display a summary of available commands
`W` | WAM debugger | invoke the low-level WAM debugger (section 5.6)

Copyright (C) 1999-2012 Daniel Diaz Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. More about the copyright