How to debug ROS package [closed]
Hi!
I'm new to C++ and ROS.
Recently, I want to add some breakpoints and debug these ROS libraries step by step to learn how these member functions are called and run.
However, I found that all the functions of these ROS libraries are linked to .h
files and I cannot see what is inside these functions.
Are there any available ways?
Thanks in advance!
This is a generic c++ question about debugging not about ROS or robotics. I recommend that you read up on gdb and search for some tutorials on c++ debugging with gdb. Header based implementations are still debuggable.
Hi! @tfoote As far as I know, installing via
sudo apt-get install
only installs some necessary binaries files, and hence I can only retrieve the header file. In contrast,source install
can keep somecpp
files and I can add breakpoints or modify these ROS packages. Am I right?You're right about the default debs not installing the source files by default. But you're talking about linking to headers and the debug symbols are what you want mostly. I would suggest that you learn how to use a debugger on a much smaller program before trying to jump right into a full ROS system. The use of debuggers is a skill that you will want to develop incrementally. There's a lot of documentation of that elsewhere that's not ROS specific. You'll be much better off learning it there. And then in that context ROS is just like any other c++ library when you know how to setup and use your choice of debugger.
Thanks for your instruction!