Search code examples
c++ubuntudebuggingrosdynamic-library

How to enter the source file of a dynamic lib (.so) when debugging


Recently, I want to add some breakpoints and debug some ROS libraries step by step to learn how these functions are called. These ROS libraries have been built from source.

However, I found that all the member functions of libraries are linked to .h files and I cannot see what's inside these functions and the breakpoint inside the member functions are useless.

Is there any way to add breakpoints inside a library member function and observe how the library member function is running?


Solution

  • Following the instructions from @jabba, I built the current main.cpp and the third-party library with -DCMAKE_BUILD_TYPE=Debug, and the breakpoints worked,

    EDIT

    i.e.,

    catkin build main_node -DCMAKE_BUILD_TYPE=Debug