xref: /llvm-project-15.0.7/lldb/test/API/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py (revision bb09ef95)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""
2Test that we can hit breakpoints in global constructors
3"""
4
5
6
7import lldb
8from lldbsuite.test.decorators import *
9from lldbsuite.test.lldbtest import *
10from lldbsuite.test import lldbutil
11
12
13class TestBreakpointInGlobalConstructors(TestBase):
14
15    mydir = TestBase.compute_mydir(__file__)
16    NO_DEBUG_INFO_TESTCASE = True
17
18    @expectedFailureNetBSD
19    def test(self):
20        self.build()
21        self.line_foo = line_number('foo.cpp', '// !BR_foo')
22        self.line_main = line_number('main.cpp', '// !BR_main')
23
24        target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
25        self.assertTrue(target, VALID_TARGET)
26
27        env= self.registerSharedLibrariesWithTarget(target, ["foo"])
28
29        bp_main = lldbutil.run_break_set_by_file_and_line(
30            self, 'main.cpp', self.line_main)
31
32        bp_foo = lldbutil.run_break_set_by_file_and_line(
33            self, 'foo.cpp', self.line_foo, num_expected_locations=-2)
34
35        process = target.LaunchSimple(
36            None, env, self.get_process_working_directory())
37
38        self.assertIsNotNone(
39            lldbutil.get_one_thread_stopped_at_breakpoint_id(
40                self.process(), bp_foo))
41
42        self.runCmd("continue")
43
44        self.assertIsNotNone(
45            lldbutil.get_one_thread_stopped_at_breakpoint_id(
46                self.process(), bp_main))
47

served by {OpenGrok

Last Index Update: Tue Oct 21 18:42:31 GMT 2025