summaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api/section/TestSectionAPI.py
diff options
context:
space:
mode:
authorJorge Gorbe Moya <jgorbe@google.com>2023-01-26 14:23:41 -0800
committerJorge Gorbe Moya <jgorbe@google.com>2023-01-27 10:15:35 -0800
commit805600c7d573cf88cf035d01a2ea9389fc24d435 (patch)
treec7725799d5dc8626320ac33e6816ddd0b5ca3bc6 /lldb/test/API/python_api/section/TestSectionAPI.py
parent41e776386dd5930565b338b776816c48245f52f3 (diff)
[lldb] Make SBSection::GetSectionData call Section::GetSectionData.
`SBSection::GetSectionData` and `Section::GetSectionData` are implemented differently, and the `SBSection` method doesn't handle compressed sections correctly. Differential Revision: https://reviews.llvm.org/D142672
Diffstat (limited to 'lldb/test/API/python_api/section/TestSectionAPI.py')
-rw-r--r--lldb/test/API/python_api/section/TestSectionAPI.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/lldb/test/API/python_api/section/TestSectionAPI.py b/lldb/test/API/python_api/section/TestSectionAPI.py
index ab9ae56238c8..b01ddece0de3 100644
--- a/lldb/test/API/python_api/section/TestSectionAPI.py
+++ b/lldb/test/API/python_api/section/TestSectionAPI.py
@@ -48,3 +48,18 @@ class SectionAPITestCase(TestBase):
section = target.modules[0].sections[0]
self.assertEqual(section.GetAlignment(), 0x1000)
self.assertEqual(section.alignment, 0x1000)
+
+ 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])
+