[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


================
@@ -18,39 +18,35 @@
 using namespace lldb;
 using namespace lldb_private;
 
-ValueObjectPrinter::ValueObjectPrinter(ValueObject *valobj, Stream *s) {
-  if (valobj) {
-    DumpValueObjectOptions options(*valobj);
-    Init(valobj, s, options, m_options.m_max_ptr_depth, 0, nullptr);
-  } else {
-    DumpValueObjectOptions options;
-    Init(valobj, s, options, m_options.m_max_ptr_depth, 0, nullptr);
-  }
+ValueObjectPrinter::ValueObjectPrinter(ValueObject &valobj, Stream *s)
----------------
clayborg wrote:

Would it make sense to pass in a "ValueObjectSP" here instead? Could some of our crashes be due to someone creating a ValueObjectPrinter and then somehow the ValueObject gets freed behind out backs?

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


More information about the lldb-commits mailing list