Skip to content

Add support for framehop as unwinder #267

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Maaarcocr
Copy link

@Maaarcocr Maaarcocr commented May 6, 2025

This pr adds a new unwinder based on framehop, as it was suggested in #152 and some of the code here is inspired by https://github.com/sticnarf/runwind

While doing so, I made it such that any unwinder also supports resolving symbols from perfmaps a commonly used format by JIT compilers.

I've also made it possible to configure the maximum length of each stacktrace, as for my own usecases (profiling ruby applications from a native POV) 128 was too small.

In order to make framehop works I had to:

  • get a list of all dynamically linked objects
  • get the state of some registers

this changes have been tested on macos on ARM and linux on x86.

Copy link

ti-chi-bot bot commented May 6, 2025

Welcome @Maaarcocr! It looks like this is your first PR to tikv/pprof-rs 🎉

@YangKeao YangKeao self-requested a review May 7, 2025 03:07
@Maaarcocr Maaarcocr force-pushed the master branch 2 times, most recently from 92c9b0d to 0557997 Compare May 7, 2025 10:19
@Maaarcocr
Copy link
Author

Maaarcocr commented May 7, 2025

I've pushed a new commit that separates the perfmap implementation from the framehop unwinder, as they are different concerns. I hope this is better, we can now have perfmaps resolution even with the other unwinder if we want to.

This also reduces the changes that were needed to make this work.

@Maaarcocr Maaarcocr force-pushed the master branch 2 times, most recently from 1cc6810 to e3e2cc9 Compare May 8, 2025 15:56
perfmaps are reloaded on demand in a bg thread

Signed-off-by: Marco Concetto Rudilosso <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant