Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to trace a dynamic lib #1926

Open
realhonbo opened this issue May 19, 2024 · 7 comments
Open

how to trace a dynamic lib #1926

realhonbo opened this issue May 19, 2024 · 7 comments

Comments

@realhonbo
Copy link

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"

@honggyukim
Copy link
Collaborator

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.

@realhonbo
Copy link
Author

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

@namhyung
Copy link
Owner

Please make sure you library (libsample) has the function (mcount) and your program (move_base) loads the library properly.

@realhonbo
Copy link
Author

I can see it works properly in RVIZ

@namhyung
Copy link
Owner

Are you sure your program loaded the libsample you compiled with -pg? I suspect it might load another one in the library load path.

@m9rco
Copy link

m9rco commented Aug 23, 2024

There will be a problem here: if the -pg parameter is applied to the .so file, and then the specified binary file is compiled (also with -pg), many undefined errors in the .so file will be reported. @namhyung

@namhyung
Copy link
Owner

I don't understand what you mean. Why will it report undefined errors with -pg? It'd only add mcount and it's defined in libc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants