Using GDB with ROS2, a reference
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.