1 #------------------------------------------------------------------------------
4 # Seva Alekseyev (sevaa@sprynet.com)
5 # This code is in the public domain
6 #------------------------------------------------------------------------------
11 sys
.path
.insert(1, os
.getcwd())
13 from elftools
.elf
.elffile
import ELFFile
14 from elftools
.dwarf
.dwarfinfo
import DWARFInfo
, DebugSectionDescriptor
, DwarfConfig
15 from elftools
.dwarf
.locationlists
import LocationParser
17 class TestConstWithData4IsntLocation(unittest
.TestCase
):
18 def _test_file(self
, filename
):
19 filepath
= os
.path
.join('test', 'testfiles_for_unittests', filename
)
20 with
open(filepath
, 'rb') as f
:
22 dwarfinfo
= elffile
.get_dwarf_info()
23 locparser
= LocationParser(dwarfinfo
.location_lists())
24 for CU
in dwarfinfo
.iter_CUs():
26 for DIE
in CU
.iter_DIEs():
27 for key
in DIE
.attributes
:
28 attr
= DIE
.attributes
[key
]
29 if LocationParser
.attribute_has_location(attr
, ver
):
30 # This will crash on unpatched library on DIE at 0x9f
31 locparser
.parse_from_attribute(attr
, ver
)
34 self
._test
_file
('pascalenum.o')
36 if __name__
== '__main__':