[Reflection] Separate MemoryReader::resolvePointer to distinguish related operations #41530
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Until recently,
MemoryReader
had a single functionresovlePointer
which did two things, and has a somewhat vague name. The two things were:swift-reflection-dump
and then later in lldb)Recently,
resolvePointerAsSymbol
was added, which overloaded the term "resolve" and it added another way to deal with symbols for addresses. Symbols themselves were a bit muddled, asswift-reflection-dump
was dealing with dynamic symbols aka bindings, while lldb was dealing in regular (static) symbols.This change separates these two parts of functionality, and also divides symbol lookup into two cases. The API surface will now be:
resolvePointer
for mapping/tagging addressesgetSymbol
for looking up a symbol for an addressgetDynamicSymbol
for looking up a dyld binding for an addressNote: each of these names could be improved. Some alternative terms:
lookup
instead ofget
,Binding
orBindingName
instead ofDynamicSymbol
. Maybe even another term instead of "resolve". Suggestions welcome!Currently,
swift-reflection-dump
supportsgetDynamicSymbol
but notgetSymbol
. For lldb it's the reverse,getSymbol
is supported butgetDynamicSymbol
needs to be implemented.For everything but lldb, this change is NFC. For lldb it fixes a bug where
LLDBMemoryReader
returns regular symbols where we should instead be returning dynamic symbols.