[gmx-developers] stepping through libgromacs

Eric Irrgang ericirrgang at gmail.com
Mon Feb 27 21:34:25 CET 2017


lldb works well. Thanks for the tip!

On Mon, Feb 27, 2017 at 3:06 PM, David van der Spoel <spoel at xray.bmc.uu.se>
wrote:

> 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
>> different.
>>
>> 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.
>> https://sourceware.org/bugzilla/show_bug.cgi?id=20981
>> 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``
>> https://forums.docker.com/t/gdb-breakpoints-dont-work-error-
>> disabling-address-space-randomization/14365/2
>>
>> VirtualBox has similar problems if you are optimistic enough to try
>> running Docker and VirtualBox at the same time, but you shouldn't.
>> https://www.virtualbox.org/manual/ch10.html#hwvirt
>>
>> 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
> --
> Gromacs Developers mailing list
>
> * Please search the archive at http://www.gromacs.org/Support
> /Mailing_Lists/GMX-developers_List before posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers
> or send a mail to gmx-developers-request at gromacs.org.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20170227/19268fae/attachment.html>


More information about the gromacs.org_gmx-developers mailing list