Skip to content

Commit e84d560

Browse files
Merge pull request #82073 from adrian-prantl/152743797
[RemoteInspection] Add a hook to process addresses before converting
2 parents a40a7be + 540df14 commit e84d560

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

include/swift/Remote/MemoryReader.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ class MemoryReader {
150150
return RemoteAbsolutePointer("", readValue);
151151
}
152152

153+
/// Performs the inverse operation of \ref resolvePointer.
154+
/// A use-case for this is to turn file addresses into in-process addresses.
155+
virtual std::optional<RemoteAddress>
156+
resolveRemoteAddress(RemoteAddress address) const {
157+
return std::nullopt;
158+
}
159+
153160
virtual std::optional<RemoteAbsolutePointer>
154161
resolvePointerAsSymbol(RemoteAddress address) {
155162
return std::nullopt;

include/swift/Remote/MetadataReader.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2907,8 +2907,10 @@ class MetadataReader {
29072907
case ContextDescriptorKind::Anonymous: {
29082908
// Use the remote address to identify the anonymous context.
29092909
char addressBuf[18];
2910+
RemoteAddress address(descriptor.getAddressData());
2911+
address = Reader->resolveRemoteAddress(address).value_or(address);
29102912
snprintf(addressBuf, sizeof(addressBuf), "$%" PRIx64,
2911-
(uint64_t)descriptor.getAddressData());
2913+
(uint64_t)address.getAddressData());
29122914
auto anonNode = dem.createNode(Node::Kind::AnonymousContext);
29132915
CharVector addressStr;
29142916
addressStr.append(addressBuf, dem);

0 commit comments

Comments
 (0)