I’m building a running a ROS project from gitHub (https://github.com/niobegrzegorzdec/lsd_slam) which is setup specifically for Ubuntu 20.04 with ROS Noetic installed and a catkin workspace. I can build the project and run it fine from the term window. I can also build it and launch it from within VS Code using the ROS VS plugin. I can add printf statements to the code and see them execute when the code is launched.
But if I add breakpoints to the code in VS Code, they never break even at these printf statements that are clearly executing.
I’ve scoured the ROS and other blogs to no avail (other than see this seems to be a very common issue). I know in my last job we were able to hit breakpoints in ros nodes so it seems possible. My guess is that there’s some env variable or setup.bash missing to make the executable visible to gdb in VS code. Right now I know the ros node executables catkin built are located in catkin_ws/devel/lib//, but maybe VS isn’t looking there for some reason.
So, when I build and run the program launches and displays the correct data. It also prints out messages I added to the code. But when I set a breakpoint at those print statements (or anywhere else) I get “Module containing this breakpoint has not yet loaded or the breakpoint address could not be obtained.” from VS Code.
When I cloned another github project VS_Code_ROS and build it in the very same ROS/Catkin/VS environment, I can set breakpoints and break at them. But despite being a “ROS” program, it does launch using ros commands like roslaunch. It’s really just a classic C++ executable.
Steve White is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.