diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2023-05-01 21:22:40 -0700 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2023-05-01 21:23:14 -0700 |
commit | 9cb3af1e8649444da7ac5080fe2ade70b5dc2992 (patch) | |
tree | 8ddfc3081c90bfebfa1e2b3a4d78ea9ecb0b077f /lldb/source/Commands/CommandObjectMemory.cpp | |
parent | 7d0938bf2c2a35d4eb4b8c4c728aaa85d1dd428e (diff) | |
download | llvm-9cb3af1e8649444da7ac5080fe2ade70b5dc2992.zip llvm-9cb3af1e8649444da7ac5080fe2ade70b5dc2992.tar.gz llvm-9cb3af1e8649444da7ac5080fe2ade70b5dc2992.tar.bz2 |
[lldb] Fix bug introduced by fdbe7c7faa54
I didn't account for the scenario where the string was set but was
empty. This commit restores the old behavior and fixes
TestMemoryFind.py.
Diffstat (limited to 'lldb/source/Commands/CommandObjectMemory.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectMemory.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index 9034243..a8896f8 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -1047,13 +1047,13 @@ protected: DataBufferHeap buffer; if (m_memory_options.m_string.OptionWasSet()) { - std::optional<llvm::StringRef> str = - m_memory_options.m_string.GetStringValue(); - if (!str) { + llvm::StringRef str = + m_memory_options.m_string.GetStringValue().value_or(""); + if (str.empty()) { result.AppendError("search string must have non-zero length."); return false; } - buffer.CopyData(*str); + buffer.CopyData(str); } else if (m_memory_options.m_expr.OptionWasSet()) { StackFrame *frame = m_exe_ctx.GetFramePtr(); ValueObjectSP result_sp; |