To determine where your program is crashing, you might want to examine the core file, which is the memory image of your program when it crashed. You can use the where command to determine where the program was executing when it dumped core. See where Command
$ dbx program-name core
or
$ dbx - core
In the following example, the program has crashed with a segmentation fault and dumped core. First, dbx s started with the core file loaded. Then, the where command displays a stack trace, which shows that the crash occurred at line 9 of the file foo.c.
% dbx a.out core Reading a.out core file header read successfully Reading ld.so.1 Reading libc.so.1 Reading libdl.so.1 Reading libc_psr.so.1 program terminated by signal SEGV (no mapping at the fault address) Current function is main 9 printf("string ’%s’ is %d characters long\n", msg, strlen(msg)); (dbx) where [1] strlen(0x0, 0x0, 0xff337d24, 0x7efefeff, 0x81010100, 0xff0000), at 0xff2b6dec =>[2] main(argc = 1, argv = 0xffbef39c), line 9 in "foo.c" (dbx)
For more information about debugging core files, see Debugging a Core File. For more information about using the call stack, see Looking at the Call Stack.