• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""Test that the 'add-dsym', aka 'target symbols add', succeeds in the middle of debug session."""
2
3
4
5import lldb
6from lldbsuite.test.decorators import *
7from lldbsuite.test.lldbtest import *
8from lldbsuite.test import lldbutil
9
10
11@skipUnlessDarwin
12class AddDsymMidExecutionCommandCase(TestBase):
13
14    mydir = TestBase.compute_mydir(__file__)
15
16    def setUp(self):
17        # Call super's setUp().
18        TestBase.setUp(self)
19        self.source = 'main.c'
20
21    @no_debug_info_test  # Prevent the genaration of the dwarf version of this test
22    def test_add_dsym_mid_execution(self):
23        """Test that add-dsym mid-execution loads the symbols at the right place for a slid binary."""
24        self.buildDefault(dictionary={'MAKE_DSYM':'YES'})
25        exe = self.getBuildArtifact("a.out")
26
27        self.target = self.dbg.CreateTarget(exe)
28        self.assertTrue(self.target, VALID_TARGET)
29
30        main_bp = self.target.BreakpointCreateByName("main", "a.out")
31        self.assertTrue(main_bp, VALID_BREAKPOINT)
32
33        self.runCmd("settings set target.disable-aslr false")
34        self.process = self.target.LaunchSimple(
35            None, None, self.get_process_working_directory())
36        self.assertTrue(self.process, PROCESS_IS_VALID)
37
38        # The stop reason of the thread should be breakpoint.
39        self.assertEquals(self.process.GetState(), lldb.eStateStopped,
40                        STOPPED_DUE_TO_BREAKPOINT)
41
42        self.runCmd("add-dsym " +
43                    self.getBuildArtifact("hide.app/Contents/a.out.dSYM"))
44
45        self.expect("frame select",
46                    substrs=['a.out`main at main.c'])
47