I have brought up the ros.el emacs package a number of times now, as it has become a package that I use multiple times a day. A little while ago, I had the idea to see if I could add a debugger function, to take advantage of the emacs-gdb functionality.
The implementation took me down a rabbit hole of learning about how tramp handles remote connections, as well as how gdb links shared librarys.
It has been around a year since I moved to working in ROS2 full-time. Much like the Post about using GDB in ROS1, I wanted to make a reference for myself, and potentially anyone else, for creating a decent debugging workflow for ROS2. Unlike my ROS1 guide, I will be covering launch files here, as information regarding debugging with ROS2 is a bit sparse.
Step 1: Compile with debug flags $ colcon build [flags] --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo You don’t need to build your whole workspace with debug flags, just the package you want to debug.
I wanted to write this to act as a quick lookup for anyone who needs it (Mostly me). Almost all of the guides I found mention inserting a launch-prefix into a launch file to launch gdb with the node, but I don’t like doing that. I don’t want to have start gdb from scratch and manually insert the break-points each time I want to debug. That’s goofy. Also, I’d like to use my editor’s built-in debugging tools.