-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for XC16/PIC phantom bytes (#522)
* Support for XC16/PIC phantom bytes * Typo
- Loading branch information
Showing
3 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#------------------------------------------------------------------------------ | ||
# elftools tests | ||
# | ||
# Seva Alekseyev ([email protected]) | ||
# This code is in the public domain | ||
#------------------------------------------------------------------------------ | ||
|
||
import unittest | ||
import os, sys, io | ||
|
||
from elftools.elf.elffile import ELFFile | ||
|
||
class TestPhantomBytes(unittest.TestCase): | ||
# Prior to 11/17/2023, trying to get DWARF from binaries built by | ||
# the XC16 compiler for PIC microcontrollers would crash | ||
def _test_file(self, filename): | ||
filepath = os.path.join('test', 'testfiles_for_unittests', filename) | ||
with open(filepath, 'rb') as f: | ||
elffile = ELFFile(f) | ||
self.assertTrue(elffile.has_phantom_bytes()) | ||
dwarfinfo = elffile.get_dwarf_info() | ||
for CU in dwarfinfo.iter_CUs(): | ||
self.assertEqual(CU.get_top_DIE().tag, 'DW_TAG_compile_unit') | ||
|
||
def test_main(self): | ||
self._test_file('dwarf_phantombytes.elf') |
Binary file not shown.