Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
CLion Fails to Debug `cc_binary` target on macOS #494
I've written a hello world
I've created a repository, dwtj/clwb-bugs-example, to demonstrate the problem. It includes analogous CMake and Bazel builds of this program.
When I use CLion+CMake, I can debug
The red popup error says:
Here, "Configure" is a link to CLion's "Preferences" > "Build, Execution, Deployment" > "Toolchains". Here's what that looks like for me:
There are three choices in the "Debugger" drop-down menu:
Note that there doesn't seem to be a "Custom LLDB" option. For varying reasons, all of these options fail in my CLion+Bazel project.
As described above, "Bundled LLDB" seems to work fine in CLion+CMake, but it fails with the red popup error in CLion+Bazel.
When I chose this option, I get "a file format not recognized error." This happens for both CLion+CMake and CLion+Bazel.
I guess this makes sense, since my Clang/LLVM toolchain is building the program in either case, and evidently GDB won't work on a Clang-built executable. Here's the image:
Custom GDB Executable:
I don't have GCC/GDB installed on my system, so I don't have a "Custom GDB Executable" to select.
However, if I try to use
My Testing Environment
Also encountering this issue, same symptoms.
CLion version: 2018.3.4
The suggestion above to
The solution from #494 (comment) still works, you have to chmod the correct gdbserver.
if you're using CLion 2018.3.
if you're using CLion 2019.1.
CLion removes the executable permission on the gdbserver script if the plugin is installed through the marketplace. Don't need to worry about the executable bit if we always run directly under bash. PiperOrigin-RevId: 250287356
@chaoren This issue is specifically for macOS. I think your solution applies only for Linux. On macOS the folders you are describing do not exist. The corresponding folder on macOS appears to be
I think there's still another issue with the plugin on macOS (separate from the red popup error which seems to have been fixed, and separate from bazel issue bazelbuild/bazel#6327).
There's a workaround discussed in bazelbuild/bazel#6327: adding
I'm using plugin version 2019.11.14.0.1 and I also tried the patched version in #494 (comment) above (same behavior). CLion does seem to be using LLDB because the Debug tool window includes a functioning LLDB shell.