[gmx-developers] stepping through libgromacs
ericirrgang at gmail.com
Mon Feb 27 20:45:23 CET 2017
Hello Gromacs code enthusiasts,
Michael suggested I share some observations made while trying to step
through Gromacs with GDB in case they warrant further attention or are
useful to others, though none are particularly Gromacs-specific.
I was building Gromacs master to step through with a debugger. Problematic
* OS X 10.12 Sierra with gdb the 7.11, 7.12, and various compilers
* various Debian/Ubuntu based Docker containers running in the Mac OS
host, gdb 7.11, 7.12, gcc 4.9, various gcc 5 and 6.
* various Linux VMs running in VirtualBox on the Mac host
I had similar symptoms in each case, but the causes turn out to be
OS X 10.12 changed something about the way dynamic linking works, and it
appears that gdb does not know how to find the source code and debugging
symbols after execution passes into a shared library, so it is hard to step
into functions called by, say, gmx, or to set break points.
However, the Xcode IDE seems to be fine if cmake is first run with
By default, a Docker container does not have sufficient access to the
memory to keep track of what function it is in after crossing into the
shared library, but this is overcome by running the Docker container with
VirtualBox has similar problems if you are optimistic enough to try running
Docker and VirtualBox at the same time, but you shouldn't.
With some compilers I had better results from gdb with different debug
compiler flags. The CMAKE_BUILD_TYPE=Debug only gave me a '-g'. The most
universally successful cmake options were
-DCMAKE_CXX_FLAGS_DEBUG='-O0 -g3' -DCMAKE_C_FLAGS_DEBUG='-O0 -g3'
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gromacs.org_gmx-developers