[PATCH] D44015: Fix std unique pointer not printing.

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 8 08:05:42 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL327017: Fix std unique pointer pretty-printer for new stl versions (authored by labath, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D44015

Files:
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp


Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
===================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
@@ -43,6 +43,8 @@
   ValueObjectSP m_ptr_obj;
   ValueObjectSP m_obj_obj;
   ValueObjectSP m_del_obj;
+
+  ValueObjectSP GetTuple();
 };
 
 } // end of anonymous namespace
@@ -53,17 +55,34 @@
   Update();
 }
 
-bool LibStdcppUniquePtrSyntheticFrontEnd::Update() {
+ValueObjectSP LibStdcppUniquePtrSyntheticFrontEnd::GetTuple() {
   ValueObjectSP valobj_backend_sp = m_backend.GetSP();
+
   if (!valobj_backend_sp)
-    return false;
+    return nullptr;
 
   ValueObjectSP valobj_sp = valobj_backend_sp->GetNonSyntheticValue();
   if (!valobj_sp)
-    return false;
+    return nullptr;
 
-  ValueObjectSP tuple_sp =
+  ValueObjectSP obj_child_sp =
       valobj_sp->GetChildMemberWithName(ConstString("_M_t"), true);
+
+  ValueObjectSP obj_subchild_sp =
+      obj_child_sp->GetChildMemberWithName(ConstString("_M_t"), true);
+
+  // if there is a _M_t subchild, the tuple is found in
+  // the obj_subchild_sp (for libstdc++ 6.0.23).
+  if (obj_subchild_sp) {
+    return obj_subchild_sp;
+  }
+
+  return obj_child_sp;
+}
+
+bool LibStdcppUniquePtrSyntheticFrontEnd::Update() {
+  ValueObjectSP tuple_sp = GetTuple();
+
   if (!tuple_sp)
     return false;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44015.137577.patch
Type: text/x-patch
Size: 1461 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180308/9941a45b/attachment-0001.bin>


More information about the llvm-commits mailing list