Debug WebOS Application

My posts have been lax.…  NO APOLOGIES!…  I’ve been spending my free time developing my Cell Stalker app for the Palm Pre and Palm Pixi. (Palm WebOS)

Compared to developing a .Net appliction, developing for WebOS is a real pain.…  It is Javascript and HTML however, there is no “Intellisense”, “Easy Debugging”, “Syntax Checker” or “Accurate Warning/Errors”.

With that being said, let me show you how to debug and WebOS and how to find WebOS Javascript Errors.

As always you first need…

  1. Java 6 (if you don’t already)
  2. Sun VirtualBox (This is where you run the Palm phone emulator on your PC)
  3. WebOS SDK (This is basically the virtual machine, application packager and a few more tools)

I don’t use Eclipse to program, I’ve been using Komodo Edit.…  I like Komodo Edit because it’s MUCH smaller and quicker than Eclipse.

  1. Komodo Edit (The IDE, the place where you type your code)
  2. Komodo Edit WebOS tools (This allows you to compile and run your program with the push of a button.…  It also has “Some” syntax checking.)

After ALL of that is installed, you create a new application.…  You should be able to run it in the emulator and get a test screen.…  Now if you want to debug it, or catch errors you need to use a tool called Putty that got installed with the SDK.

When your WebOS emulator/virtual machine is running go to a command prompt (or click Start —> Run) and run the following…

putty -ssh -P 5522 localhost -l root -pw ”

This connects you to the linux machine running on your virtual phone.…  Then to debug javascript or trap javascript errors type…

debug

To add a point where you want to stop the program type…

break /var/usr/palm/applications/com.YourCompany.YourAppName/app/assistants/first-assistant.js:100

This will pause the application named “com.YourCompany.YourAppName” when it hits line 100 in the “first-assistant.js” file.

When it’s paused you can type things like…

print Variable1

This will print the contents of Variable1 (Up to the first 80 characters, if somebody knows how to print more, comment here, I’d love to know).

You can then type

c

To continue.

or…

clear 1

To clear the first break point.

Type

finish

to finish off the application.

I couldn’t find an example of how to debug out there, so I hope this helps at least one person.

For more debugging commands check out Palm Debugger Commands.