Skip to content

Commit 2fe7671

Browse files
committed
Log non-fatal errors
1 parent d4b65cb commit 2fe7671

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

lldb/source/Commands/CommandObjectDWIMPrint.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
1919
#include "lldb/Target/StackFrame.h"
2020
#include "lldb/Utility/ConstString.h"
21+
#include "lldb/Utility/LLDBLog.h"
22+
#include "lldb/Utility/Log.h"
2123
#include "lldb/ValueObject/ValueObject.h"
2224
#include "lldb/lldb-defines.h"
2325
#include "lldb/lldb-enumerations.h"
@@ -182,11 +184,13 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
182184
expr);
183185
}
184186

185-
bool failed = errorToBool(dump_val_object(*valobj_sp));
186-
if (!failed)
187+
Error err = dump_val_object(*valobj_sp);
188+
if (!err)
187189
return;
188190

189191
// Dump failed, continue on to expression evaluation.
192+
LLDB_LOG_ERROR(GetLog(LLDBLog::Expressions), std::move(err),
193+
"could not print frame variable '{1}': {0}", expr);
190194
}
191195
}
192196

@@ -195,9 +199,14 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
195199
if (auto *state = target.GetPersistentExpressionStateForLanguage(language))
196200
if (auto var_sp = state->GetVariable(expr))
197201
if (auto valobj_sp = var_sp->GetValueObject()) {
198-
bool failed = errorToBool(dump_val_object(*valobj_sp));
199-
if (!failed)
202+
Error err = dump_val_object(*valobj_sp);
203+
if (!err)
200204
return;
205+
206+
// Dump failed, continue on to expression evaluation.
207+
LLDB_LOG_ERROR(GetLog(LLDBLog::Expressions), std::move(err),
208+
"could not print persistent variable '{1}': {0}",
209+
expr);
201210
}
202211

203212
// Third, and lastly, try `expr` as a source expression to evaluate.

0 commit comments

Comments
 (0)