how to trace a dynamic lib
realHarvey opened this issue · 7 comments
I'm trying to trace my plugin of global planner in move_base in ROS,I compile my plugin to libsample.so. But uftrace record libsample.so
return nothing to me "WARN: cannot open record data: uftrace.data: No data available"
Hi @realHarvey,
uftrace record libsample.so
return nothing to me "WARN: cannot open record data: uftrace.data: No data available"
That's expected. You cannot run libsample.so
itself so uftrace record libsample.so
cannot be executed. You should run an executable binary instead.
If the target binary is named as a.out
and it has a link to libsample.so
, then you will be able to see the trace of libsample.so
. But please make sure if the a.out
is also compiled with one of tracable option such as -pg
.
Thanks for your reply @honggyukim
I have tried to record the executable file uftrace record ./devel/move_base
and it runs totally fine, I got a flame-graph. But still I cannot see those function name of libsample in the flame
In both my navigation pack(include move_base) and libsample workspace, I added add_compile_options(-pg)
in CMakeLists.txt
Please make sure you library (libsample) has the function (mcount) and your program (move_base) loads the library properly.
I can see it works properly in RVIZ
Are you sure your program loaded the libsample you compiled with -pg
? I suspect it might load another one in the library load path.