Sometimes using gdb on a server can result in deadlock. You can still use gdb by using the "set noninvasive" option. This indicates to gdb to not stop the program but allows you to nevertheless examine its state. Thus, you can get back traces and value of variables (and watch them change underneath you).