[Runtime] Expose the protocol conformance state as a _swift_debug variable.

Have Remote Mirror look that up instead of the C++ mangled name.

rdar://problem/55481578
This commit is contained in:
Mike Ash
2020-04-28 16:42:35 -04:00
committed by Ben Cohen
parent b73b325e10
commit ad09919891
3 changed files with 19 additions and 5 deletions

View File

@@ -818,12 +818,20 @@ public:
llvm::Optional<std::string> iterateConformances(
std::function<void(StoredPointer Type, StoredPointer Proto)> Call) {
std::string ConformancesName = "__ZL12Conformances";
auto ConformancesAddr = getReader().getSymbolAddress(ConformancesName);
if (!ConformancesAddr)
return "unable to look up conformances cache symbol " + ConformancesName;
std::string ConformancesPointerName =
"__swift_debug_protocolConformanceStatePointer";
auto ConformancesAddrAddr =
getReader().getSymbolAddress(ConformancesPointerName);
if (!ConformancesAddrAddr)
return "unable to look up debug variable " + ConformancesPointerName;
auto Root = getReader().readPointer(ConformancesAddr, sizeof(StoredPointer));
auto ConformancesAddr =
getReader().readPointer(ConformancesAddrAddr, sizeof(StoredPointer));
if (!ConformancesAddr)
return "unable to read value of " + ConformancesPointerName;
auto Root = getReader().readPointer(ConformancesAddr->getResolvedAddress(),
sizeof(StoredPointer));
iterateConformanceTree(Root->getResolvedAddress().getAddressData(), Call);
return llvm::None;
}