For debugging an app the first step is, of course, to use a full-capabilities desktop browser such as Firefox with all its available tools. But once the app is installed on a platform (cf. Platform-specific details of app installation) it becomes a native app, it is run from inside the webapp runtime and things get more complicated.
To debug problems when an app is running inside the webapp runtime one can run it from the command line by enabling the old (but still useful) Error Console.
For example if an App comes from http://areatweet.com/ and is installed in
$HOME/.http\;areatweet.com/ (this is the case for a Linux Desktop cf. Platform-specific details of app installation) the webapp runtime will be found in this directory. One should then run the webapp runtime with the debugging option as follows:
Note that on Windows the webapp runtime is not named
webapprt-stub but is named after the name of the App, but the principle remains the same.
Read Hacking Firefox OS for more information on debugging.