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

served by {OpenGrok

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