https://github.com/kastiglione created https://github.com/llvm/llvm-project/pull/175847
When an object description expression fails, instead of emitting an error, mark it as a warning instead. Additionally, send the more low level details of the failure to the `expr` log, and show a more user friendly message: > `po` was unsuccessful, running `p` instead rdar://165190497 >From 0ce3b0e13a4f8d8d06c2dc04e7cfcbe38eabd2f6 Mon Sep 17 00:00:00 2001 From: Dave Lee <[email protected]> Date: Tue, 13 Jan 2026 13:43:35 -0800 Subject: [PATCH] [lldb] Change po fallback messaging When an object description expression fails, instead of emitting an error, mark it as a warning instead. Additionally, send the more low level details of the failure to the `expr` log, and show a more user friendly message: > `po` was unsuccessful, running `p` instead rdar://165190497 --- lldb/source/DataFormatters/ValueObjectPrinter.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/lldb/source/DataFormatters/ValueObjectPrinter.cpp index e20051140806b..bdad8c0cc2343 100644 --- a/lldb/source/DataFormatters/ValueObjectPrinter.cpp +++ b/lldb/source/DataFormatters/ValueObjectPrinter.cpp @@ -12,6 +12,7 @@ #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Target/Language.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Log.h" #include "lldb/Utility/Stream.h" #include "lldb/ValueObject/ValueObject.h" #include "llvm/Support/Error.h" @@ -100,8 +101,10 @@ llvm::Error ValueObjectPrinter::PrintValueObject() { llvm::Expected<std::string> object_desc_or_err = GetMostSpecializedValue().GetObjectDescription(); if (!object_desc_or_err) { - auto error_msg = toString(object_desc_or_err.takeError()); - *m_stream << "error: " << error_msg << maybeNewline(error_msg); + *m_stream << "warning: `po` was unsuccessful, running `p` instead"; + LLDB_LOG_ERROR(GetLog(LLDBLog::Expressions), + object_desc_or_err.takeError(), + "Object description fallback due to error: {0}"); // Print the value object directly. m_options.DisableObjectDescription(); _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
