-
Notifications
You must be signed in to change notification settings - Fork 15
Debugging
What to do when application is crashing?
First, try to reproduce the crash. Second, create issue on GitHub and try to describe what happen before the crash and when possible, how to reproduce it. It is possible that author of the application will not be able to reproduce it (there may be something specific to your device, used map database...). I will guide you what information may be useful then.
Start with article Howto build for Sailfish OS to be familiar with crosscompilation.
Edit rpm/harbour-osmscout.spec
:
- configure "debug" type of CMake build (
-DCMAKE_BUILD_TYPE=DEBUG
) - remove stripping of debug symbols from binary (just comment line with
strip
command)
Build rpm package with unstripped binary and install it on device.
Connect to device via ssh (using nemo
user), enable creation of coredumps and run process:
ulimit -c unlimited
harbour-osmscout
Reproduce crash, process should generate core.$PID
in home directory.
Mount phone filesystem via sshfs
and open coredump in gdb-multiarch
:
mkdir -p sysroot-dir
# replace "jolla" by address of your device
sshfs nemo@jolla:/ sysroot-dir
gdb-multiarch ./sysroot-dir/usr/bin/harbour-osmscout ./sysroot-dir/home/nemo/core.XXXXX
Then setup sysroot for gdb
and inspect stack trace, variables...
set debug-file-directory sysroot-dir/usr/lib/debug/
set sysroot sysroot-dir
info threads
bt full
Run gdbserver on phone:
gdbserver :12345 /usr/bin/harbour-osmscout
Mount device filesystem via sshfs
and open debugger
mkdir -p sysroot-dir
# replace "jolla" by address of your device
sshfs nemo@jolla:/ sysroot-dir
gdb-multiarch ./sysroot-dir/usr/bin/harbour-osmscout
Setup debugger, breakpoints (...) and continue with executing
set debug-file-directory sysroot-dir/usr/lib/debug/
set sysroot sysroot-dir
# setup path to source code
set substitute-path /home/mersdk/share/SailfishOS/projects/ $(HOME)/SailfishOS/projects/
target remote jolla:12345
continue