[Lldb-commits] [PATCH] D26403: Display the pointer value in the libstdc++ unique_ptr summary

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 9 02:52:14 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL286355: Display the pointer value in the libstdc++ unique_ptr summary (authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D26403?vs=77202&id=77329#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26403

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


Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
+++ lldb/trunk/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: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
===================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
@@ -126,23 +126,14 @@
   if (!m_ptr_obj)
     return false;
 
-  if (m_ptr_obj->GetValueAsUnsigned(0) == 0) {
+  bool success;
+  uint64_t ptr_value = m_ptr_obj->GetValueAsUnsigned(0, &success);
+  if (!success)
+    return false;
+  if (ptr_value == 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::PrintableRepresentationSpecialCases::eDisable,
-              false)) {
-        print_pointee = true;
-      }
-    }
-    if (!print_pointee)
-      stream.Printf("ptr = 0x%" PRIx64, m_ptr_obj->GetValueAsUnsigned(0));
-  }
+  else
+    stream.Printf("0x%" PRIx64, ptr_value);
   return true;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26403.77329.patch
Type: text/x-patch
Size: 2877 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20161109/e1b37d06/attachment.bin>


More information about the lldb-commits mailing list