summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite
diff options
context:
space:
mode:
authorTamas Berghammer <tberghammer@google.com>2016-10-21 15:02:32 +0000
committerTamas Berghammer <tberghammer@google.com>2016-10-21 15:02:32 +0000
commit0789722d85cf1f1fdbe2ffb2245ea0ba034a9f94 (patch)
treef2c69ffecc4b7e3424ff05649202deaa41e77391 /lldb/packages/Python/lldbsuite
parent47dc098c0665931bbd885c40b2f596697b1b54c9 (diff)
downloadbcm5719-llvm-0789722d85cf1f1fdbe2ffb2245ea0ba034a9f94.tar.gz
bcm5719-llvm-0789722d85cf1f1fdbe2ffb2245ea0ba034a9f94.zip
Improve the libstdc++ smart pointer formatters
* Display the strong/weak count in the summary * Display the pointed object as a synthetic member * Create synthetic children for weak/strong count Differential revision: https://reviews.llvm.org/D25726 llvm-svn: 284828
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile9
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py55
2 files changed, 48 insertions, 16 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile
index 88cb026aba1..beb2fd583e7 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile
@@ -2,14 +2,7 @@ LEVEL = ../../../../../make
CXX_SOURCES := main.cpp
-CXXFLAGS := -O0
USE_LIBSTDCPP := 1
-
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets. Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
- CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
+CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS)
include $(LEVEL)/Makefile.rules
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
index 8d940c2686a..978c2ac3ed3 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
@@ -31,19 +31,58 @@ class StdSmartPtrDataFormatterTestCase(TestBase):
substrs=['stopped', 'stop reason = breakpoint'])
self.expect("frame variable nsp", substrs=['nsp = nullptr'])
- self.expect("frame variable isp", substrs=['isp = 123'])
- self.expect("frame variable ssp", substrs=['ssp = "foobar"'])
-
+ self.expect("frame variable isp", substrs=['isp = 123', 'strong=1', 'weak=1'])
+ self.expect("frame variable ssp", substrs=['ssp = "foobar"', 'strong=1', 'weak=1'])
self.expect("frame variable nwp", substrs=['nwp = nullptr'])
- self.expect("frame variable iwp", substrs=['iwp = 123'])
- self.expect("frame variable swp", substrs=['swp = "foobar"'])
+ self.expect("frame variable iwp", substrs=['iwp = 123', 'strong=1', 'weak=1'])
+ self.expect("frame variable swp", substrs=['swp = "foobar"', 'strong=1', 'weak=1'])
+
+ frame = self.frame()
+ self.assertTrue(frame.IsValid())
+
+ self.assertEqual(0, frame.GetValueForVariablePath("nsp.pointer").GetValueAsUnsigned())
+ self.assertEqual(0, frame.GetValueForVariablePath("nwp.pointer").GetValueAsUnsigned())
+
+ self.assertNotEqual(0, frame.GetValueForVariablePath("isp.pointer").GetValueAsUnsigned())
+ self.assertEqual(123, frame.GetValueForVariablePath("isp.object").GetValueAsUnsigned())
+ self.assertEqual(1, frame.GetValueForVariablePath("isp.count").GetValueAsUnsigned())
+ self.assertEqual(1, frame.GetValueForVariablePath("isp.weak_count").GetValueAsUnsigned())
+ self.assertFalse(frame.GetValueForVariablePath("isp.foobar").IsValid())
+
+ self.assertNotEqual(0, frame.GetValueForVariablePath("ssp.pointer").GetValueAsUnsigned())
+ self.assertEqual('"foobar"', frame.GetValueForVariablePath("ssp.object").GetSummary())
+ self.assertEqual(1, frame.GetValueForVariablePath("ssp.count").GetValueAsUnsigned())
+ self.assertEqual(1, frame.GetValueForVariablePath("ssp.weak_count").GetValueAsUnsigned())
+ self.assertFalse(frame.GetValueForVariablePath("ssp.foobar").IsValid())
+
+ self.assertNotEqual(0, frame.GetValueForVariablePath("iwp.pointer").GetValueAsUnsigned())
+ self.assertEqual(123, frame.GetValueForVariablePath("iwp.object").GetValueAsUnsigned())
+ self.assertEqual(1, frame.GetValueForVariablePath("iwp.count").GetValueAsUnsigned())
+ self.assertEqual(1, frame.GetValueForVariablePath("iwp.weak_count").GetValueAsUnsigned())
+ self.assertFalse(frame.GetValueForVariablePath("iwp.foobar").IsValid())
+
+ self.assertNotEqual(0, frame.GetValueForVariablePath("swp.pointer").GetValueAsUnsigned())
+ self.assertEqual('"foobar"', frame.GetValueForVariablePath("swp.object").GetSummary())
+ self.assertEqual(1, frame.GetValueForVariablePath("swp.count").GetValueAsUnsigned())
+ self.assertEqual(1, frame.GetValueForVariablePath("swp.weak_count").GetValueAsUnsigned())
+ self.assertFalse(frame.GetValueForVariablePath("swp.foobar").IsValid())
self.runCmd("continue")
+ frame = self.frame()
+ self.assertTrue(frame.IsValid())
+
self.expect("frame variable nsp", substrs=['nsp = nullptr'])
self.expect("frame variable isp", substrs=['isp = nullptr'])
self.expect("frame variable ssp", substrs=['ssp = nullptr'])
-
self.expect("frame variable nwp", substrs=['nwp = nullptr'])
- self.expect("frame variable iwp", substrs=['iwp = nullptr'])
- self.expect("frame variable swp", substrs=['swp = nullptr'])
+ self.expect("frame variable iwp", substrs=['iwp = nullptr', 'strong=0', 'weak=1'])
+ self.expect("frame variable swp", substrs=['swp = nullptr', 'strong=0', 'weak=1'])
+
+ self.assertFalse(frame.GetValueForVariablePath("iwp.object").IsValid())
+ self.assertEqual(0, frame.GetValueForVariablePath("iwp.count").GetValueAsUnsigned())
+ self.assertEqual(1, frame.GetValueForVariablePath("iwp.weak_count").GetValueAsUnsigned())
+
+ self.assertFalse(frame.GetValueForVariablePath("swp.object").IsValid())
+ self.assertEqual(0, frame.GetValueForVariablePath("swp.count").GetValueAsUnsigned())
+ self.assertEqual(1, frame.GetValueForVariablePath("swp.weak_count").GetValueAsUnsigned())
OpenPOWER on IntegriCloud