ROS launch使用gdb调试工具

ROS node报如下错误

[laserMapping-2] process has died [pid 15406, exit code -11, cmd 
/home/dji/workspace/fastlo_ws/devel/lib/fast_lio/fastlio_mapping __name:=laserMapping 
__log:=/home/dji/.ros/log/6a24a96a-0ed9-11ec-ada0-b07b2529e950/laserMapping-2.log].

ROS launch使用gdb调试工具_第1张图片
使用gdb调试工具进行调试

launch-prefix="gdb -ex run --args" 
# run your node in gdb in the same xterm as your launch without having to type runto start it

在launch文件添加如下参数
ROS launch使用gdb调试工具_第2张图片
运行launch文件
第一次运行,可能要等待十几秒,若出现
Find the GDB manual and other documentation resources online at:
--Type to continue, or q to quit ---
此时按下回车键,会出现此节点的线程状况
ROS launch使用gdb调试工具_第3张图片
此时可以正常播放rosbag,gdb会给出导致bug的语句
ROS launch使用gdb调试工具_第4张图片
我这里bug的原因是没有检查Vctor Measures.imu 是否为空,添加一个判断即不再出现process has died.

你可能感兴趣的:(ros学习笔记,gcc/gdb编译调试)