User:MarkFinkle/MaemoDebugging: Difference between revisions
MarkFinkle (talk | contribs) No edit summary |
MarkFinkle (talk | contribs) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 23: | Line 23: | ||
</pre> | </pre> | ||
Now you can copy the binaries to the device. Because the debug binaries are larger than the release versions, you probably want to copy the application to <code>/media/mmc2</code> since it has much more space available: | Now you can copy the binaries to the device. Because the debug binaries are larger than the release versions, you probably want to copy the application to <code>/media/mmc2</code> (N810) or <code>/opt</code> (N900) since it has much more space available: | ||
<pre> | <pre> | ||
> scp fennec-archive.tar.bz2 root@192.168.10.100:/media/mmc2 | > scp fennec-archive.tar.bz2 root@192.168.10.100:/media/mmc2 | ||
| Line 31: | Line 31: | ||
==GDB== | ==GDB== | ||
===Device=== | |||
In order to use <code>gdb</code> or <code>gdbserver</code> on the device, you'll need to install it: | In order to use <code>gdb</code> or <code>gdbserver</code> on the device, you'll need to install it: | ||
<pre> | <pre> | ||
| Line 46: | Line 47: | ||
</pre> | </pre> | ||
===Desktop/Scratchbox=== | |||
Running <code>gdb</code> on the device may be more pain than you can bear. Loading symbols from <code>libxul.so</code> can cause the device to reboot from OOM. | Running <code>gdb</code> on the device may be more pain than you can bear. Loading symbols from <code>libxul.so</code> can cause the device to reboot from OOM. | ||
| Line 68: | Line 70: | ||
You should now be running Fennec on the device and debugging on your desktop. | You should now be running Fennec on the device and debugging on your desktop. | ||
'''Note:''' You can install some helper scripts into scratchbox to make it easier to debug applications. Checkout [http://maemo.org/development/tools/doc/chinook/maemo-debug-scripts/ maemo-debug-scripts] to find information on installing and using these scripts. One example is using ''native-gdb'' in place of ''gdb'' inside scratchbox. | |||
Latest revision as of 03:13, 29 July 2010
I had no previous development experience on Linux before working on Fennec. However, we use the tools we have, so I started playing with gdb and gdbserver.
Debug Symbols
To debug Fennec/XULRunner, you'll need a build with at least debug symbols. Creating full debug builds in scratchbox has failed many times. Using debug symbols is a little more lightweight.
Add the following to you mozconfig:
export MOZ_DEBUG_SYMBOLS=1 ac_add_options --enable-debugger-info-modules=yes
Packaging
Now the Fennec/XULRunner binaries have debug symbols. However, the packaging phase will strip the symbols. You need to disable the strip.
In mozconfig:
ac_add_options --disable-install-strip
Or, if you already have a build:
> make package PKG_SKIP_STRIP=1
Now you can copy the binaries to the device. Because the debug binaries are larger than the release versions, you probably want to copy the application to /media/mmc2 (N810) or /opt (N900) since it has much more space available:
> scp fennec-archive.tar.bz2 root@192.168.10.100:/media/mmc2
Note: I assume you have openssh installed on your device.
GDB
Device
In order to use gdb or gdbserver on the device, you'll need to install it:
> apt-get install gdb
Since the debug binaries are on the device, you could use gdb on the device:
> gdb ./fennec
If you have a core dump file, you can load it too:
> gdb ./fennec [path/to/coredump]
Desktop/Scratchbox
Running gdb on the device may be more pain than you can bear. Loading symbols from libxul.so can cause the device to reboot from OOM.
Instead of running locally, you can try running remotely. You can use gdbserver to run the application on the device and remote back to gdb which is running on your desktop, in scratchbox.
On the device:
> gdbserver host:5555 ./fennec
gdbserver will now listen for incoming connections.
On the desktop:
> gdb (gdb) target remote 192.168.10.100:5555 (gdb) symbol-file /path/to/libxpcom.so (gdb) symbol-file /path/to/libmozjs.so (gdb) symbol-file /path/to/libxul.so (gdb) continue
You should now be running Fennec on the device and debugging on your desktop.
Note: You can install some helper scripts into scratchbox to make it easier to debug applications. Checkout maemo-debug-scripts to find information on installing and using these scripts. One example is using native-gdb in place of gdb inside scratchbox.