How To: Debugging
You can use Ares to debug both projects created entirely within Ares including visual interfaces, as well as those created outside of Ares using standard Mojo.
Prerequisites
- Install the Mojo SDK - remote debugging requires the Emulator in the SDK, and logging is verbose by default on the Emulator
- Zip your application and upload the application to Ares by dragging it onto the upload area of the File Tree with the Applications directory selected. Your project must be in Ares.
- Install your application on the emulator. Your project must be in both Ares and the Emulator for debugging to function.
- Have the Palm Emulator running
- Make sure you accept the plugin security dialog when Ares launches, and that Java is enabled in your browser. Note: the plugin is not currently supported in the first Chrome Mac Beta release, but works on other webkit and mozilla based browsers.
To Enable Debugging
- From the View menu in the top left corner of Ares, select either the Debugger or Debug/Log menu options to turn on the debugger
- From the File Tree, open the file you wish to set a breakpoint on in the code editor
- In the debugger panel (below the code editor - this is resizable), select the “On” button - it will enable and glow green. If this does not happen, make sure you have the Emulator running and try again. If it still does not work, try and restart the emulator via the Restart Emulator item in the Launch menu.
- When you turn on the debugger, more space will show up in the code editor to the left of the line numbers. You can set a breakpoint on a given line by clicking to the left of the line number for that line. A red circle will appear on that line. It can be tricky to find the right spot to the left of the line number.
- Run your application on the Emulator, and perform the action required to get to the line of code with the breakpoint set. The debugger will stop, the line will highlight, and the debugger option buttons will enable.
Actions you can perform with the debugger active
- Continue - this will cause the debugger to continue until the next breakpoint is hit
- Step Over, Into, Out - these are standard debugging operations to step through the code to the desired location
- Stack Trace - this will show you the current stack
- Console - At the bottom of the debugger there is a > prompt. You can use this as a command line in the debugger, somewhat similar to Firebug or other javascript debugging utilities. Object values can be shown, including name/value pairs that are navigable for complex objects. You can check the value of various variables, objects, or evaluate expressions.
Troubleshooting
In the 1.3.1 SDK, the debugger in the emulator has some stability issues that are addressed in the next SDK release. In particular, once debugging has been enabled, any javascript exception in any application or system level will cause the system to stop. If the emulator ceases to function normally, use the Restart Emulator option in the Launch menu to quickly reboot the emulator system process to restore normal function.