From e976f7bb6b2bff83d3dbb25708a9a86e81be06fd Mon Sep 17 00:00:00 2001 From: Seva Alekseyev Date: Tue, 14 Nov 2023 14:09:04 -0500 Subject: [PATCH] Monkey --- dwex/patch.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dwex/patch.py b/dwex/patch.py index 6c08c17..453a878 100644 --- a/dwex/patch.py +++ b/dwex/patch.py @@ -1,4 +1,5 @@ import os + import elftools.dwarf.enums import elftools.dwarf.dwarf_expr import elftools.dwarf.locationlists @@ -6,7 +7,10 @@ from elftools.common.utils import struct_parse from elftools.common.exceptions import DWARFError from elftools.dwarf.descriptions import _DESCR_DW_CC +from elftools.dwarf.dwarfinfo import DebugSectionDescriptor +from elftools.elf.relocation import RelocationHandler from types import MethodType +from io import BytesIO def monkeypatch(): #https://docs.hdoc.io/hdoc/llvm-project/e051F173385B23DEF.html @@ -94,11 +98,6 @@ def translate_v5_entry(self, entry, cu): # Monkeypatch for bogus XC16 binaries (see pyelftools' #518) def _read_dwarf_section(self, section, relocate_dwarf_sections): - from io import BytesIO - from elftools.elf.relocation import RelocationHandler - from elftools.dwarf.dwarfinfo import DebugSectionDescriptor - from elftools.common.exceptions import DWARFError - # Patch for the XC16 compiler; see pyelftools' #518 # Vendor flag EF_PIC30_NO_PHANTOM_BYTE: clear means drop every odd byte has_phantom_bytes = self['e_machine'] == 'EM_DSPIC30F' and (self['e_flags'] & 0x80000000) == 0