Debugging

Last update on Friday, 28-Jul-2006 16:20:27 CDT.

Debugging

This subsection of necessity contains a summary account on core debugging. The "General Programming Concepts: Writing and Debugging Programs" guide from IBM is another good resource for these and other topics.

dbx, pdbx

The serial command-line IBM debugger is called dbx. The parallel command-line IBM debugger is called pdbx.

idebug

VisualAge C++ and C for AIX come with the graphical debugger called idebug. Under some situations, xlf compiled code will not work properly with idebug.

Debugging in Batch Jobs

If the problem only arises after the program runs for a long time, or in a case where large amounts of memory is used, interactive debugging does not remain possible. In this case, you wish to capture the core file and run the debugger in a batch job.

Saving the Core File

To save the core file, check for existence of core file once your program terminates.

Example Job File (captures the core file)

  #!/usr/bin/ksh
  #BSUB -N run -s /usr/bin/ksh -o debug.%J
  cd $TMPDIR
  cp $HOME/crash .
  ./crash
  if [ -f core ] ; then
          cp core $HOME
  fi
  cp crash.out $HOME

Running debugger in batch mode

Create a debugger command file (call "dbx.commands")

Example "dbx.commands" File

  where
  dump .
  print xsect, temp, pres, vel, coeff
  quit

The batch job should be similar to the following

  #BSUB -N run -s /usr/bin/ksh -o debug.%J
  cd $TMPDIR
  cp $HOME/crash $HOME/core $HOME/dbx.commands .
  dbx -c dbx.commands crash core

The job's output file (debug.out) will contain the results of the "where" and "dump" commands given to "dbx". As the user finds more information, he can add more commands in "dbx.commands" file to pin-point the cause of the error.

Trapping XL Fortran Floating Point Exceptions

Click here for HOWTO trap XL Fortran Floating Point Exceptions