Debugging roscpp file with gdb

asked 2021-08-21 21:15:30 -0500

KhalidOwlWalid gravatar image

updated 2021-08-21 21:16:16 -0500

Hi, I am still a beginner but I just wanted to share some info about how I debug my rosnode with gdb

The problem that I was facing was that I had problems with this error:

> segmentation fault (core dumped)

So, the steps that I have taken to debug my file is generally:

Add this line to your CMakeLists.txt : set (CMAKE_CXX_FLAGS "-g")

If not, you will receive this error:

(No debugging symbols found in /home/user/catkin_ws/devel/lib/my_custom_srv_msg_pkg/my_custom_service_message)

Then, compile your file

Run this command in your terminalrosrun --prefix 'gdb --args' <your_package_name> <Your_executable_file>

Done. Hope it helps anyone who needs it!

Reference :

https://answers.ros.org/question/1698... https://answers.ros.org/question/2112...

Please correct me if I give out some wrong info.

edit retag flag offensive close merge delete