<div dir="ltr">lldb works well. Thanks for the tip!</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 27, 2017 at 3:06 PM, David van der Spoel <span dir="ltr">&lt;<a href="mailto:spoel@xray.bmc.uu.se" target="_blank">spoel@xray.bmc.uu.se</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 27/02/17 20:44, Eric Irrgang wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello Gromacs code enthusiasts,<br>
<br>
Michael suggested I share some observations made while trying to step<br>
through Gromacs with GDB in case they warrant further attention or are<br>
useful to others, though none are particularly Gromacs-specific.<br>
<br>
I was building Gromacs master to step through with a debugger.<br>
Problematic environments were<br>
<br>
 * OS X 10.12 Sierra with gdb the 7.11, 7.12, and various compilers<br>
 * various Debian/Ubuntu based Docker containers running in the Mac OS<br>
host, gdb 7.11, 7.12, gcc 4.9, various gcc 5 and 6.<br>
 * various Linux VMs running in VirtualBox on the Mac host<br>
</blockquote>
<br></span>
why not use the lldb debugger on mac os x?<div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I had similar symptoms in each case, but the causes turn out to be<br>
different.<br>
<br>
OS X 10.12 changed something about the way dynamic linking works, and it<br>
appears that gdb does not know how to find the source code and debugging<br>
symbols after execution passes into a shared library, so it is hard to<br>
step into functions called by, say, gmx, or to set break points.<br>
<a href="https://sourceware.org/bugzilla/show_bug.cgi?id=20981" rel="noreferrer" target="_blank">https://sourceware.org/bugzill<wbr>a/show_bug.cgi?id=20981</a><br>
However, the Xcode IDE seems to be fine if cmake is first run with<br>
appropriate options.<br>
<br>
By default, a Docker container does not have sufficient access to the<br>
memory to keep track of what function it is in after crossing into the<br>
shared library, but this is overcome by running the Docker container<br>
with ``--security-opt seccomp=unconfined``<br>
<a href="https://forums.docker.com/t/gdb-breakpoints-dont-work-error-disabling-address-space-randomization/14365/2" rel="noreferrer" target="_blank">https://forums.docker.com/t/gd<wbr>b-breakpoints-dont-work-error-<wbr>disabling-address-space-random<wbr>ization/14365/2</a><br>
<br>
VirtualBox has similar problems if you are optimistic enough to try<br>
running Docker and VirtualBox at the same time, but you shouldn&#39;t.<br>
<a href="https://www.virtualbox.org/manual/ch10.html#hwvirt" rel="noreferrer" target="_blank">https://www.virtualbox.org/man<wbr>ual/ch10.html#hwvirt</a><br>
<br>
With some compilers I had better results from gdb with different debug<br>
compiler flags. The CMAKE_BUILD_TYPE=Debug only gave me a &#39;-g&#39;. The most<br>
universally successful cmake options were<br>
     -DCMAKE_CXX_FLAGS_DEBUG=&#39;-O0 -g3&#39; -DCMAKE_C_FLAGS_DEBUG=&#39;-O0 -g3&#39;<br>
<br>
<br>
<br>
<br>
</blockquote>
<br>
<br></div></div><span class="HOEnZb"><font color="#888888">
-- <br>
David van der Spoel, Ph.D., Professor of Biology<br>
Dept. of Cell &amp; Molec. Biol., Uppsala University.<br>
Box 596, 75124 Uppsala, Sweden. Phone:  <a href="tel:%2B46184714205" value="+46184714205" target="_blank">+46184714205</a>.<br>
<a href="mailto:spoel@xray.bmc.uu.se" target="_blank">spoel@xray.bmc.uu.se</a>    <a href="http://folding.bmc.uu.se" rel="noreferrer" target="_blank">http://folding.bmc.uu.se</a><br>
-- <br>
Gromacs Developers mailing list<br>
<br>
* Please search the archive at <a href="http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List" rel="noreferrer" target="_blank">http://www.gromacs.org/Support<wbr>/Mailing_Lists/GMX-developers_<wbr>List</a> before posting!<br>
<br>
* Can&#39;t post? Read <a href="http://www.gromacs.org/Support/Mailing_Lists" rel="noreferrer" target="_blank">http://www.gromacs.org/Support<wbr>/Mailing_Lists</a><br>
<br>
* For (un)subscribe requests visit<br>
<a href="https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers" rel="noreferrer" target="_blank">https://maillist.sys.kth.se/ma<wbr>ilman/listinfo/gromacs.org_gmx<wbr>-developers</a> or send a mail to <a href="mailto:gmx-developers-request@gromacs.org" target="_blank">gmx-developers-request@gromacs<wbr>.org</a>.<br>
</font></span></blockquote></div><br></div>