Skip to content

Conversation

@augusto2112
Copy link
Contributor

@augusto2112 augusto2112 commented Oct 29, 2025

  • Explanation: Adds a hook so implementations of memory reader can add logic to resolving remote addresses. This is needed because of an interaction between LLDB, which tries to read memory from files instead of process memory whenever possible and the DYLD shared cache.
  • Scope: Only affects remote mirrors clients. The default implementation of the new function should behave exactly the same as before this patch, so only LLDB, which overrides the function, should se any difference in behavior.
  • Issue/Radar: rdar://163652093
  • Original PR: [RemoteMirrors] Add hook for resolving indirect addresses #85091
  • Risk: Low. Only LLDB should be affected.
  • Testing: Since this is specific to LLDB and the shared cache, there's no test I could add here, besides manual testing.
  • Reviewer: @mikeash

Adds a hook so implementations of memory reader can add logic to
resolving remote addresses. This is needed because of an interaction
between LLDB, which tries to read memory from files instead of process
memory whenever possible and the DYLD shared cache.

The shared cache will merge pointers in the GOT sections from multiple
images into one location, and update the relative offsets to point to
the new location.
LLDB, will have initially read the offset pointing to the "old"
location, which will be zeroed out in live memory. This gives LLDB the
opportunity to re-read the relative offset, but from live memory, so it
can return the right pointer in the shared cache.

(cherry picked from commit 0f4a3ceb67a3669cd5433d5ae13fec6852876173)

rdar://163652093
@augusto2112
Copy link
Contributor Author

1 similar comment
@augusto2112
Copy link
Contributor Author

@augusto2112 augusto2112 marked this pull request as ready for review October 31, 2025 16:33
@augusto2112 augusto2112 requested a review from a team as a code owner October 31, 2025 16:33
/// \param directnessEncodedInOffset Whether the relative offset encodes the
/// directness as the last bit. Note that this is not the offset passed in as
/// a parameter, but whether the offset read at address would have the last
/// bit set.
Copy link
Contributor

Choose a reason for hiding this comment

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

This sentence may become more readable if you reorder it back to front.

Copy link
Contributor

Choose a reason for hiding this comment

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

would have -> may have?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can fix it on main :)

@adrian-prantl adrian-prantl merged commit 49953ed into swiftlang:release/6.2 Oct 31, 2025
5 checks passed
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.

2 participants