I'm working on AIX and have a process that keeps crashing. I've never examined core files, and would like some guidance if possible. I'm using dbx. How can I (a) make sure the core file is going where I want it to go and (b) see the state of the process before it crashed?
Thanks!
core files are created in the current working directory of a process. Check with
getcwd()
, set withchdir(
).Load your program into dbx with
dbx /path/to/progname /path/to/corefile
and you can start looking at your stack trace ("where" command, etc).If you don't specify a
corefile
dbx will automatically load a matching file named "core" if its in the same directory as the program loaded (and they match signatures).Read the man page on dbx, it gives all the debugging commands you'll need.
Also note that your program will have needed to be compiled with debugging symbols enabled (and not later 'strip'ed) in order for the stack trace to be the most useful. Without debugging symbols you'll see the function names in the stack trace, but not much else.