strace is a program which logs system calls coming from a process or
program. It's a feature of Unix that isn't found on systems like lose95 or
NT. For beginners, it's easier than debugging the core file.
Quite often, the reason why a program dies is because a system_call
failed.
You can go through a whole stack of C-codes and find that the program is
unable to open an configuration file OR you can just strace the program.
% strace -o /tmp/whatswrong.txt progwhichcrash
Quit (core dumped)
% grep open /tmp/whatswrong.txt
open("/usr/local/lib/theconfig.cfg", O_RDONLY) = -1 ENOENT (No
such file or directory)
If strace doesn't give you the exact result, it would at least give you a
piece of info to point you in the right direction for solving the problem.
One last thing. To avoid large "whatswrong.txt" files, you can start the
strace AFTER the program has been running for a while.
% ps aux |grep netscape
st2 28474 0.2 16.5 13476 10424 1 S 20:09 2:06 netscape
st2 30669 0.0 0.5 920 328 p1 R 12:18 0:00 grep netscape
% strace -o /tmp/shortlog.txt -p 28474
^^^^PID of the program
So, remember Luke, USE THE STRACE!!
-- st2