Skip to content

[lldb] Make LLDBMemoryReader::resolvePointer strip the pointer #4958

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

In order to know if the pointer we're dealing with is mapped by
LLDBMemoryReader, we need to strip it first.

rdar://94239864

@augusto2112 augusto2112 requested a review from kastiglione July 8, 2022 23:10
@augusto2112
Copy link
Author

@swift-ci test

Copy link

@adrian-prantl adrian-prantl left a comment

Choose a reason for hiding this comment

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

Functionally, this looks fine! One question inline.

@@ -84,6 +88,10 @@ llvm::Optional<Address> resolveRemoteAddressFromSymbolObjectFile(uint64_t addres
llvm::Optional<uint64_t> m_local_buffer;
uint64_t m_local_buffer_size = 0;

llvm::Optional<std::function<swift::remote::RemoteAbsolutePointer(

Choose a reason for hiding this comment

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

Would it be a layering violation if we just passed the pointer to the reflection context instead of the lambda? Otherwise, does it have to be an Optional?

Copy link
Author

Choose a reason for hiding this comment

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

Would it be a layering violation if we just passed the pointer to the reflection context instead of the lambda?

You mean call the function directly? MemoryReader doesn't know about ReflectionContext, but ReflectionContext know about MemoryReader. The reason I'm using a lambda is to keep MemoryReader unaware of ReflectionContext.

Otherwise, does it have to be an Optional?

It actually doesn't, not sure what my reasoning was for it to be optional.

Choose a reason for hiding this comment

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

I guess that LLDBMemoryReader could know about it, but I don't mind the function pointer either.

@augusto2112 augusto2112 force-pushed the strip-pointer-in-resolve branch from 0210ea8 to c240d28 Compare July 29, 2022 22:18
@augusto2112
Copy link
Author

@swift-ci test

In order to know if the pointer we're dealing with is mapped by
LLDBMemoryReader, we need to strip it first.

rdar://94239864
@augusto2112 augusto2112 force-pushed the strip-pointer-in-resolve branch from c240d28 to 8e6684a Compare July 29, 2022 23:16
@augusto2112
Copy link
Author

@swift-ci test

@augusto2112 augusto2112 merged commit 07d1485 into swiftlang:stable/20211026 Aug 1, 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