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