Viewing stacktrace of running process using GDB
to view stacktrace of running process, run
sudo gdb -batch -quiet -nx -ex "backtrace full" -p <PID>
to view stacktrace of running process for all threads, run
sudo gdb -batch -quiet -nx -ex "thread apply all backtrace full" -p