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

Dont double adjust return addresses in imported simpleperf profiles #237

Merged
merged 2 commits into from
Jun 1, 2024

Conversation

mstange
Copy link
Owner

@mstange mstange commented Jun 1, 2024

The addresses in call chains in perf.data files from simpleperf have already been adjusted to point into the call instruction. This is different from what we're used to from perf.data files generated by Linux perf.

The adjustment happens in two places:

If the unwinding happens in the kernel, the callchains are adjusted in SampleRecord::AdjustCallChainGeneratedByKernel().

If simpleperf does the unwinding of the user stack itself, the callchains are adjusted in libunwindstack,
i.e in the unwinder that's used by simpleperf:

https://cs.android.com/android/platform/superproject/+/main:system/unwinding/libunwindstack/Unwinder.cpp;l=177;drc=8e2c60d01e0928275d30f320c3f83ac4f29b880c
https://cs.android.com/android/platform/superproject/+/main:system/unwinding/libunwindstack/Regs.cpp;l=175-224;drc=c0fa0c327e58eda604b2fd00b81f1c12817542d3

mstange added 2 commits May 31, 2024 22:44
The addresses in call chains in perf.data files from simpleperf
have already been adjusted to point into the call instruction.
This is different from what we're used to from perf.data files
generated by Linux perf.

The adjustment happens in two places:
If the unwinding happens in the kernel, the callchains are adjusted in SampleRecord::AdjustCallChainGeneratedByKernel():
https://cs.android.com/android/platform/superproject/+/main:system/extras/simpleperf/record.cpp;l=949-982;drc=428d4a5fdb7745f73f52e930120dba9d2f215c26
If simpleperf does the unwinding of the user stack itself, the callchains are adjusted in libunwindstack,
i.e in the unwinder that's used by simpleperf:
https://cs.android.com/android/platform/superproject/+/main:system/unwinding/libunwindstack/Unwinder.cpp;l=177;drc=8e2c60d01e0928275d30f320c3f83ac4f29b880c
https://cs.android.com/android/platform/superproject/+/main:system/unwinding/libunwindstack/Regs.cpp;l=175-224;drc=c0fa0c327e58eda604b2fd00b81f1c12817542d3
@mstange mstange enabled auto-merge June 1, 2024 02:48
@mstange mstange merged commit 19998d6 into main Jun 1, 2024
15 checks passed
@mstange mstange deleted the dont-double-adjust-return-addresses-with-simpleperf branch June 20, 2024 21:57
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.

1 participant