I was able to set up CLion to debug an external executable without much trouble. I've written about it here
, but will paste it below too:
I believe CLion is intended to be used as a full IDE for building CMake based projects, but using CMake is not strictly required in order to use it as a debugger.
I was able to set up CLion to debug a non-CMake built executable like this:
Start CLion, Create a new project
Name it whatever you want and put it where ever you want. This is just a throwaway project to allow you to use CLion’s interface to debug an executable of your choosing, so doesn’t even have to live inside your project’s directory. In fact, unless you want a cmake file in your project’s directory, don’t put it in there.
Once in CLion, Run Menu > Edit Configurations. Click the “Build All” item on the left and hit the delete key. This step is not strictly necessary, but I find it makes things less confusing.
You should now have just one configuration in the list with the same name as your project. Make sure it’s selected.
On the right, select the Executable dropdown and choose Select Other. Set it to the debug build of your executable. Click Ok to close the dialog.
Run Menu > Debug ‘yourprojectname’ will now launch your executable under the CLion debugger.
Drag source files in or File > Open them and set breakpoints and it should work. Click on the Debugger tab at the bottom and there will be a callstack navigator as well as locals and watches, etc.
Like basically all current graphical linux debuggers, CLion is just a frontend for GDB .
My first impressions?
Updates to the watch window when stepping are quite slow. Every time you step, it seems to remove all the items in the watch list and (very) lazily re-add them instead of just updating the values in-place. It can take a full second or more to see an update.
There are emacs keybindings available in the settings, and a vim plugin. I tried the vim plugin and it seems decent enough for the basics.
I can’t find a CPU registers view of any kind, which sucks. Hopefully I’m just missing it.
No way to attach to an already running process yet
Ability to inspect structures seems decent