Core dump generated by default on Ubuntu 18.04

Change the settings so that a core dump file is always generated on Ubuntu 18.04.

core dump file Output settings change

--Location of core dump file

Add the location where the core dump file is generated to /etc/sysctl.conf.

$ sudo vi /etc/sysctl.conf

kernel.core_pattern = /tmp/core.%e.%p.%h.%t

--core dump Change settings to always generate

Allows all processes and all users to generate core dumps.

$ sudo vi /etc/security/limits.conf

root             -       core            unlimited
*                -       core            unlimited

--Changed apport to disabled

$ sudo vi /etc/default/apport
#enabled=1
enabled=0

How to use core dump file

--Read core dump file

$ file core.ndt_mapping.2687
core.ndt_mapping.2687: ELF 64-bit LSB core file x86-64, version 1 (SYSV), SVR4-style, from '/home/k-koh/autoware.ai/install/lidar_localizer/lib/lidar_localizer/ndt_mapping', real uid: 1000, effective uid: 1000, real gid: 1000, effective gid: 1000, execfn: '/home/k-koh/autoware.ai/install/lidar_localizer/lib/lidar_localizer/ndt_mapping', platform: 'x86_64'

--Analysis of core dump file

gdb {executable file} {core file}

$ gdb /home/k-koh/autoware.ai/install/lidar_localizer/lib/lidar_localizer/ndt_mapping core.ndt_mapping.2687

Reading symbols from /home/k-koh/autoware.ai/install/lidar_localizer/lib/lidar_localizer/ndt_mapping...done.

warning: Unexpected size of section `.reg-xstate/2687' in core file.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/home/k-koh/autoware.ai/install/lidar_localizer/lib/lidar_localizer/ndt_mapping'.
Program terminated with signal SIGSEGV, Segmentation fault.

warning: Unexpected size of section `.reg-xstate/2687' in core file.
#0  0x00007f343857b45d in void pcl::PointRepresentation<pcl::PointXYZI>::vectorize<std::vector<float, std::allocator<float> > >(pcl::PointXYZI const&, std::vector<float, std::allocator<float> >&) const () from /usr/lib/x86_64-linux-gnu/libpcl_kdtree.so.1.8
[Current thread is 1 (Thread 0x7f3438ee0c80 (LWP 2687))]
(gdb) 

--Display the problem target program frame list with bt

(gdb) bt
#0  0x00007f343857b45d in void pcl::PointRepresentation<pcl::PointXYZI>::vectorize<std::vector<float, std::allocator<float> > >(pcl::PointXYZI const&, std::vector<float, std::allocator<float> >&) const () from /usr/lib/x86_64-linux-gnu/libpcl_kdtree.so.1.8
#1  0x00007f34385ad9df in pcl::KdTreeFLANN<pcl::PointXYZI, flann::L2_Simple<float> >::radiusSearch(pcl::PointXYZI const&, double, std::vector<int, std::allocator<int> >&, std::vector<float, std::allocator<float> >&, unsigned int) const () from /usr/lib/x86_64-linux-gnu/libpcl_kdtree.so.1.8
#2  0x0000564f8386ab3b in pcl::VoxelGridCovariance<pcl::PointXYZI>::radiusSearch (this=0x564f83a8f2e0 <ndt+512>, point=..., radius=<optimized out>, 
    k_leaves=std::vector of length 0, capacity 0, k_sqr_distances=..., max_nn=<optimized out>) at /usr/include/pcl-1.8/pcl/filters/voxel_grid_covariance.h:482
#3  0x0000564f8386e447 in pcl::NormalDistributionsTransform<pcl::PointXYZI, pcl::PointXYZI>::computeDerivatives (this=0x564f83a8f0e0 <ndt>, score_gradient=..., 
    hessian=..., trans_cloud=..., p=..., compute_hessian=true) at /usr/include/pcl-1.8/pcl/registration/impl/ndt.hpp:206
#4  0x0000564f8386fd2d in pcl::NormalDistributionsTransform<pcl::PointXYZI, pcl::PointXYZI>::computeTransformation (this=0x564f83a8f0e0 <ndt>, output=..., 
    guess=...) at /usr/include/pcl-1.8/pcl/registration/impl/ndt.hpp:120
#5  0x0000564f838491fe in pcl::Registration<pcl::PointXYZI, pcl::PointXYZI, float>::align (guess=..., output=..., this=0x564f83a8f0e0 <ndt>)
    at /usr/include/pcl-1.8/pcl/registration/impl/registration.hpp:216
#6  points_callback (input=...) at /home/k-koh/autoware.ai/src/autoware/core_perception/lidar_localizer/nodes/ndt_mapping/ndt_mapping.cpp:600
#7  0x0000564f8385474e in boost::function1<void, boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&>::operator() (a0=..., 
    this=<optimized out>) at /usr/include/boost/function/function_template.hpp:759
#8  boost::detail::function::void_function_obj_invoker1<boost::function<void (boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&)>, void, boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> >::invoke(boost::detail::function::function_buffer&, boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const>) (function_obj_ptr=..., a0=...) at /usr/include/boost/function/function_template.hpp:159
#9  0x0000564f8386622f in boost::function1<void, boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> >::operator() (a0=..., 
    this=0x564f8537ff48) at /usr/include/boost/function/function_template.hpp:759
#10 ros::SubscriptionCallbackHelperT<boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&, void>::call (this=0x564f8537ff40, 
    params=...) at /opt/ros/melodic/include/ros/subscription_callback_helper.h:144
#11 0x00007f3435b85fa2 in ros::SubscriptionQueue::call() () from /opt/ros/melodic/lib/libroscpp.so
#12 0x00007f3435b308a9 in ros::CallbackQueue::callOneCB(ros::CallbackQueue::TLS*) () from /opt/ros/melodic/lib/libroscpp.so
#13 0x00007f3435b3261b in ros::CallbackQueue::callAvailable(ros::WallDuration) () from /opt/ros/melodic/lib/libroscpp.so
#14 0x00007f3435b89b49 in ros::SingleThreadedSpinner::spin(ros::CallbackQueue*) () from /opt/ros/melodic/lib/libroscpp.so
#15 0x00007f3435b7242b in ros::spin() () from /opt/ros/melodic/lib/libroscpp.so
#16 0x0000564f83843671 in main (argc=<optimized out>, argv=<optimized out>)
    at /home/k-koh/autoware.ai/src/autoware/core_perception/lidar_localizer/nodes/ndt_mapping/ndt_mapping.cpp:1045

--frame moves to problem user program frame

(gdb) frame 6
#6  points_callback (input=...) at /home/k-koh/autoware.ai/src/autoware/core_perception/lidar_localizer/nodes/ndt_mapping/ndt_mapping.cpp:600
600	    ndt.align(*output_cloud, init_guess);

--Check the variable contents with print

(gdb) print init_guess
$1 = {<Eigen::PlainObjectBase<Eigen::Matrix<float, 4, 4, 0, 4, 4> >> = {<Eigen::MatrixBase<Eigen::Matrix<float, 4, 4, 0, 4, 4> >> = {<Eigen::DenseBase<Eigen::Matrix<float, 4, 4, 0, 4, 4> >> = {<Eigen::DenseCoeffsBase<Eigen::Matrix<float, 4, 4, 0, 4, 4>, 3>> = {<Eigen::DenseCoeffsBase<Eigen::Matrix<float, 4, 4, 0, 4, 4>, 1>> = {<Eigen::DenseCoeffsBase<Eigen::Matrix<float, 4, 4, 0, 4, 4>, 0>> = {<Eigen::EigenBase<Eigen::Matrix<float, 4, 4, 0, 4, 4> >> = {<No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, m_storage = {m_data = {array = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 
          1}}}}, <No data fields>}

Frequently used GDB commands

break [ file :] function
- Set a breakpoint at function (in file).

run [ arglist]
- Start your program (with arglist, if specified).

bt
- Backtrace: display the program stack.

print expr
- Display the value of an expression.

c
- Continue running your program (after stopping, e.g. at a breakpoint).

next
- Execute next program line (after stopping); step over any function calls in the line.

edit [ file :] function
- look at the program line where it is presently stopped.

list [ file :] function
- type the text of the program in the vicinity of where it is presently stopped.

step
- Execute next program line (after stopping); step into any function calls in the line.

help [ name]
- Show information about GDB command name, or general information about using GDB.

quit
- Exit from GDB.

Recommended Posts

Core dump generated by default on Ubuntu 18.04
Run chromium-mir-kiosk on Ubuntu Core
tmux on Ubuntu
Screen recording on Ubuntu 20.04
Web Bluetooth on Ubuntu20.04
Try DisplayLink on Ubuntu 20.04
Reinstall Kubernetes on Ubuntu 19.10
Use Flutter on Ubuntu
Install pyqt5 on ubuntu
Install Ruby on Ubuntu 20.04
Setting JAVA_HOME on Ubuntu
Install Autoware on Ubuntu 18.04.5
Put JetBrains on Ubuntu
Use mkdir on ubuntu
Apache2 on Ubuntu20.04 LTS
Use cpplapack on ubuntu
ubuntu on wsl part 10
Install Homebrew on Ubuntu 20.04
Run tiscamera on Ubuntu 18.04
Build Zabbix on Ubuntu 20.04
Play the voice generated by Amazon Polly on Discord's Voice Channel.