How debug my own library code on CLion IDE

Viewed 104

I'm using Jetbrain CLion to write and test library code. I create two directories which include shared library code and test code respectively (each has its own CMakeLists.txt).

But when I clicked "Debug" of the test code, it failed to hook to the breakpoints.

Please let me know how to setup. Thanks

1 Answers

I just ran into this issue myself. After much desperation the "fix" for me was changing clion debugging settings to use gdb rather than the embedded lldb one. Not a great solution for me but at least I can do basic debugging at the moment without resorting to something even worse than clion like straight lldb or some other nonsense.

For me the issue seemed to start to happen after I added more shared code that is also compiled in a loaded library into the main executable as well. The main executable loads and runs this library. That is, just sharing a few more utility cpp/h files in both the executable and the library. This isn't the first time that I've added code like this in the main executable but somehow it hit some sort of tipping point yesterday in clion where it can't keep track of symbols in the library anymore. So now it is not able to load any symbols from my library. Also, any crashes in the library just show up in the debugger in the main executable as if it was a crash in any old library that was not compiled with debug symbols.

I confirmed that running a version of lldb outside of clion works correctly with the same binaries.

Related