Skip to content

[Backtracing] Add a caching wrapper for MemoryReader. #69719

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

Merged
merged 4 commits into from
Nov 9, 2023

Conversation

al45tair
Copy link
Contributor

@al45tair al45tair commented Nov 8, 2023

Currently we read many small chunks from the process we're backtracing. If it so happens that it's the local process, that isn't really a big problem, but if it's a remote process, especially on Linux where we have to use the memory server, it's probably a little slow.

Fix by adding a caching layer.

rdar://117681625

Currently we read many small chunks from the process we're backtracing.
If it so happens that it's the local process, that isn't really a big
problem, but if it's a remote process, especially on Linux where we have
to use the memory server, it's probably a little slow.

Fix by adding a caching layer.

rdar://117681625
Because the cache uses the page addresses as its keys, we should have
a precondition to check that we haven't passed an address within a page.
The latter would result in confusing behaviour so it's worth diagnosing
up front.

rdar://117681625
It turns out that .copyBytes() checks that the source doesn't provide more
bytes than the destination will accept.

rdar://117681625
When I rebased, I didn't get the FileImageSource code quite right.

rdar://117681625
@al45tair al45tair added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.10 labels Nov 8, 2023
@al45tair al45tair requested a review from a team as a code owner November 8, 2023 14:12
@al45tair
Copy link
Contributor Author

al45tair commented Nov 8, 2023

Explanation: Improves backtracing performance on Linux by adding a cache.
Original PR: #69510
Risk: Low. We have tests that cover this code.
Reviewed by: @mikeash
Resolves: rdar://117681625
Tests: The existing backtracing tests exercise this code.

@al45tair
Copy link
Contributor Author

al45tair commented Nov 8, 2023

@swift-ci Please test

@al45tair al45tair merged commit bb4e6b2 into swiftlang:release/5.10 Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants