GDB简单调试定位<段错误><核心转储>等

本文详细描述了如何使用GDB(GNUDebugger)对CUDA-BEVFusion项目进行调试,遇到SegmentationFault后通过backtrace定位到protobuf库版本不一致的问题,并给出了相应的解决方法。
部署运行你感兴趣的模型镜像

大致流程如下:

1.gdb打开执行文件
2.在gdb输入run

3.在gdb输入backtrace

具体示例如下,在终端用gdb打开你的执行文件:

gdb ./build/bevfusion

在gdb输入run,如下:

(gdb) run

会输出程序崩溃的提示,但是到这一步我们一般看不出具体问题,如下:

Starting program: /home/d120/bev_fusion/Lidar_AI_Solution-2023-12-27/Lidar_AI_Solution/CUDA-BEVFusion/build/bevfusion 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()

 接着在gdb输入backtrace:

(gdb) backtrace

结果如下:

#0  0x0000000000000000 in ?? ()
#1  0x00007fffe88c44bd in ?? () from /lib/x86_64-linux-gnu/libprotobuf.so.23
#2  0x00007fffe88c5f2d in google::protobuf::internal::InitSCCImpl(google::protobuf::internal::SCCInfoBase*) () from /lib/x86_64-linux-gnu/libprotobuf.so.23
#3  0x00007fffe81134ed in google::protobuf::internal::InitSCC (scc=0x7fffe82b4e60 <protobuf_google_2fprotobuf_2fany_2eproto::scc_info_Any>) at ./google/protobuf/generated_message_util.h:373
#4  0x00007fffe81134fd in protobuf_google_2fprotobuf_2fany_2eproto::AddDescriptorsImpl () at google/protobuf/any.pb.cc:88
#5  0x00007ffff7899ee8 in __pthread_once_slow (once_control=0x7fffe82b5858 <protobuf_google_2fprotobuf_2fany_2eproto::AddDescriptors()::once>, init_routine=0x7ffff7cdad50 <__once_proxy>)
    at ./nptl/pthread_once.c:116
#6  0x00007fffe81136b5 in __gthread_once (__func=<optimized out>, __once=0x7fffe82b5858 <protobuf_google_2fprotobuf_2fany_2eproto::AddDescriptors()::once>)
    at /usr/include/x86_64-linux-gnu/c++/11/bits/gthr-default.h:700
#7  std::call_once<void (&)()> (__f=<optimized out>, __once=...) at /usr/include/c++/11/mutex:783
#8  google::protobuf::internal::call_once<std::once_flag&, void (&)()> () at ./google/protobuf/stubs/once.h:91
#9  protobuf_google_2fprotobuf_2fany_2eproto::AddDescriptors () at google/protobuf/any.pb.cc:105
#10 0x00007ffff7fc947e in call_init (l=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7fffffffd6c8, env=env@entry=0x7fffffffd6d8) at ./elf/dl-init.c:70
#11 0x00007ffff7fc9568 in call_init (env=0x7fffffffd6d8, argv=0x7fffffffd6c8, argc=1, l=<optimized out>) at ./elf/dl-init.c:33
#12 _dl_init (main_map=0x7ffff7ffe2e0, argc=1, argv=0x7fffffffd6c8, env=0x7fffffffd6d8) at ./elf/dl-init.c:117
#13 0x00007ffff7fe32ca in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#14 0x0000000000000001 in ?? ()
#15 0x00007fffffffdaf2 in ?? ()
#16 0x0000000000000000 in ?? ()

根据错误提示,我编译和运行链接时,两个过程使用的protobuf版本不一致导致,这里我把protobuf版本更换一下解决了,具体解决方案根据你的报错提示而定。 

您可能感兴趣的与本文相关的镜像

PyTorch 2.5

PyTorch 2.5

PyTorch
Cuda

PyTorch 是一个开源的 Python 机器学习库,基于 Torch 库,底层由 C++ 实现,应用于人工智能领域,如计算机视觉和自然语言处理

<?xml version="1.0" encoding="UTF-8"?> <robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="mbot"> <xacro:property name="base_size" value="0.46 0.46 0.23" /> <xacro:property name="wheel_radius" value="0.06" /> <xacro:property name="wheel_length" value="0.025" /> <xacro:property name="caster_radius" value="0.015" /> <xacro:property name="z_offset" value="-0.115" /> <xacro:property name="base_mass" value="2.0" /> <xacro:property name="wheel_mass" value="0.2" /> <xacro:property name="caster_mass" value="0.1" /> <xacro:property name="camera_mass" value="0.1" /> <material name="yellow"> <color rgba="1 0.4 0 1"/> </material> <material name="white"> <color rgba="1 1 1 0.9"/> </material> <material name="black"> <color rgba="0 0 0 0.95"/> </material> <material name="grey"> <color rgba="0.5 0.5 0.5 1"/> </material> <xacro:macro name="wheel" params="prefix x y"> <joint name="${prefix}_wheel_joint" type="continuous"> <origin xyz="${x} ${y} ${z_offset}" rpy="0 0 0"/> <parent link="base_link"/> <child link="${prefix}_wheel_link"/> <axis xyz="0 1 0"/> </joint> <link name="${prefix}_wheel_link"> <visual> <origin xyz="0 0 0" rpy="1.5707 0 0" /> <geometry> <cylinder radius="${wheel_radius}" length="${wheel_length}"/> </geometry> <material name="white"/> </visual> <collision> <origin xyz="0 0 0" rpy="1.5707 0 0" /> <geometry> <cylinder radius="${wheel_radius}" length="${wheel_length}"/> </geometry> </collision> <inertial> <mass value="${wheel_mass}"/> <inertia ixx="0.0001" ixy="0.0" ixz="0.0" iyy="0.0001" iyz="0.0" izz="0.0002"/> </inertial> <gazebo> <material>Gazebo/White</material> </gazebo> </link> </xacro:macro> <xacro:macro name="caster" params="prefix x y"> <joint name="${prefix}_caster_joint" type="fixed"> <origin xyz="${x} ${y} ${z_offset}" rpy="0 0 0"/> <parent link="base_link"/> <child link="${prefix}_caster_link"/> </joint> <link name="${prefix}_caster_link"> <visual> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <sphere radius="${caster_radius}"/> </geometry> <material name="black"/> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <sphere radius="${caster_radius}"/> </geometry> </collision> <inertial> <mass value="${caster_mass}"/> <inertia ixx="0.00001" ixy="0.0" ixz="0.0" iyy="0.00001" iyz="0.0" izz="0.00001"/> </inertial> <gazebo> <material>Gazebo/Black</material> </gazebo> </link> </xacro:macro> <xacro:macro name="camera" params="prefix x y z"> <joint name="${prefix}_joint" type="fixed"> <origin xyz="${x} ${y} ${z}" rpy="0 0 0"/> <parent link="base_link"/> <child link="${prefix}_link"/> </joint> <link name="${prefix}_link"> <visual> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <box size="0.05 0.05 0.03"/> </geometry> <material name="grey"/> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <box size="0.05 0.05 0.03"/> </geometry> </collision> <inertial> <mass value="${camera_mass}"/> <inertia ixx="0.00001" ixy="0.0" ixz="0.0" iyy="0.00001" iyz="0.0" izz="0.00001"/> </inertial> <gazebo> <material>Gazebo/Grey</material> </gazebo> </link> <joint name="${prefix}_lens_joint" type="fixed"> <origin xyz="0.025 0 0" rpy="0 0 0"/> <parent link="${prefix}_link"/> <child link="${prefix}_lens_link"/> </joint> <link name="${prefix}_lens_link"> <visual> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <cylinder radius="0.01" length="0.01"/> </geometry> <material name="black"/> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <cylinder radius="0.01" length="0.01"/> </geometry> </collision> <inertial> <mass value="0.01"/> <inertia ixx="0.000001" ixy="0.0" ixz="0.0" iyy="0.000001" iyz="0.0" izz="0.000001"/> </inertial> <gazebo> <material>Gazebo/Black</material> </gazebo> </link> </xacro:macro> <link name="base_link"> <visual> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <box size="${base_size}"/> </geometry> <material name="yellow"/> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <box size="${base_size}"/> </geometry> </collision> <inertial> <mass value="${base_mass}"/> <inertia ixx="0.01" ixy="0.0" ixz="0.0" iyy="0.01" iyz="0.0" izz="0.02"/> </inertial> <gazebo> <material>Gazebo/Yellow</material> </gazebo> </link> <xacro:wheel prefix="left" x="0" y="0.23"/> <xacro:wheel prefix="right" x="0" y="-0.23"/> <xacro:caster prefix="front" x="0.23" y="0"/> <xacro:caster prefix="back" x="-0.23" y="0"/> <xacro:camera prefix="camera" x="0.2" y="0" z="0.13"/> <gazebo> <plugin filename="libgazebo_ros_diff_drive.so" name="gazebo_ros_diff_drive"> <left_joint>left_wheel_joint</left_joint> <right_joint>right_wheel_joint</right_joint> <commandTopic>cmd_vel</commandTopic> <wheel_separation>0.46</wheel_separation> <wheel_diameter>0.12</wheel_diameter> <wheel_radius>0.06</wheel_radius> <robotNamespace>/mbot</robotNamespace> <odometryFrame>odom</odometryFrame> <odometryTopic>odom</odometryTopic> <publishWheelTF>true</publishWheelTF> <robotBaseFrame>base_link</robotBaseFrame> <updateRate>100.0</updateRate> <wheelAcceleration>1.0</wheelAcceleration> <wheelTorque>5.0</wheelTorque> <publishWheelJointState>true</publishWheelJointState> <publishOdomTF>true</publishOdomTF> <odometrySource>encoder</odometrySource> <rosDebugLevel>na</rosDebugLevel> </plugin> </gazebo> <gazebo> <plugin filename="libgazebo_ros_camera.so" name="camera_plugin"> <rosDebugLevel>Debug</rosDebugLevel> <imageTopicName>image_raw</imageTopicName> <cameraName>camera</cameraName> <updateRate>30.0</updateRate> <cameraInfoTopicName>camera_info</cameraInfoTopicName> <frameName>camera_link</frameName> <distortionK1>0.0</distortionK1> <distortionK2>0.0</distortionK2> <distortionK3>0.0</distortionK3> <distortionT1>0.0</distortionT1> <distortionT2>0.0</distortionT2> <CxPrime>0.5</CxPrime> <Cx>0.5</Cx> <Cy>0.5</Cy> <focalLength>1.0</focalLength> <hackBaseline>0.1</hackBaseline> <fov>60.0</fov> <rosParamCameraInfo>camera_info</rosParamCameraInfo> <cameraName>camera</cameraName> </plugin> </gazebo> </robot> 这段代码有什么问题
最新发布
11-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值