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

Dwarf unwinding results in truncated stacks #9

Open
bobrik opened this issue Dec 31, 2022 · 1 comment
Open

Dwarf unwinding results in truncated stacks #9

bobrik opened this issue Dec 31, 2022 · 1 comment

Comments

@bobrik
Copy link

bobrik commented Dec 31, 2022

I'm trying to make a replacement for perf script with linux-perf-data, framehop, and wholesym. Thank you for providing the building blocks!

Currently I'm running into an issue with framehop giving me truncated stacks when using ModuleUnwindData::DebugFrame. It works great with ModuleUnwindData::EhFrameHdrAndEhFrame, which is how it works out of the box for rust programs with samply.

For Rust I'm getting TruncatedStackMarker, but for Go I'm also seeing just short stacks with a couple of frames and that's it.

My reference is perf script linked against libdw (libunwind likes to truncate as well, so I'm avoiding it).

I'm on aarch64-linux (via qemu VM on macOS).

@mstange
Copy link
Owner

mstange commented Dec 31, 2022

I'm trying to make a replacement for perf script with linux-perf-data, framehop, and wholesym. Thank you for providing the building blocks!

Excellent! This was one of the applications I had in mind when building out these pieces. I wanted a fast replacement for perf script for the Rust flamegraph utility in particular, but I'm sure it would be useful in lots of other cases, too.
My first attempt at this was in the linux-perf-stuff repo, and the process of writing it informed the API of the wholesym crate. I haven't touched the linux-perf-stuff repo in a while, and you may already have a solution that's further along.

By the way, KernelSymbols::new_from_running_kernel is another piece that you may want to use in your tool, and it's not packaged in a separate crate yet.

Currently I'm running into an issue with framehop giving me truncated stacks when using ModuleUnwindData::DebugFrame. It works great with ModuleUnwindData::EhFrameHdrAndEhFrame, which is how it works out of the box for rust programs with samply.

Hmm, that's interesting. I haven't put the ModuleUnwindData::DebugFrame path through a whole lot of testing; I only really tested it with Go binaries on macOS arm64. It was working mostly fine on those, except that it couldn't unwind from the stack-switching-for-FFI code because of incorrect DWARF CFI on arm64 for those functions, from what I recall.

For Rust I'm getting TruncatedStackMarker, but for Go I'm also seeing just short stacks with a couple of frames and that's it.

My reference is perf script linked against libdw (libunwind likes to truncate as well, so I'm avoiding it).

I'm on aarch64-linux (via qemu VM on macOS).

Okay. So then I'll try to reproduce this by making samply prefer .debug_frame over .eh_frame, and then running samply load perf.data on a perf profile of a Rust binary with debug information. And then once that works I can take a look at the Go case.

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

2 participants