backtrace

Kernel Stack Traceback

If you have hung processes, capture a stack traceback to show where the processes are waiting in the kernel. You will need to build your kernel with the CONFIG_MAGIC_SYSRQ option (under Kernel Hacking) to enable stack traceback.
First, look in /etc/sysctl.conf to see if kernel.sysrq is set to 1. If not, then run this command:

echo 1 > /proc/sys/kernel/sysrq

Next, trigger a stack traceback via this command:
echo t > /proc/sysrq-trigger

Look on your console or in /var/log/messages for the output.

Getting a live backtrace

 pstack pid

or use gdb to attach to the running process
and then using "where" to print the backtrace
gdb prog pid

gdb apache2 26219
...
(gdb) where
#0 0xb7799424 in __kernel_vsyscall ()
#1 0xb7689b7b in semop () from /lib/i686/cmov/libc.so.6
#2 0xb7731a4f in ?? () from /usr/lib/libapr-1.so.0
#3 0x01158003 in ?? ()
#4 0xb7746548 in ?? () from /usr/lib/libapr-1.so.0
#5 0x00000001 in ?? ()
...

https://wiki.ubuntu.com/Backtrace