Debugging segmentation faults on UC

We recently ran into a problem where our application would segfault when ran on an RPi4 running UC 18 arm64.

In other environment when an application segfaults, I typically restart the process with gdb attached or run it through valgrind, but these tools aren’t readily available on UC 18. So what to do?

We staged gdb in the snap:

      - gdb

and updated the run script from exec ulf_kiosk to:

exec gdb ulf_kiosk -ex "set width 1000" -ex "thread apply all bt" -ex run -ex bt -ex "set confirm off" -ex quit

When the segfault is triggered, the app now shows the backtrace:

Thread 1 "ulf_kiosk" received signal SIGSEGV, Segmentation fault.
0x0000fffff4bd899c in ?? () from /snap/opennms-minion-kiosk/x11/usr/lib/aarch64-linux-gnu/
#0  0x0000fffff4bd899c in ?? () from /snap/opennms-minion-kiosk/x11/usr/lib/aarch64-linux-gnu/
#1  0x0000aaaaab3bd000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Hope this helps anyone trying to debug segfaults on the platform.

Please share any tips and tricks if you know a better way :slight_smile: