diff options
| author | Pavel Labath <pavel@labath.sk> | 2022-07-12 11:51:33 +0200 |
|---|---|---|
| committer | Pavel Labath <pavel@labath.sk> | 2022-07-12 12:14:54 +0200 |
| commit | 4135abca897d1b945193f767cbf42a200b55bbdc (patch) | |
| tree | 46645c3946b946df66d4a213f33cc4f355edae05 /lldb/test/API/python_api/section | |
| parent | c5d68ca1c82f35ed1d75a598d1862aeb10a905cb (diff) | |
| download | llvm-4135abca897d1b945193f767cbf42a200b55bbdc.zip llvm-4135abca897d1b945193f767cbf42a200b55bbdc.tar.gz llvm-4135abca897d1b945193f767cbf42a200b55bbdc.tar.bz2 | |
[lldb] add SBSection.alignment to python bindings
This commit adds SBSection.GetAlignment(), and SBSection.alignment as a python property to lldb.
Reviewed By: clayborg, JDevlieghere, labath
Differential Revision: https://reviews.llvm.org/D128069
Diffstat (limited to 'lldb/test/API/python_api/section')
| -rw-r--r-- | lldb/test/API/python_api/section/TestSectionAPI.py | 11 | ||||
| -rw-r--r-- | lldb/test/API/python_api/section/aligned.yaml | 14 |
2 files changed, 25 insertions, 0 deletions
diff --git a/lldb/test/API/python_api/section/TestSectionAPI.py b/lldb/test/API/python_api/section/TestSectionAPI.py index 51a0037..ab9ae56 100644 --- a/lldb/test/API/python_api/section/TestSectionAPI.py +++ b/lldb/test/API/python_api/section/TestSectionAPI.py @@ -37,3 +37,14 @@ class SectionAPITestCase(TestBase): self.assertIsNotNone(data_section) self.assertEqual(data_section.target_byte_size, 1) + + def test_get_alignment(self): + exe = self.getBuildArtifact("aligned.out") + self.yaml2obj("aligned.yaml", exe) + target = self.dbg.CreateTarget(exe) + self.assertTrue(target, VALID_TARGET) + + # exe contains a single section aligned to 0x1000 + section = target.modules[0].sections[0] + self.assertEqual(section.GetAlignment(), 0x1000) + self.assertEqual(section.alignment, 0x1000) diff --git a/lldb/test/API/python_api/section/aligned.yaml b/lldb/test/API/python_api/section/aligned.yaml new file mode 100644 index 0000000..f96d484 --- /dev/null +++ b/lldb/test/API/python_api/section/aligned.yaml @@ -0,0 +1,14 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 + Entry: 0x0000000000400000 +Sections: + - Name: .text1 + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x0000000000400000 + AddressAlign: 0x0000000000001000 + Size: 0xb0 |
