Download and compile gromacs 5.x:

cd gromacs; mkdir build ; cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug

Then, go to the methanol example:

cd share/gromacs/tutor/methanol/
grompp

Then enter gdb console and issue some commands:

$ gdb
# that's where the gmx command lives
exec ../../build/bin/gmx
# read in the symbol table
file ../../build/bin/gmx
# break on errors
break _gmx_error
# break on do_force function
break do_force
run mdrun -debug 1 -v -s

This is not very practical - you can put the gdb commands into a file, gdb_cmds, and execute:

$ gdb -x gdb_cmds

Note gdb has a ton of useful commands, google around

References:

  • add pretty command to gdb http://stackoverflow.com/questions/23578312/gdb-pretty-printing-with-python-a-recursive-structure

  • gdb tutorial handout http://www.cs.umd.edu/~srhuang/teaching/cmsc212/gdb-tutorial-handout.pdf