Skip to content

[lldb] Move resolvePointer code to resolvePointerAsSymbol and implement resolvePointer to map process addresses to tagged addressess #3882

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

Conversation

augusto2112
Copy link

No description provided.

resolvePointerAsSymbol is executed before any memory read is done, so
move the code that does this to it.
@augusto2112
Copy link
Author

@swift-ci test

If we read a real process address, try to map that back as a tagged
LLDBMLLDBMemoryReader address, so further reads originating from it
benefit from the file-cache optimization.
@augusto2112 augusto2112 force-pushed the resolve-pointer-symbol branch from 74e5c48 to 3d63cec Compare February 2, 2022 18:31
@augusto2112
Copy link
Author

This pull request has two commits:
1 - Move the code from resolvePointer code to resolvePointerAsSymbol. Since resolvePointerAsSymbol is given a chance to resolve the pointer before any memory is read, this will save some unnecessary memory reads form happening.
2 - In resolvePointer, attempt to a process address back to a tagged address. This way, any further memory reads originating from that address can benefit from the file-cache optimization.

@augusto2112
Copy link
Author

@swift-ci test


auto &target = m_process.GetTarget();
Address addr;
if (!target.ResolveLoadAddress(readValue, addr)) {

Choose a reason for hiding this comment

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

So for an instance pointer pointing into the heap or stack, this is expected to fail, right?

Choose a reason for hiding this comment

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

what happens with a pointer to global variable that would be in a non-const __DATA section?

Choose a reason for hiding this comment

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

i.e, should there be a check that the address is in a read-only section?

Copy link
Author

Choose a reason for hiding this comment

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

That shouldn't be necessary, because we only read from the file-cache if the section containing the address is read-only.

@augusto2112 augusto2112 merged commit cd2992b into swiftlang:stable/20211026 Feb 3, 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.

2 participants