I haven’t used this extensively, but worth documenting for future reference:
# /etc/init.d/httpd stop # gdb /usr/sbin/httpd GNU gdb Red Hat Linux (6.5-37.el5_2.2rh) Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux-gnu"... (no debugging symbols found) Using host libthread_db library "/lib/libthread_db.so.1". (gdb) run -X
At this point, go ahead and hit the site in an attempt to reproduce the segmentation fault. Once you’ve got a segmentation fault (it should return you to the (gdb) shell), run:
(gdb) backtrace
That should hopefully give you some indication as to where the segmentation fault is happening.
Update: You can also ‘bind’ to a running process by doing:
# gdb -p <pid>