44 lines · python
1"""2Test that we can hit breakpoints in global constructors3"""4 5 6import lldb7from lldbsuite.test.decorators import *8from lldbsuite.test.lldbtest import *9from lldbsuite.test import lldbutil10 11 12class TestBreakpointInGlobalConstructors(TestBase):13 NO_DEBUG_INFO_TESTCASE = True14 15 def test(self):16 self.build()17 self.line_foo = line_number("foo.cpp", "// !BR_foo")18 self.line_main = line_number("main.cpp", "// !BR_main")19 20 target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))21 self.assertTrue(target, VALID_TARGET)22 23 env = self.registerSharedLibrariesWithTarget(target, ["foo"])24 25 bp_main = lldbutil.run_break_set_by_file_and_line(26 self, "main.cpp", self.line_main27 )28 29 bp_foo = lldbutil.run_break_set_by_file_and_line(30 self, "foo.cpp", self.line_foo, num_expected_locations=-231 )32 33 process = target.LaunchSimple(None, env, self.get_process_working_directory())34 35 self.assertIsNotNone(36 lldbutil.get_one_thread_stopped_at_breakpoint_id(self.process(), bp_foo)37 )38 39 self.runCmd("continue")40 41 self.assertIsNotNone(42 lldbutil.get_one_thread_stopped_at_breakpoint_id(self.process(), bp_main)43 )44