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