[Lldb-commits] [lldb] Make ValueObjectPrinter's handling of its ValueObject pointers more principled (NFC) (PR #81314)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 9 12:51:50 PST 2024


================
@@ -177,7 +177,10 @@ class CommandObjectFrameDiagnose : public CommandObjectParsed {
 
     DumpValueObjectOptions options;
     options.SetDeclPrintingHelper(helper);
-    ValueObjectPrinter printer(valobj_sp.get(), &result.GetOutputStream(),
+    // We've already handled the case where the value object sp is null, so
+    // this is just to make sure future changes don't skip that:
+    assert(valobj_sp.get() && "Must have a valid ValueObject to print");
----------------
clayborg wrote:

It is fine to assert here, but we should not crash if valobj_sp is NULL. I would rather log or report an error that crash if possible.

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


More information about the lldb-commits mailing list