xref: /llvm-project/lldb/test/API/macosx/bss-only-data-section-sliding/TestBSSOnlyDataSectionSliding.py (revision 623e8455919af69b039fe7450118ba953423a027)
1"""Test that we a BSS-data only DATA segment is slid with other segments."""
2
3import lldb
4from lldbsuite.test.decorators import *
5from lldbsuite.test.lldbtest import *
6from lldbsuite.test import lldbutil
7
8
9class TestBSSOnlyDataSectionSliding(TestBase):
10    @skipUnlessDarwin
11    def test_with_python_api(self):
12        """Test that we get thread names when interrupting a process."""
13        self.build()
14        exe = self.getBuildArtifact("a.out")
15
16        target = self.dbg.CreateTarget(exe, "", "", False, lldb.SBError())
17        self.assertTrue(target, VALID_TARGET)
18
19        module = target.modules[0]
20        self.assertTrue(module.IsValid())
21        data_sect = module.section["__DATA"]
22        self.assertTrue(data_sect.IsValid())
23
24        target.SetModuleLoadAddress(module, 0x170000000)
25        self.assertEqual(
26            data_sect.GetFileAddress() + 0x170000000, data_sect.GetLoadAddress(target)
27        )
28