2 Test that you can set breakpoint and hit the C++ language exception breakpoint
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class TestCPPExceptionBreakpoint (TestBase):
15 mydir = TestBase.compute_mydir(__file__)
18 @add_test_categories(['pyapi'])
19 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24538")
20 @expectedFailureNetBSD
21 def test_cpp_exception_breakpoint(self):
22 """Test setting and hitting the C++ exception breakpoint."""
24 self.do_cpp_exception_bkpt()
26 @add_test_categories(['pyapi'])
27 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24538")
28 @expectedFailureNetBSD
29 def test_dummy_target_cpp_exception_breakpoint(self):
30 """Test setting and hitting the C++ exception breakpoint from dummy target."""
32 self.do_dummy_target_cpp_exception_bkpt()
36 self.main_source = "main.c"
37 self.main_source_spec = lldb.SBFileSpec(self.main_source)
39 def do_cpp_exception_bkpt(self):
40 exe = self.getBuildArtifact("a.out")
41 error = lldb.SBError()
43 self.target = self.dbg.CreateTarget(exe)
44 self.assertTrue(self.target, VALID_TARGET)
46 exception_bkpt = self.target.BreakpointCreateForException(
47 lldb.eLanguageTypeC_plus_plus, False, True)
49 exception_bkpt.IsValid(),
50 "Created exception breakpoint.")
52 process = self.target.LaunchSimple(
53 None, None, self.get_process_working_directory())
54 self.assertTrue(process, PROCESS_IS_VALID)
56 thread_list = lldbutil.get_threads_stopped_at_breakpoint(
57 process, exception_bkpt)
58 self.assertTrue(len(thread_list) == 1,
59 "One thread stopped at the exception breakpoint.")
61 def do_dummy_target_cpp_exception_bkpt(self):
62 exe = self.getBuildArtifact("a.out")
63 error = lldb.SBError()
65 dummy_exception_bkpt = self.dbg.GetDummyTarget().BreakpointCreateForException(
66 lldb.eLanguageTypeC_plus_plus, False, True)
68 dummy_exception_bkpt.IsValid(),
69 "Created exception breakpoint in dummy target.")
71 self.target = self.dbg.CreateTarget(exe)
72 self.assertTrue(self.target, VALID_TARGET)
74 exception_bkpt = self.target.GetBreakpointAtIndex(0)
76 exception_bkpt.IsValid(),
77 "Target primed with exception breakpoint from dummy target.")
79 process = self.target.LaunchSimple(
80 None, None, self.get_process_working_directory())
81 self.assertTrue(process, PROCESS_IS_VALID)
83 thread_list = lldbutil.get_threads_stopped_at_breakpoint(
84 process, exception_bkpt)
85 self.assertTrue(len(thread_list) == 1,
86 "One thread stopped at the exception breakpoint.")