[Lldb-commits] [PATCH] D148662: [lldb] Make the libcxx unique_ptr prettyprinter support custom deleters.

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 28 04:02:48 PDT 2023


labath accepted this revision.
labath added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp:52
+    ValueObject &pair) {
+  ValueObjectSP value = pair.GetChildAtIndex(0, true)->GetChildMemberWithName(
+      ConstString("__value_"), true);
----------------
We should check that `pair.GetChildAtIndex(0, true)` returns a valid value before dereferencing it, so we don't crash if the definition of the comppressed_pair type is missing or something like


================
Comment at: lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp:65
+  ValueObjectSP value;
+  if (pair.GetNumChildren() > 1)
+    value = pair.GetChildAtIndex(1, true)->GetChildMemberWithName(
----------------
Similarly, here (I'm don't think that `GetNumChildren()>1` actually guarantees that the GetChildAtIndex(1) will return a valid object).


================
Comment at: lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp:725
 
-  m_value_ptr_sp = GetValueOfLibCXXCompressedPair(*ptr_sp);
+  m_value_ptr_sp = GetFirstValueOfLibCXXCompressedPair(*ptr_sp);
+  ValueObjectSP deleter_sp = GetSecondValueOfLibCXXCompressedPair(*ptr_sp);
----------------
unrelated, but it might be nice to give a better name to the pointed-to value as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148662/new/

https://reviews.llvm.org/D148662



More information about the lldb-commits mailing list