How do you examine core files in dbx?

35.8k views Asked by At

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!

2

There are 2 answers

0
CoreyStup On

core files are created in the current working directory of a process. Check with getcwd(), set with chdir().

dbx [ -a ProcessID ] [ -B DebugFile ] [ -c CommandFile ] [ -I Directory ] [ -E DebugEnvironment ] [ -p oldpath=newpath:...| pathfile ] [ -u ] [ -F ] [ -r ] [ -x ] [ -v ] [ -C CoreFile | ObjectFile [ CoreFile ] ]

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.

0
JacquelineIO On

I do okay stepping through a run but also am not sure about debugging a core. I found these commands are probably the ones to focus on. There are probably more.

Once you have your core running in dbx:

  1. 'where' -- to show the stack
  2. 'up' or 'down' -- to move through the frames and then you
  3. 'print var' -- display the variables
  4. and 'list' or 'edit' -- will display the file information at that current location

Looking here under "Examining Data" helped me out.