<div dir="ltr">Hello Gromacs code enthusiasts,<div><br></div><div>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.</div><div><br></div><div>I was building Gromacs master to step through with a debugger. Problematic environments were</div><div><br></div><div> * OS X 10.12 Sierra with gdb the 7.11, 7.12, and various compilers</div><div> * 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.</div><div> * various Linux VMs running in VirtualBox on the Mac host</div><div><br></div><div>I had similar symptoms in each case, but the causes turn out to be different.</div><div><br></div><div>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.</div><div><a href="https://sourceware.org/bugzilla/show_bug.cgi?id=20981">https://sourceware.org/bugzilla/show_bug.cgi?id=20981</a><br></div><div>However, the Xcode IDE seems to be fine if cmake is first run with appropriate options.</div><div><br></div><div>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 ``--security-opt seccomp=unconfined``</div><div><a href="https://forums.docker.com/t/gdb-breakpoints-dont-work-error-disabling-address-space-randomization/14365/2">https://forums.docker.com/t/gdb-breakpoints-dont-work-error-disabling-address-space-randomization/14365/2</a><br></div><div><br></div><div>VirtualBox has similar problems if you are optimistic enough to try running Docker and VirtualBox at the same time, but you shouldn&#39;t.</div><div><a href="https://www.virtualbox.org/manual/ch10.html#hwvirt">https://www.virtualbox.org/manual/ch10.html#hwvirt</a><br></div><div><br></div><div>With some compilers I had better results from gdb with different debug compiler flags. The CMAKE_BUILD_TYPE=Debug only gave me a &#39;-g&#39;. The most universally successful cmake options were</div><div>     -DCMAKE_CXX_FLAGS_DEBUG=&#39;-O0 -g3&#39; -DCMAKE_C_FLAGS_DEBUG=&#39;-O0 -g3&#39;</div><div><br></div><div><br></div></div>