[RemoteInspection] Change RemoteAbsolutePointer (NFC)

This patch changes RemoteAbsolutePointer to store both the symbol and
the resolved address. This allows us to retire some ugly workarounds
to deal with non-symbolic addresses and it fixes code paths that would
need these workarounds, but haven't implemented them yet (i.e., the
pack shape handling in the symbolicReferenceResolver in MetadatyaReader.

Addresses parts of rdar://146273066.
rdar://153687085
This commit is contained in:
Adrian Prantl
2025-06-17 16:57:19 -07:00
parent e42b564800
commit 9381a54c67
6 changed files with 46 additions and 70 deletions

View File

@@ -322,9 +322,9 @@ Image::resolvePointer(uint64_t Addr, uint64_t pointerValue) const {
// 32 bits.
if (isMachOWithPtrAuth()) {
return remote::RemoteAbsolutePointer(
"", HeaderAddress + (pointerValue & 0xffffffffull));
remote::RemoteAddress(HeaderAddress + (pointerValue & 0xffffffffull)));
} else {
return remote::RemoteAbsolutePointer("", pointerValue);
return remote::RemoteAbsolutePointer(remote::RemoteAddress(pointerValue));
}
}
@@ -333,7 +333,8 @@ remote::RemoteAbsolutePointer Image::getDynamicSymbol(uint64_t Addr) const {
if (found == DynamicRelocations.end())
return nullptr;
return remote::RemoteAbsolutePointer(found->second.Symbol,
found->second.Offset);
found->second.Offset,
remote::RemoteAddress((uint64_t)0));
}
std::pair<const Image *, uint64_t>
@@ -526,8 +527,8 @@ ObjectMemoryReader::resolvePointer(reflection::RemoteAddress Addr,
// Mix in the image index again to produce a remote address pointing into the
// same image.
return remote::RemoteAbsolutePointer(
"", encodeImageIndexAndAddress(
image, resolved.getResolvedAddress().getAddressData()));
remote::RemoteAddress(encodeImageIndexAndAddress(
image, resolved.getResolvedAddress().getAddressData())));
}
remote::RemoteAbsolutePointer