More power to debug: Attach to local process
With the recent 1.5 EAP build we’ve announced a new feature called Attach to local process. Let’s take a closer look at it.
In general, you can find the information about debugging in CLion in the corresponding blog post, it also includes a short demo. So in case you are interested in various breakpoints types supported in CLion, built-in debugger UI, ways to evaluate and view variables, please, refer to the post to learn the details. These topics are also covered in our webhelp in details.
Since the first CLion Public Early Access preview build we’ve been getting questions on remote toolchains support, including remote debugging. To make the very first step in that direction we’ve started with attaching to local process functionality. In a nutshell, it allows you to debug processes, run on the same machine as CLion, by attaching to them using their pid or process name.
Currently in CLion attach to local process is available for GDB on Linux and Windows and LLDB on OS X (so not available for GDB on OS X). You can find the corresponding action in the Run menu of the IDE:
or call it via Find Action dialog (
Shift+Ctrl+A on Linux/Windows,
⇧⌘A on OS X). All the processes will be listed in the dialog (Rem. Please, mind two problems we are currently aware of here – IDEA-150592 and IDEA-150591):
To simplify the search, just start typing either the name of the process:
or its pid:
Select process to attach with CLion and now you can debug it with all the usual staff available in the IDE, including breakpoints, stepping, variable views, etc.
To detach click the ‘Stop the process’ button in the debugger toolwindow in the IDE (we’ll make the name more accurate in the later builds, since currently it detaches and doesn’t stop the process of course – CPP-5629).
Upd. Find the prerequisites for Ubuntu users in our webhelp.
In the end, let us also share feature requests related to the topic that you can find interesting. Feel free to leave comments, upvote and share your personal use cases (they really help us to figure out the proper implementation and UI, so thank you in advance!):
- Debug forked child processes (CPP-955).
- Debug arbitrary binary (CPP-1313).
- Attach to Existing Process: add re-run button (OC-3352).
- Remote debug (CPP-5539).
That’s it! Download the build and give it a try.
The CLion Team
Subscribe to Blog updates
Thanks, we've got you!
Introducing the New CLion Conan Plugin
We are thrilled to announce the launch of the new version of the Conan CLion Plugin, now compatible with the 2.X versions of Conan.
How To Address 7 Major C++ Pain Points with CLion
The top major C++ pain points have remained unchanged in recent years. How can a modern IDE help address these pain points?
How To Debug C++ Code Efficiently: Disassemble On Demand
CLion 2023.1 brought the ability to explore assembly code even when the source code is available. A new Disassemble action has been added to improve your debugging experience, help you catch issues, and eliminate inefficiencies in the code. When debugging C or C++ code in CLion, you can explore th…