Ask Your Question

How to debug rmw segfaults launched by ros2cli like `ros2 topic echo`?

asked 2021-08-15 02:25:29 -0600

zhensheng gravatar image

updated 2021-08-21 15:33:35 -0600

I am a developer of rmw_iceoryx, I ran into problems about segfault when executing ros2cli like ros2 topic echo /topic, bug I cannot find a way to debug this kind of problem, see this issue if you like.

I know it is about python and cpp debug and I tried using vscode python debug launcher to debug ros2cli python script, but failed to catch the segment exception.

So, does anybody has experence on debug ros2cli code that dynamiclly load rmw interface?


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2021-08-21 11:43:03 -0600

updated 2021-08-21 11:45:04 -0600

I found this:

I installed the Python debug package (Ubuntu 20.04):

$ sudo apt-get install python3-dbg

If you try to blindly follow the examples, it doesn't work if you just do:

$ gdb -ex r --args ros2 topic /echo
"/home/$USER/ros2_ws/install/ros2cli/bin/ros2": not in executable format: file format not recognized

So you have to run python3 with the actual entrypoint Python file (which you can see in the error message) as the first argument + the rest. You can also use which to find the Python file corresponding to ros2:

$ gdb -ex r --args python3 `which ros2` topic echo /topic

This seemed to run gdb correctly for me, but with the default RMW implementation there's no segfault, so I can't tell if it actually gives a stack trace, etc. It should, though, according to what I can see in the link above. Let us know if it works!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-08-15 02:25:29 -0600

Seen: 73 times

Last updated: Aug 21