[Lldb-commits] [lldb] 9cb3af1 - [lldb] Fix bug introduced by fdbe7c7faa54
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Mon May 1 21:23:19 PDT 2023
Author: Jonas Devlieghere
Date: 2023-05-01T21:23:14-07:00
New Revision: 9cb3af1e8649444da7ac5080fe2ade70b5dc2992
URL: https://github.com/llvm/llvm-project/commit/9cb3af1e8649444da7ac5080fe2ade70b5dc2992
DIFF: https://github.com/llvm/llvm-project/commit/9cb3af1e8649444da7ac5080fe2ade70b5dc2992.diff
LOG: [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.
Added:
Modified:
lldb/source/Commands/CommandObjectMemory.cpp
Removed:
################################################################################
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 903424336cd5..a8896f8c1fea 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -1047,13 +1047,13 @@ class CommandObjectMemoryFind : public CommandObjectParsed {
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;
More information about the lldb-commits
mailing list