Difference between revisions of "GDB"

From HCL
Jump to: navigation, search
(Created page with "Debugging with GDB compile programme with -g -o0 (or ./configure --enable-debug) For serial programme gdb ./programme_name")
 
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
 
compile programme with -g -o0 (or ./configure --enable-debug)
 
compile programme with -g -o0 (or ./configure --enable-debug)
  
For serial programme
+
For serial programme (or MPI running with 1 process)
 
  gdb ./programme_name
 
  gdb ./programme_name
 +
 +
To debug MPI application in parallel
 +
add this line to somewhere in the code:
 +
if (!rank) getc(stdin); MPI_Barrier(MPI_COMM_WORLD);
 +
 +
Then run the code and it will hang on that line.
 +
 +
If you get the gdb error:
 +
fupermod_....c: No such file or directory.
 +
 +
Run the following command to add to gdb's source directories to be searched:
 +
directory ~/fupermod/

Latest revision as of 14:52, 23 July 2012

Debugging with GDB

compile programme with -g -o0 (or ./configure --enable-debug)

For serial programme (or MPI running with 1 process)

gdb ./programme_name

To debug MPI application in parallel add this line to somewhere in the code:

if (!rank) getc(stdin); MPI_Barrier(MPI_COMM_WORLD);

Then run the code and it will hang on that line.

If you get the gdb error:

fupermod_....c: No such file or directory.

Run the following command to add to gdb's source directories to be searched:

directory ~/fupermod/