xref: /llvm-project-15.0.7/lldb/test/API/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py (revision 227c8ff1)
  • 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    @expectedFailureAll(oslist=["freebsd"])
19    @expectedFailureNetBSD
20    def test(self):
21        self.build()
22        self.line_foo = line_number('foo.cpp', '// !BR_foo')
23        self.line_main = line_number('main.cpp', '// !BR_main')
24
25        target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
26        self.assertTrue(target, VALID_TARGET)
27
28        env= self.registerSharedLibrariesWithTarget(target, ["foo"])
29
30        bp_main = lldbutil.run_break_set_by_file_and_line(
31            self, 'main.cpp', self.line_main)
32
33        bp_foo = lldbutil.run_break_set_by_file_and_line(
34            self, 'foo.cpp', self.line_foo, num_expected_locations=-2)
35
36        process = target.LaunchSimple(
37            None, env, self.get_process_working_directory())
38
39        self.assertIsNotNone(
40            lldbutil.get_one_thread_stopped_at_breakpoint_id(
41                self.process(), bp_foo))
42
43        self.runCmd("continue")
44
45        self.assertIsNotNone(
46            lldbutil.get_one_thread_stopped_at_breakpoint_id(
47                self.process(), bp_main))
48

served by {OpenGrok

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