summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite
diff options
context:
space:
mode:
authorTamas Berghammer <tberghammer@google.com>2016-07-06 09:50:00 +0000
committerTamas Berghammer <tberghammer@google.com>2016-07-06 09:50:00 +0000
commit9c6c8e99919a6f21e382da789a0e046026d2f18a (patch)
tree032bb7436a8eb3ffd477b1ca8276d4c7d10210d6 /lldb/packages/Python/lldbsuite
parent4879b050cccc33a91bbda4203961e7365ad19cf9 (diff)
downloadbcm5719-llvm-9c6c8e99919a6f21e382da789a0e046026d2f18a.tar.gz
bcm5719-llvm-9c6c8e99919a6f21e382da789a0e046026d2f18a.zip
Add data formatter for libstdc++ shared_ptr and weak_ptr
Differential revision: http://reviews.llvm.org/D21984 llvm-svn: 274617
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile15
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py45
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/main.cpp20
3 files changed, 80 insertions, 0 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
new file mode 100644
index 00000000000..88cb026aba1
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile
@@ -0,0 +1,15 @@
+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
+
+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
new file mode 100644
index 00000000000..9ad2aafa990
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
@@ -0,0 +1,45 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+import os, time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class StdSmartPtrDataFormatterTestCase(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD
+ @skipIfWindows # libstdcpp not ported to Windows
+ def test_with_run_command(self):
+ self.build()
+ self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+ lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line.")
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ 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 nwp", substrs = ['nwp = nullptr'])
+ self.expect("frame variable iwp", substrs = ['iwp = 123'])
+ self.expect("frame variable swp", substrs = ['swp = "foobar"'])
+
+ self.runCmd("continue")
+
+ 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'])
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/main.cpp
new file mode 100644
index 00000000000..7ba50875a6d
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/main.cpp
@@ -0,0 +1,20 @@
+#include <memory>
+#include <string>
+
+int
+main()
+{
+ std::shared_ptr<char> nsp;
+ std::shared_ptr<int> isp(new int{123});
+ std::shared_ptr<std::string> ssp = std::make_shared<std::string>("foobar");
+
+ std::weak_ptr<char> nwp;
+ std::weak_ptr<int> iwp = isp;
+ std::weak_ptr<std::string> swp = ssp;
+
+ nsp.reset(); // Set break point at this line.
+ isp.reset();
+ ssp.reset();
+
+ return 0; // Set break point at this line.
+}
OpenPOWER on IntegriCloud