[Lldb-commits] [lldb] r327017 - Fix std unique pointer pretty-printer for new stl versions

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 8 08:03:09 PST 2018


Author: labath
Date: Thu Mar  8 08:03:09 2018
New Revision: 327017

URL: http://llvm.org/viewvc/llvm-project?rev=327017&view=rev
Log:
Fix std unique pointer pretty-printer for new stl versions

Summary: The unique pointer layout was changed in libstdc++ 6.0.23.

Reviewers: labath, clayborg

Reviewed By: labath, clayborg

Subscribers: luporl, lbianc, lldb-commits

Differential Revision: https://reviews.llvm.org/D44015
Patch by Alexandre Yukio Yamashita <alexandre.yamashita at eldorado.org.br>.

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

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp?rev=327017&r1=327016&r2=327017&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp Thu Mar  8 08:03:09 2018
@@ -43,6 +43,8 @@ private:
   ValueObjectSP m_ptr_obj;
   ValueObjectSP m_obj_obj;
   ValueObjectSP m_del_obj;
+
+  ValueObjectSP GetTuple();
 };
 
 } // end of anonymous namespace
@@ -53,17 +55,34 @@ LibStdcppUniquePtrSyntheticFrontEnd::Lib
   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;
 




More information about the lldb-commits mailing list