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

Always leverage fast unwinding to obtain the native stack #141

Merged
merged 1 commit into from Jun 15, 2022

Conversation

pablogsal
Copy link
Member

@pablogsal pablogsal commented Jun 11, 2022

Seems that libunwind just chokes if the function that calls unw_get_reg
is not inlined in aarch64. Additionally, there are some problems with
inlined functions that call libunwind's APIs in powerpc and other
architectures.

To avoid all this trouble, leverage just the fast unwinding APIs, which
will make the program counters more consistent and will eliminate the
inline shenanigans.

Closes: #126

godlygeek
godlygeek previously approved these changes Jun 13, 2022
Copy link
Contributor

@godlygeek godlygeek left a comment

Choose a reason for hiding this comment

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

LGTM, but one suggestion. Feel free to ignore and land if you don't want to take the suggestion.

src/memray/_memray/tracking_api.h Outdated Show resolved Hide resolved
@godlygeek
Copy link
Contributor

Also - does this deserve a changelog entry? This fixes a bug where aggregating call stacks could give misleading results on aarch64 under some circumstances, right?

@pablogsal
Copy link
Member Author

pablogsal commented Jun 15, 2022

This fixes a bug where aggregating call stacks could give misleading results on aarch64 under some circumstances, right?

Yes and not, is not mostly user-visible because the actual stack traces were the same (they will produce weird aggregations but not incorrect ones), is just that the test suite fails because the native_frame_ids are different although they produce the same results.

I will add a news entry nevertheless

@pablogsal pablogsal force-pushed the better_inlining branch 2 times, most recently from 55d7d84 to db90c91 Compare June 15, 2022 17:49
@pablogsal pablogsal enabled auto-merge (rebase) June 15, 2022 17:49
@pablogsal
Copy link
Member Author

@godlygeek Can you please review again?

Seems that libunwind just chokes if the function that calls unw_get_reg
is not inlined in aarch64. Additionally, there are some problems with
inlined functions that call libunwind's APIs in powerpc and other
architectures.

To avoid all this trouble, leverage just the fast unwinding APIs, which
will make the program counters more consistent and will eliminate the
inline shenanigans.

Additionally increase the default size for the native stack vector to
reduce the need to call multiple times into the unwinding API.

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Copy link
Contributor

@godlygeek godlygeek left a comment

Choose a reason for hiding this comment

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

LGTM

@pablogsal pablogsal merged commit 41de886 into bloomberg:main Jun 15, 2022
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.

Some tests for native tracking don't work in aarch64
2 participants