[gmx-developers] stepping through libgromacs
David van der Spoel
spoel at xray.bmc.uu.se
Mon Feb 27 21:06:24 CET 2017
On 27/02/17 20:44, Eric Irrgang wrote:
> 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 environments were
> * 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
why not use the lldb debugger on mac os x?
> 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
> appropriate options.
> 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``
> 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'
David van der Spoel, Ph.D., Professor of Biology
Dept. of Cell & Molec. Biol., Uppsala University.
Box 596, 75124 Uppsala, Sweden. Phone: +46184714205.
spoel at xray.bmc.uu.se http://folding.bmc.uu.se
More information about the gromacs.org_gmx-developers