mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
MetadataReader: Add an API for reading absolute pointers.
Pointer data in some remote reflection targets may required relocation, or may not be fully resolvable, such as when we're dumping info from a single image on disk that references other dynamic libraries. Add a `RemoteAbsolutePointer` type that can hold a symbol, offset, or combination of both, and add APIs to `MemoryReader` and `MetadataReader` for reading pointers that can get unresolved relocation info from an image, or apply relocations to pointer information. MetadataReader can use the symbol name information to fill in demanglings of symbolic-reference-bearing mangled names by using the information from the symbol name to fill in the name even though the context descriptors are not available. For now, this is NFC (MemoryReader::resolvePointer just forwards the pointer data), but lays the groundwork for implementation of relocation in ObjectMemoryReader.
This commit is contained in:
@@ -608,6 +608,8 @@ public:
|
||||
auto CDAddr = this->readCaptureDescriptorFromMetadata(*MetadataAddress);
|
||||
if (!CDAddr)
|
||||
return nullptr;
|
||||
if (!CDAddr->isResolved())
|
||||
return nullptr;
|
||||
|
||||
// FIXME: Non-generic SIL boxes also use the HeapLocalVariable metadata
|
||||
// kind, but with a null capture descriptor right now (see
|
||||
@@ -615,7 +617,8 @@ public:
|
||||
//
|
||||
// Non-generic SIL boxes share metadata among types with compatible
|
||||
// layout, but we need some way to get an outgoing pointer map for them.
|
||||
auto CD = getBuilder().getCaptureDescriptor(*CDAddr);
|
||||
auto CD = getBuilder().getCaptureDescriptor(
|
||||
CDAddr->getResolvedAddress().getAddressData());
|
||||
if (CD == nullptr)
|
||||
return nullptr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user