]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / breakpoint / cpp_exception / TestCPPExceptionBreakpoint.py
1 """
2 Test that you can set breakpoint and hit the C++ language exception breakpoint
3 """
4
5 from __future__ import print_function
6
7
8 import os
9 import re
10 import sys
11 import lldb
12 from lldbsuite.test.decorators import *
13 from lldbsuite.test.lldbtest import *
14 from lldbsuite.test import lldbutil
15
16
17 class TestCPPExceptionBreakpoint (TestBase):
18
19     mydir = TestBase.compute_mydir(__file__)
20     my_var = 10
21
22     @add_test_categories(['pyapi'])
23     @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24538")
24     def test_cpp_exception_breakpoint(self):
25         """Test setting and hitting the C++ exception breakpoint."""
26         self.build()
27         self.do_cpp_exception_bkpt()
28
29     def setUp(self):
30         TestBase.setUp(self)
31         self.main_source = "main.c"
32         self.main_source_spec = lldb.SBFileSpec(self.main_source)
33
34     def do_cpp_exception_bkpt(self):
35         exe = os.path.join(os.getcwd(), "a.out")
36         error = lldb.SBError()
37
38         self.target = self.dbg.CreateTarget(exe)
39         self.assertTrue(self.target, VALID_TARGET)
40
41         exception_bkpt = self.target.BreakpointCreateForException(
42             lldb.eLanguageTypeC_plus_plus, False, True)
43         self.assertTrue(
44             exception_bkpt.IsValid(),
45             "Created exception breakpoint.")
46
47         process = self.target.LaunchSimple(
48             None, None, self.get_process_working_directory())
49         self.assertTrue(process, PROCESS_IS_VALID)
50
51         thread_list = lldbutil.get_threads_stopped_at_breakpoint(
52             process, exception_bkpt)
53         self.assertTrue(len(thread_list) == 1,
54                         "One thread stopped at the exception breakpoint.")