Skip to content

Commit 95b2f80

Browse files
authored
Merge pull request #41209 from apple/reflection-symbol-use-release-5.6
[Reflection] Changes to support LLDBMemoryReader
2 parents 06e7a5e + 9af2bab commit 95b2f80

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

include/swift/ABI/ObjectFile.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class SwiftObjectFileFormat {
2828
public:
2929
virtual ~SwiftObjectFileFormat() {}
3030
virtual llvm::StringRef getSectionName(ReflectionSectionKind section) = 0;
31+
/// Predicate to identify if the named section can contain reflection data.
32+
virtual bool sectionContainsReflectionData(llvm::StringRef sectionName) = 0;
3133
};
3234

3335
/// Responsible for providing the Mach-O reflection section identifiers.
@@ -50,6 +52,10 @@ class SwiftObjectFileFormatMachO : public SwiftObjectFileFormat {
5052
}
5153
llvm_unreachable("Section type not found.");
5254
}
55+
56+
bool sectionContainsReflectionData(llvm::StringRef sectionName) override {
57+
return sectionName.startswith("__swift5_") || sectionName == "__const";
58+
}
5359
};
5460

5561
/// Responsible for providing the ELF reflection section identifiers.
@@ -72,6 +78,10 @@ class SwiftObjectFileFormatELF : public SwiftObjectFileFormat {
7278
}
7379
llvm_unreachable("Section type not found.");
7480
}
81+
82+
bool sectionContainsReflectionData(llvm::StringRef sectionName) override {
83+
return sectionName.startswith("swift5_");
84+
}
7585
};
7686

7787
/// Responsible for providing the COFF reflection section identifiers
@@ -94,6 +104,10 @@ class SwiftObjectFileFormatCOFF : public SwiftObjectFileFormat {
94104
}
95105
llvm_unreachable("Section not found.");
96106
}
107+
108+
bool sectionContainsReflectionData(llvm::StringRef sectionName) override {
109+
return sectionName.startswith(".sw5");
110+
}
97111
};
98112
} // namespace swift
99113
#endif // SWIFT_ABI_OBJECTFILE_H

include/swift/Remote/MetadataReader.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,11 @@ class MetadataReader {
418418
return nullptr;
419419
}
420420
} else {
421-
resolved = RemoteAbsolutePointer("", remoteAddress);
421+
resolved = Reader->resolvePointer(RemoteAddress(remoteAddress), 0);
422+
if (resolved.getSymbol().empty()) {
423+
// No symbol found, use the already calculated address.
424+
resolved = RemoteAbsolutePointer("", remoteAddress);
425+
}
422426
}
423427

424428
switch (kind) {

0 commit comments

Comments
 (0)