@@ -119,25 +119,22 @@ LLDBMemoryReader::getSymbolAddress(const std::string &name) {
119
119
return swift::remote::RemoteAddress (load_addr);
120
120
}
121
121
122
- swift::remote::RemoteAbsolutePointer
123
- LLDBMemoryReader::resolvePointer (swift::remote::RemoteAddress address,
124
- uint64_t readValue) {
122
+ llvm::Optional<swift::remote::RemoteAbsolutePointer>
123
+ LLDBMemoryReader::resolvePointerAsSymbol (swift::remote::RemoteAddress address) {
125
124
// If an address has a symbol, that symbol provides additional useful data to
126
125
// MetadataReader. Without the symbol, MetadataReader can derive the symbol
127
126
// by loading other parts of reflection metadata, but that work has a cost.
128
127
// For lldb, that data loading can be a significant performance hit. Providing
129
128
// a symbol greatly reduces memory read traffic to the process.
130
- auto pointer = swift::remote::RemoteAbsolutePointer (" " , readValue);
131
-
132
129
auto &target = m_process.GetTarget ();
133
130
if (!target.GetSwiftUseReflectionSymbols ())
134
- return pointer ;
131
+ return {} ;
135
132
136
133
llvm::Optional<Address> maybeAddr =
137
134
resolveRemoteAddress (address.getAddressData ());
138
135
// This is not an assert, but should never happen.
139
136
if (!maybeAddr)
140
- return pointer ;
137
+ return {} ;
141
138
142
139
Address addr;
143
140
if (maybeAddr->IsSectionOffset ()) {
@@ -146,21 +143,21 @@ LLDBMemoryReader::resolvePointer(swift::remote::RemoteAddress address,
146
143
} else {
147
144
// `address` is a real load address.
148
145
if (!target.ResolveLoadAddress (address.getAddressData (), addr))
149
- return pointer ;
146
+ return {} ;
150
147
}
151
148
152
149
if (!addr.GetSection ()->CanContainSwiftReflectionData ())
153
- return pointer ;
150
+ return {} ;
154
151
155
152
if (auto *symbol = addr.CalculateSymbolContextSymbol ()) {
156
153
auto mangledName = symbol->GetMangled ().GetMangledName ().GetStringRef ();
157
154
// MemoryReader requires this to be a Swift symbol. LLDB can also be
158
155
// aware of local symbols, so avoid returning those.
159
156
if (swift::Demangle::isSwiftSymbol (mangledName))
160
- return {mangledName, 0 };
157
+ return {{ mangledName, 0 } };
161
158
}
162
159
163
- return pointer ;
160
+ return {} ;
164
161
}
165
162
166
163
bool LLDBMemoryReader::readBytes (swift::remote::RemoteAddress address,
0 commit comments