参考链接:
http://wiki.ros.org/roslaunch/Tutorials/Roslaunch%20Nodes%20in%20Valgrind%20or%20GDB
<node launch-prefix="gdb -ex run --args" pkg="livox_mapping" type="scanRegistration_m1" name="scanRegistration_m1" output="screen"> </node>
~/livox_ws/ws_mapping$ roslaunch livox_mapping mapping_m1.launch ... logging to /home/.ros/log/e14c5b2e-c4fa-11eb-a0c8-34e12d23369c/roslaunch-ThinkPad-L480-30537.log Checking log directory for disk usage. This may take a while. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB. started roslaunch server http://ThinkPad-L480:41989/ SUMMARY ======== PARAMETERS * /rosdistro: melodic * /rosversion: 1.14.11 NODES / scanRegistration_m1 (livox_mapping/scanRegistration_m1) ROS_MASTER_URI=http://localhost:11311 process[scanRegistration_m1-1]: started with pid [30553] GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /home/livox_ws/ws_mapping/devel/lib/livox_mapping/scanRegistration_m1...done. Starting program: /home/livox_ws/ws_mapping/devel/lib/livox_mapping/scanRegistration_m1 __name:=scanRegistration_m1 __log:=/home/.ros/log/e14c5b2e-c4fa-11eb-a0c8-34e12d23369c/scanRegistration_m1-1.log [tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device] [tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device] [tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device] [New Thread 0x7ffff08bf700 (LWP 30560)] [New Thread 0x7fffebfff700 (LWP 30561)] [New Thread 0x7fffe3fff700 (LWP 30562)] [New Thread 0x7fffeb7fe700 (LWP 30563)] DEBUG first cloudSize 78750 start_idx=2,end_idx=78748,during_time=-1.62279e+09 Thread 1 "scanRegistratio" received signal SIGSEGV, Segmentation fault. 0x00005555555b4f44 in __gnu_cxx::new_allocator<pcl::PointXYZINormal>::construct<pcl::PointXYZINormal, pcl::PointXYZINormal const&> (this=0x555555875f78, __p=0xa38203d20343654) at /usr/include/c++/7/ext/new_allocator.h:136 136 { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } (gdb) bt #0 0x00005555555b4f44 in __gnu_cxx::new_allocator<pcl::PointXYZINormal>::construct<pcl::PointXYZINormal, pcl::PointXYZINormal const&> (this=0x555555875f78, __p=0xa38203d20343654) at /usr/include/c++/7/ext/new_allocator.h:136 #1 0x00005555555b7b85 in std::allocator_traits<Eigen::aligned_allocator<pcl::PointXYZINormal> >::_S_construct<pcl::PointXYZINormal, pcl::PointXYZINormal const&> (__a=..., __p=0xa38203d20343654) at /usr/include/c++/7/bits/alloc_traits.h:243 #2 0x00005555555b46be in std::allocator_traits<Eigen::aligned_allocator<pcl::PointXYZINormal> >::construct<pcl::PointXYZINormal, pcl::PointXYZINormal const&> (__a=..., __p=0xa38203d20343654) at /usr/include/c++/7/bits/alloc_traits.h:344 #3 0x00005555555b0e8e in std::vector<pcl::PointXYZINormal, Eigen::aligned_allocator<pcl::PointXYZINormal> >::push_back (this=0x555555875f78, __x=...) at /usr/include/c++/7/bits/stl_vector.h:943 #4 0x00005555555acf5b in pcl::PointCloud<pcl::PointXYZINormal>::push_back ( this=0x555555875f40, pt=...) at /usr/include/pcl-1.8/pcl/point_cloud.h:482 #5 0x00005555555a44b1 in laserCloudHandler (laserCloudMsg=...) at /home/livox_ws/ws_mapping/src/livox_mapping/src/scanRegistration_m1.cpp:212 #6 0x00005555555bb6e6 in boost::detail::function::void_function_invoker1<void (*)(boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&), void, boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&>::invoke (function_ptr=..., a0=...) ---Type <return> to continue, or q <return> to quit---