title: CLion - how to configure to attach to existing process for debugging a .dylib
body: <p>I am developing a plugin for a third-party host application on MacOS that compiles as a .dylib (with associated DSYM directory). The .dylib and DSYM directory is automatically copied to the host's plugin directory by a supplied build script. The build script uses <code>clang</code> to build the .dylib. The host application is able to open the plugin.</p>
  
  <p>With Xcode, I am able to debug the .dylib with <code>lldb</code> within Xcode, because Xcode is somehow able to identify that the sources match the dylib once it is loaded.</p>
  
  <p>I wish to set up a similar system with CLion, however I have not been able to get CLion to associate the breakpoint lines in the source with the dylib. When I create a breakpoint in the source it warns me that "Breakpoint will not currently be hit. No executable code is associated with this line". I almost expect this kind of warning because the image hasn't been loaded into the host application yet. However loading the plugin does not trigger the breakpoints.</p>
  
  <p>I tried setting the Configuration's Executable to the .dylib, and setting the working directory to the location of the .dylib and the DSYM directory (this is what I have to do when running lldb manually), and this does not seem to help.</p>
  
  <p>My questions are:</p>
  
  <ol>
  <li>Does CLion use <code>lldb</code> internally?</li>
  <li>Is what I am trying to do possible with CLion?</li>
  <li>If so, what is the correct configuration for this situation?</li>
  </ol>
  
  <p>One important thing to note is that I am not building the .dylib with CLion directly, it is build by an external build system, I am just trying to debug the resulting image with CLion, which I understand should work (it works with Xcode &amp; lldb at least). I have a basic <code>CMakeLists.txt</code> that is sufficient for CLion to understand the code base, but it is not used to build it (beyond any background compilation that CLion might do to check syntax etc).</p>