Skip to content

Commit 03a0435

Browse files
committed
[lldb] Force live memory if we can't read from the file-cache
Now that reading C strings go through the file-cache by default, make sure that any calls that come from LLDBMemoryReader force live memory when we can't read from the file-cache. This is the case when: - The LLDB setting marks it as disabled. - The target is 32 bits (this may be subject to change). - The address we're reading from is not one of the fake addresses we resolved in LLDBMemoryReader.
1 parent ecd3b66 commit 03a0435

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/LLDBMemoryReader.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ bool LLDBMemoryReader::readString(swift::remote::RemoteAddress address,
198198

199199
Target &target(m_process.GetTarget());
200200
Status error;
201-
target.ReadCStringFromMemory(addr, dest, error);
201+
// We only want to allow the file-cache optimization if we resolved the
202+
// address to section + offset.
203+
const bool force_live_memory =
204+
!readMetadataFromFileCacheEnabled() || !addr.IsSectionOffset();
205+
target.ReadCStringFromMemory(addr, dest, error, force_live_memory);
202206
if (error.Success()) {
203207
auto format_string = [](const std::string &dest) {
204208
StreamString stream;

0 commit comments

Comments
 (0)