summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-09-10 12:04:04 +0000
committerRaphael Isemann <teemperor@gmail.com>2019-09-10 12:04:04 +0000
commitd9442afba1bd65fd0b5c93b67922eaed923445e2 (patch)
tree4cf657a31d92a6a17d07dd8a81e85bd00fe22d39 /lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception
parent3729b17cff53b536d2019b2d4c90e2a6f17754d1 (diff)
downloadbcm5719-llvm-d9442afba1bd65fd0b5c93b67922eaed923445e2.tar.gz
bcm5719-llvm-d9442afba1bd65fd0b5c93b67922eaed923445e2.zip
[lldb] Readd missing functionalities/breakpoint tests
It seems when I restructured the test folders the functionalities/breakpoint was deleted. This just reverts this change and re-adds the tests. llvm-svn: 371512
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/Makefile5
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py52
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/main.cpp13
3 files changed, 70 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/Makefile
new file mode 100644
index 00000000000..314f1cb2f07
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
new file mode 100644
index 00000000000..e8a1b81a839
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
@@ -0,0 +1,52 @@
+"""
+Test that you can set breakpoint and hit the C++ language exception breakpoint
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCPPExceptionBreakpoint (TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+ my_var = 10
+
+ @add_test_categories(['pyapi'])
+ @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24538")
+ @expectedFailureNetBSD
+ def test_cpp_exception_breakpoint(self):
+ """Test setting and hitting the C++ exception breakpoint."""
+ self.build()
+ self.do_cpp_exception_bkpt()
+
+ def setUp(self):
+ TestBase.setUp(self)
+ self.main_source = "main.c"
+ self.main_source_spec = lldb.SBFileSpec(self.main_source)
+
+ def do_cpp_exception_bkpt(self):
+ exe = self.getBuildArtifact("a.out")
+ error = lldb.SBError()
+
+ self.target = self.dbg.CreateTarget(exe)
+ self.assertTrue(self.target, VALID_TARGET)
+
+ exception_bkpt = self.target.BreakpointCreateForException(
+ lldb.eLanguageTypeC_plus_plus, False, True)
+ self.assertTrue(
+ exception_bkpt.IsValid(),
+ "Created exception breakpoint.")
+
+ process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+ self.assertTrue(process, PROCESS_IS_VALID)
+
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(
+ process, exception_bkpt)
+ self.assertTrue(len(thread_list) == 1,
+ "One thread stopped at the exception breakpoint.")
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/main.cpp
new file mode 100644
index 00000000000..76cb22735a7
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/main.cpp
@@ -0,0 +1,13 @@
+#include <exception>
+
+void
+throws_int ()
+{
+ throw 5;
+}
+
+int
+main ()
+{
+ throws_int();
+}
OpenPOWER on IntegriCloud