[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
This commit is contained in:
@@ -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])
|
||||
|
||||
|
||||
11
lldb/test/API/python_api/section/compressed-sections.yaml
Normal file
11
lldb/test/API/python_api/section/compressed-sections.yaml
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user