43 lines · python
1"""Test that the 'add-dsym', aka 'target symbols add', succeeds in the middle of debug session."""2 3 4import lldb5from lldbsuite.test.decorators import *6from lldbsuite.test.lldbtest import *7from lldbsuite.test import lldbutil8 9 10@skipUnlessDarwin11class AddDsymMidExecutionCommandCase(TestBase):12 def setUp(self):13 # Call super's setUp().14 TestBase.setUp(self)15 self.source = "main.c"16 17 @no_debug_info_test # Prevent the genaration of the dwarf version of this test18 def test_add_dsym_mid_execution(self):19 """Test that add-dsym mid-execution loads the symbols at the right place for a slid binary."""20 self.build(debug_info="dsym")21 exe = self.getBuildArtifact("a.out")22 23 self.target = self.dbg.CreateTarget(exe)24 self.assertTrue(self.target, VALID_TARGET)25 26 main_bp = self.target.BreakpointCreateByName("main", "a.out")27 self.assertTrue(main_bp, VALID_BREAKPOINT)28 29 self.runCmd("settings set target.disable-aslr false")30 self.process = self.target.LaunchSimple(31 None, None, self.get_process_working_directory()32 )33 self.assertTrue(self.process, PROCESS_IS_VALID)34 35 # The stop reason of the thread should be breakpoint.36 self.assertState(37 self.process.GetState(), lldb.eStateStopped, STOPPED_DUE_TO_BREAKPOINT38 )39 40 self.runCmd("add-dsym " + self.getBuildArtifact("hide.app/Contents/a.out.dSYM"))41 42 self.expect("frame select", substrs=["a.out`main at main.c"])43