labath created this revision.
labath added reviewers: tberghammer, granata.enrico.
labath added a subscriber: lldb-commits.

r284830 added a summary provider for unique_ptr in libstdc++, whose value 
printed
the value of the pointee. This is a bit unintuitive as it becomes unobvious that
the value actually is a pointer, and we lose the way to actually obtain the
pointer value.

Change that to print the pointer value instead. The pointee value can still be
obtained through the synthetic children.


https://reviews.llvm.org/D26403

Files:
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
  source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp


Index: source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
===================================================================
--- source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
+++ source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
@@ -129,19 +129,7 @@
   if (m_ptr_obj->GetValueAsUnsigned(0) == 0) {
     stream.Printf("nullptr");
   } else {
-    Error error;
-    bool print_pointee = false;
-    if (m_obj_obj) {
-      if (m_obj_obj->DumpPrintableRepresentation(
-              stream, ValueObject::eValueObjectRepresentationStyleSummary,
-              lldb::eFormatInvalid,
-              ValueObject::ePrintableRepresentationSpecialCasesDisable,
-              false)) {
-        print_pointee = true;
-      }
-    }
-    if (!print_pointee)
-      stream.Printf("ptr = 0x%" PRIx64, m_ptr_obj->GetValueAsUnsigned(0));
+    stream.Printf("0x%" PRIx64, m_ptr_obj->GetValueAsUnsigned(0));
   }
   return true;
 }
Index: 
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
===================================================================
--- 
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
+++ 
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
@@ -34,12 +34,12 @@
         self.assertTrue(frame.IsValid())
 
         self.expect("frame variable nup", substrs=['nup = nullptr'])
-        self.expect("frame variable iup", substrs=['iup = 123', 'object = 
123'])
-        self.expect("frame variable sup", substrs=['sup = "foobar"', 'object = 
"foobar"'])
+        self.expect("frame variable iup", substrs=['iup = 0x', 'object = 123'])
+        self.expect("frame variable sup", substrs=['sup = 0x', 'object = 
"foobar"'])
 
         self.expect("frame variable ndp", substrs=['ndp = nullptr'])
-        self.expect("frame variable idp", substrs=['idp = 456', 'object = 
456', 'deleter = ', 'a = 1', 'b = 2'])
-        self.expect("frame variable sdp", substrs=['sdp = "baz"', 'object = 
"baz"', 'deleter = ', 'a = 3', 'b = 4'])
+        self.expect("frame variable idp", substrs=['idp = 0x', 'object = 456', 
'deleter = ', 'a = 1', 'b = 2'])
+        self.expect("frame variable sdp", substrs=['sdp = 0x', 'object = 
"baz"', 'deleter = ', 'a = 3', 'b = 4'])
         
         self.assertEqual(123, 
frame.GetValueForVariablePath("iup.object").GetValueAsUnsigned())
         
self.assertFalse(frame.GetValueForVariablePath("iup.deleter").IsValid())


Index: source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
===================================================================
--- source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
+++ source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
@@ -129,19 +129,7 @@
   if (m_ptr_obj->GetValueAsUnsigned(0) == 0) {
     stream.Printf("nullptr");
   } else {
-    Error error;
-    bool print_pointee = false;
-    if (m_obj_obj) {
-      if (m_obj_obj->DumpPrintableRepresentation(
-              stream, ValueObject::eValueObjectRepresentationStyleSummary,
-              lldb::eFormatInvalid,
-              ValueObject::ePrintableRepresentationSpecialCasesDisable,
-              false)) {
-        print_pointee = true;
-      }
-    }
-    if (!print_pointee)
-      stream.Printf("ptr = 0x%" PRIx64, m_ptr_obj->GetValueAsUnsigned(0));
+    stream.Printf("0x%" PRIx64, m_ptr_obj->GetValueAsUnsigned(0));
   }
   return true;
 }
Index: packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
+++ packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
@@ -34,12 +34,12 @@
         self.assertTrue(frame.IsValid())
 
         self.expect("frame variable nup", substrs=['nup = nullptr'])
-        self.expect("frame variable iup", substrs=['iup = 123', 'object = 123'])
-        self.expect("frame variable sup", substrs=['sup = "foobar"', 'object = "foobar"'])
+        self.expect("frame variable iup", substrs=['iup = 0x', 'object = 123'])
+        self.expect("frame variable sup", substrs=['sup = 0x', 'object = "foobar"'])
 
         self.expect("frame variable ndp", substrs=['ndp = nullptr'])
-        self.expect("frame variable idp", substrs=['idp = 456', 'object = 456', 'deleter = ', 'a = 1', 'b = 2'])
-        self.expect("frame variable sdp", substrs=['sdp = "baz"', 'object = "baz"', 'deleter = ', 'a = 3', 'b = 4'])
+        self.expect("frame variable idp", substrs=['idp = 0x', 'object = 456', 'deleter = ', 'a = 1', 'b = 2'])
+        self.expect("frame variable sdp", substrs=['sdp = 0x', 'object = "baz"', 'deleter = ', 'a = 3', 'b = 4'])
         
         self.assertEqual(123, frame.GetValueForVariablePath("iup.object").GetValueAsUnsigned())
         self.assertFalse(frame.GetValueForVariablePath("iup.deleter").IsValid())
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to