[Lldb-commits] [lldb] Convert ValueObject::Dump() to return llvm::Error() (NFCish) (PR #95857)

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 18 15:02:27 PDT 2024


================
@@ -299,7 +299,9 @@ bool Watchpoint::DumpSnapshots(Stream *s, const char *prefix) const {
             .SetHideRootType(true)
             .SetHideRootName(true)
             .SetHideName(true);
-        m_old_value_sp->Dump(strm, options);
+        if (llvm::Error error = m_old_value_sp->Dump(strm, options))
+          strm << "error: " << toString(std::move(error));
----------------
adrian-prantl wrote:

Not a bad idea in general, but IMHO outside of the scope of this patch.
1. We'd need to audit the places where this makes sense. Right now all the places I added this manual logging are just random points where I stopped propagating the Error upwards, but domain experts should probably consider just passing the Error further up in most of these places.
2. In this particular example, this is a StreamString, so it wouldn'taccept color.
3. We probably want a Stream::LogError() method that encapsulates all of the code above.

https://github.com/llvm/llvm-project/pull/95857


More information about the lldb-commits mailing list