debug gdb and ROS
I have been trying to debug my rosnode with gdb because I am getting a segmentation fault. My package name is renv
and the executable inside it is names env
I can run rosrun renv env --env 1
and it works. When I do rosrun renv env --env 2
it gives me a SegFault.
I tried:
gdb --args rosrun renv env --env 2
and gdb says rosrun is not executable (makes sense as it's a shell script)
gdb --args renv env --env 2
and gdb says renv not found
gdb --args env --env 2
and gdb gets confused and trued running /usr/bin/env
I have enabled debugging symbols in CMake using
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
endif()
And I find a lot of answers pointing to Roslaunch nodes and gdb + valgrind ... and It's difficult for me to understand that ... I think it says to use gdb --args
for the gdb part - But I don't know what to put after that :P