Skip to main content

Troubleshooting first step

If the code is not complex, you should definitely insert ROS_INFO print statements to determine the source of the crash.

Troubleshooting second step

If the code is very complex, make use of the following steps which can help to pinpoint exactly where the code crashes

1. Enable Core Dumps (current shell)#

ulimit -c unlimitedulimit -c   # should print: unlimited

2. Configure Core Dump Location#

echo '/tmp/core_%e.%p' | sudo tee /proc/sys/kernel/core_pattern

3. Build With Debug Symbols#

catkin tools#

catkin config -DCMAKE_BUILD_TYPE=RelWithDebInfo #or Debugcatkin build

4. Run ROS and Reproduce Crash#

5. Open Core Dump in GDB#

gdb <path_to_node_binary> <core_file>

Example:

gdb ~/storage/ros_ws/devel/lib/ros_pkg/ros_node\    /tmp/core_hydra_front_end.12345

6. Inspect Crash in GDB#

Stack trace#

btbt full

8. OR VSCode Core Dump Debugging instead of GDB#

.vscode/launch.json

{  "name": "Debug Core Dump",  "type": "cppdbg",  "request": "launch",  "program": "/path/to/devel/lib/pkg/node",  "coreDumpPath": "/tmp/core_node.12345",  "MIMode": "gdb"}
Last updated on