diff --git a/src/copapy/__init__.py b/src/copapy/__init__.py index c8031d3..d8712be 100644 --- a/src/copapy/__init__.py +++ b/src/copapy/__init__.py @@ -460,21 +460,19 @@ class Target(): if var_type == 'float': if lengths == 4: value = struct.unpack(en + 'f', data)[0] - assert isinstance(value, float) - return value elif lengths == 8: value = struct.unpack(en + 'd', data)[0] - assert isinstance(value, float) - return value else: - raise ValueError(f"Unsupported float length: {lengths}") + raise ValueError(f"Unsupported float length: {lengths} bytes") + assert isinstance(value, float) + return value elif var_type == 'int': if lengths in (1, 2, 4, 8): value = int.from_bytes(data, byteorder=self.sdb.byteorder, signed=True) assert isinstance(value, int) return value else: - raise ValueError(f"Unsupported int length: {lengths}") + raise ValueError(f"Unsupported int length: {lengths} bytes") else: raise ValueError(f"Unsupported variable type: {var_type}") diff --git a/src/copapy/stencil_db.py b/src/copapy/stencil_db.py index 58305c5..34a7965 100644 --- a/src/copapy/stencil_db.py +++ b/src/copapy/stencil_db.py @@ -34,7 +34,11 @@ def translate_relocation(relocation_addr: int, reloc_type: str, bits: int, r_add patch_offset = relocation_addr return patch_entry(RelocationType.RELOC_RELATIVE_32, patch_offset, r_addend) else: - raise Exception(f"Unknown: {reloc_type}") + print('relocation_addr: ', relocation_addr) + print('reloc_type: ', reloc_type) + print('bits: ', bits) + print('r_addend: ', r_addend) + raise Exception(f"Unknown relocation type: {reloc_type}") def get_ret_function_def(symbol: pelfy.elf_symbol) -> str: