Skip to content

Latest commit

 

History

History
58 lines (50 loc) · 1.68 KB

README.md

File metadata and controls

58 lines (50 loc) · 1.68 KB

Debug ros node with GDB

Abstract

Debug the ros node with GDB. Some error (such as segment fault) is difficult to find. The GDB is a good choice to debug it.

Simple steps to use GDB to debug ros node

  • Step 1: compile the ros package
    $ catkin_make -DCMAKE_BUILD_TYPE=Debug
    
  • Step 2: run the ros node you want to debug with specified format ros node
    $ rosrun --prefix 'gdb -ex run --args'  package   node  
    
    or (launch)
    $ <node pkg="package" type="node" name="node_name" output="screen" launch-prefix="gdb -ex run --args" >/>  
    
    or (python)
    launch-prefix="xterm -e python -m pdb "
    

additional commands for GDB debugging

commands functions
bt show location of error, e.g. segment fault
info files show the detail information of the debugged file
info var show all the global and static variables
info local show all the local variables
More Link, book