apollo icon indicating copy to clipboard operation
apollo copied to clipboard

How to use gdb for debug in apollo?

Open lesun90 opened this issue 8 years ago • 8 comments

Can you provide a tutorial/example how to use gdb to debug in apollo? the log file method is helpful but not convenient enough for debugging (eg debug memory leak..)

For example: can you show how to debug planning module use gdb?

Thank you all.

lesun90 avatar Jul 03 '18 12:07 lesun90

Apollo is made up some submodules. These modules are built in bazel-bin/modules// . You could use gdb to debug them. For example, You want to debug perception, you could use command as following. gdb bazel-bin/modules/perception/perception

You could try this method. And please feel free to let me know if you have any other problem.

muleisheng avatar Jul 03 '18 16:07 muleisheng

@muleisheng thanks for the input.. @lesun90 Please let me know if you try it.. Even I am looking for the same approach ..

kk2491 avatar Jul 05 '18 09:07 kk2491

Hi,

I still dont not clear what to do. I try gdb bazel-bin/modules/perception/perception

and get apollo_app.cc:59] perception Init failed: PERCEPTION when I run in gdb

lesun90 avatar Jul 05 '18 14:07 lesun90

Hi perception may need some input params, for example, some configuration data (or files). I will check this issue by reviewing code. If any progress , I will let you know.

muleisheng avatar Jul 05 '18 15:07 muleisheng

I suggest search for some tutorials on gdb for details.

lianglia-apollo avatar Jul 05 '18 23:07 lianglia-apollo

Here is steps for debugging perception.

  1. use following command to start debug perception gdb bazel-bin/modules/perception/perception
  2. set args for perception by using 'set args', here is a sample. set args --flagfile=/apollo/modules/perception/conf/perception_lowcost.conf --stderrthreshold=3 --use_navigation_mode

You could try this method. It may solve your issue

muleisheng avatar Jul 06 '18 07:07 muleisheng

Hi, I have tried this method but when I go into gdb bazel-bin/modules/perception/perception. set args --flagfile=/apollo/modules/perception/conf/perception_lowcost.conf --stderrthreshold=3 --use_navigation_mode It is still not work. The error message is can not open shared object file. Thank you.

RamboRick avatar Oct 08 '18 20:10 RamboRick

@muleisheng @fanghaos2014
Hi fang, have you done with that issue, debugging the perception module ? I also want to debug the perception module with VScode. And I wonder the above problem was that user have to feed some required data for running perception module like playing ROS bag. Can anyone give me some guide? Thanks.

CCodie avatar Jan 04 '19 00:01 CCodie