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

Add option to print virtual address to trace.py #1555

Merged
merged 1 commit into from
Feb 1, 2018
Merged

Add option to print virtual address to trace.py #1555

merged 1 commit into from
Feb 1, 2018

Conversation

mirek26
Copy link
Contributor

@mirek26 mirek26 commented Jan 26, 2018

We'd like to be able to symbolize stacks with external symbolizers like addr2line or llvm-symbolizer to get more information including inlined functions or line numbers. This is adding a simple option to print the virtual address.

Happy to add this as an option to bpf.sym() if that's preferred

@yonghong-song
Copy link
Collaborator

Could you add or modify an existing example in trace_example.txt? This way, maybe more people will see it and use it. Could you also change the man page at bcc/man/man8 directory? Thanks!

@mirek26
Copy link
Contributor Author

mirek26 commented Jan 31, 2018

Thanks for looking! Updated the man page and added an example to trace_example.txt - there was no example showing -K/-U either, so I tried to choose something reasonable. If you have some better ideas let me know.

@palmtenor
Copy link
Member

The use case we have for this option is to tail the outputted virtual addresses, resolve them and log through a different pipeline.

Do you feel it's reasonable to have this option lead to only output virtual addresses instead of in addition to string symbols? The reason is that BCC's default symbol resolution behavior is quite expensive (look for debuginfo first, does CRC calculation for debuginfo). Doing those on large binaries such as HHVM that we use for web server often take couple of seconds with a lot of CPU and memory.

Do you feel that only outputting virtual addresses is a useful behavior for the tool in general, that we could add this option for?

@yonghong-song
Copy link
Collaborator

[buildbot, ok to test]

@yonghong-song
Copy link
Collaborator

virtual address output is also useful when:
. symbol resolution yields unknown. user may try to use the virtual address to find out why?
. if the same function appears twice inside another function, virtual address may help you
decipher which one is actually in the stack.
I hacked trace.py file exactly for this reason in the past.

Regarding whether this option -a should output only virtual address without symbol resolution, I think addr+sym is useful and we should preserve. It may remove the redundant work since symbol resolution will be done externally. But can we attempt to improve this perspective in bcc first?

@mirek26
Copy link
Contributor Author

mirek26 commented Feb 1, 2018

From bcc's perspective I think addr+sym makes more sense. For our use case, printing only addresses would be better, but we'd probably need another flag for that and I don't want to overcomplicate this code. (Then we could take this even further and add "-F ip,sym,dso" as in perf...)

We use this only for ad-hoc debugging and profiling, so I don't think it's a big issue. Or maybe I just haven't run into this being a problem yet :)

Copy link
Collaborator

@yonghong-song yonghong-song left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yonghong-song yonghong-song merged commit 3f39bc1 into iovisor:master Feb 1, 2018
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

Successfully merging this pull request may close these issues.

3 participants