How to Debug a segfault

ulimit -c unlimited
gdb <prog_name> core
(gdb) bt