Debugging

  • Use compiler flags to give warnings about basic issues at compile time.

  • Compile with -g to provide debugging symbols in executable file for use by debugger.

  • Use compiler flags to stop program on array bounds or floating point errors when run.

  • Try your code with various compilers on a variety of systems.

  • Use printf or WRITE statements liberally to examine variables, but, if the output is more than 10 MB, say, open a named file for the debugging output.

  • Visualizing data (graphing, rotating, etc.) is useful for debugging.

  • Explaining a program to someone else often helps you find your own mistakes.

  • WestGrid technical staff are happy to help with debugging problems.

  • Various debuggers are available on the WestGrid systems.

    • See list at www.westgrid.ca/support/software/#programming

    • Some debuggers (dbx, gdb, idb, ladebug) are suitable for character-based terminals, while others (pgdbg, cvd, totalview and the ddd interface to dbx and gdb) provide a graphical interface that requires an X Window connection.

  • [Demo...]


Last modified: 2007-11-07

Direct questions to support@westgrid.ca .