aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api/section
diff options
context:
space:
mode:
authorMuhammad Omair Javaid <omair.javaid@linaro.org>2023-01-30 16:43:52 +0500
committerMuhammad Omair Javaid <omair.javaid@linaro.org>2023-01-30 16:49:15 +0500
commitbde5d31e96f556fed30bf9120cc6ff05a2116b64 (patch)
tree8c597842f4dcbe4d9fb923a8f28507092eda2619 /lldb/test/API/python_api/section
parent5a9cb377228b5465d343a1af0f088a09c2e098d7 (diff)
downloadllvm-bde5d31e96f556fed30bf9120cc6ff05a2116b64.zip
llvm-bde5d31e96f556fed30bf9120cc6ff05a2116b64.tar.gz
llvm-bde5d31e96f556fed30bf9120cc6ff05a2116b64.tar.bz2
Revert "Revert "[lldb] Make SBSection::GetSectionData call Section::GetSectionData.""
This reverts commit e1bbe50f5a48e9b5407de9e5f4ab8197dedc85c5. Differential Revision: https://reviews.llvm.org/D142672
Diffstat (limited to 'lldb/test/API/python_api/section')
-rw-r--r--lldb/test/API/python_api/section/TestSectionAPI.py21
-rw-r--r--lldb/test/API/python_api/section/compressed-sections.yaml11
2 files changed, 32 insertions, 0 deletions
diff --git a/lldb/test/API/python_api/section/TestSectionAPI.py b/lldb/test/API/python_api/section/TestSectionAPI.py
index ab9ae56..684de3f 100644
--- a/lldb/test/API/python_api/section/TestSectionAPI.py
+++ b/lldb/test/API/python_api/section/TestSectionAPI.py
@@ -11,6 +11,8 @@ from lldbsuite.test import lldbutil
class SectionAPITestCase(TestBase):
+ @no_debug_info_test
+ @skipIfXmlSupportMissing
def test_get_target_byte_size(self):
d = {'EXE': 'b.out'}
self.build(dictionary=d)
@@ -38,6 +40,8 @@ class SectionAPITestCase(TestBase):
self.assertIsNotNone(data_section)
self.assertEqual(data_section.target_byte_size, 1)
+ @no_debug_info_test
+ @skipIfXmlSupportMissing
def test_get_alignment(self):
exe = self.getBuildArtifact("aligned.out")
self.yaml2obj("aligned.yaml", exe)
@@ -48,3 +52,20 @@ class SectionAPITestCase(TestBase):
section = target.modules[0].sections[0]
self.assertEqual(section.GetAlignment(), 0x1000)
self.assertEqual(section.alignment, 0x1000)
+
+ @no_debug_info_test
+ @skipIfXmlSupportMissing
+ def test_compressed_section_data(self):
+ exe = self.getBuildArtifact("compressed-sections.out")
+ self.yaml2obj("compressed-sections.yaml", exe)
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ # exe contains a single section with SHF_COMPRESSED. Check that
+ # GetSectionData returns the uncompressed data and not the raw contents
+ # of the section.
+ section = target.modules[0].sections[0]
+ section_data = section.GetSectionData().uint8s
+ self.assertEqual(section_data,
+ [0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90])
+
diff --git a/lldb/test/API/python_api/section/compressed-sections.yaml b/lldb/test/API/python_api/section/compressed-sections.yaml
new file mode 100644
index 0000000..a41307e
--- /dev/null
+++ b/lldb/test/API/python_api/section/compressed-sections.yaml
@@ -0,0 +1,11 @@
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_386
+Sections:
+ - Name: .compressed
+ Type: SHT_PROGBITS
+ Flags: [ SHF_COMPRESSED ]
+ Content: 010000000800000001000000789c5330700848286898000009c802c1