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

via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 9 14:24:24 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)
----------------
jimingham wrote:

For this series of crashes,  the EXC_BAD_ACCESS address is the correct offset for the ivar being accessed.  So the address of the ValueObject pointer has to be 0x0.  If the pointer had gotten freed, the printer's pointer value wouldn't change, so the access would just be some random looking address.

Also, see the more general comment about uses of the ValueObjectPrinter.

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


More information about the lldb-commits mailing list