Debugger
The webOS debugger is a command-line tool on the HP webOS platform device or emulator that enables you to use breakpoints, display variables, and trace the stack.
Note:
If you connect the debugger while the emulator is still booting, the emulator may take longer to boot because the debugger imposes a performance penalty which slows down the booting process. The debugger will not break in native non-JS code and some system JS code. During the booting process, the system may not always be executing breakable JS code. While the emulator is still booting, the system might not always respond immediately to a break request.
Starting the Debugger
This section describes how to start the debugger and defines the following command types:
- Basic
- Breakpoints
- Execution
- Source
- Program Stack
- Variables
Using the Debugger
Follow these steps:
- Open a terminal to the device (either novaterm or ssh).
- Type debug to start the debugger, and then press Enter once to get the dbg> prompt.
Basic Commands
| Command | Description |
| help | Shows the available commands. |
| scripts | Shows all of the loaded scripts, including the Mojo framework. |
Breakpoints
| Command | Description |
|
break script:line or b script:line |
Sets a breakpoint. Specify the full path to the script, and the line number. Example: b /var/usr/palm/applications/com.yourdomain.test/app/assistants/stage-assistant.js:5 |
| clear ID or delete ID or d ID | Clears the breakpoint specified by ID. |
| cond ID expression | Makes the breakpoint specified by ID conditional on an expression. The expression is any boolean JavaScript expression that can be evaluated at the site of the breakpoint. If the expression evaluates to true, the breakpoint triggers. To make the breakpoint unconditional again, type cond ID with no expression. |
| disable ID or dis ID | Disables the breakpoint specified by ID. |
| enable ID or en ID | Enables the breakpoint specified by ID. |
| ignore ID [count] | Ignores the breakpoint specified by ID ( count times, if specified). |
| info break or inf br | Shows the current breakpoints and their ID numbers. |
Execution Control
| Command | Description |
| continue or c | Continue (run). |
| finish or fin | Step out of the current method. |
| next or n | Step over. |
| step or s | Step into. |
Program Stack
| Command | Description |
| backtrace or bt | Shows the call stack. |
| down or do | Moves down one frame in the call stack listing. |
| frame number or f number | Goes to the frame number in the call stack listing. If a number is not specified, displays the current frame. |
| up | Moves up one frame in the call stack listing. |
Source
| Command | Description |
| list or l | Shows the next 10 lines of code. |
| list - or l - | Shows the previous 10 lines of code. |
| list first, last | Shows from line first to line last. |
Variables
| Command | Description |
| info args or inf ar | Displays the arguments. |
| info locals or inf lo | Displays the values of local variables. |
| print expression or p expression | Executes expression and displays the result. For example, expression might be a variable from the script. |
| set variable = expression | Sets variable to expression. |