File: test_dwarf_range_lists.py

package info (click to toggle)
python-pyelftools 0.32-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 68,964 kB
  • sloc: python: 15,903; ansic: 298; asm: 86; makefile: 24; cpp: 18; sh: 4
file content (32 lines) | stat: -rw-r--r-- 1,222 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#-------------------------------------------------------------------------------
# elftools tests
#
# Eli Bendersky (eliben@gmail.com), Santhosh Kumar Mani (santhoshmani@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import os
import unittest

from elftools.elf.elffile import ELFFile


class TestRangeLists(unittest.TestCase):
    # Test the absence of .debug_ranges section
    def test_range_list_absence(self):
        with open(os.path.join('test', 'testfiles_for_unittests',
                               'arm_with_form_indirect.elf'), 'rb') as f:
            elffile = ELFFile(f)
            self.assertTrue(elffile.has_dwarf_info())
            self.assertIsNone(elffile.get_dwarf_info().range_lists())

    # Test the presence of .debug_ranges section
    def test_range_list_presence(self):
        with open(os.path.join('test', 'testfiles_for_unittests',
                               'sample_exe64.elf'), 'rb') as f:
            elffile = ELFFile(f)
            self.assertTrue(elffile.has_dwarf_info())
            self.assertIsNotNone(elffile.get_dwarf_info().range_lists())


if __name__ == '__main__':
    unittest.main()