mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-22 23:57:54 -05:00
f26c30974a
* Add draft for Ghidra function import script * feature: Basic PDB analysis [skip ci] This is a draft with a lot of open questions left. Please do not merge * Refactor: Introduce submodules and reload remedy * refactor types and make them Python 3.9 compatible * run black * WIP: save progress * fix types and small type safety violations * fix another Python 3.9 syntax incompatibility * Implement struct imports [skip ci] - This code is still in dire need of refactoring and tests - There are only single-digit issues left, and 2600 functions can be imported - The biggest remaining error is mismatched stacks * Refactor, implement enums, fix lots of bugs * fix Python 3.9 issue * refactor: address review comments Not sure why VS Code suddenly decides to remove some empty spaces, but they don't make sense anyway * add unit tests for new type parsers, fix linter issue * refactor: db access from pdb_extraction.py * Fix stack layout offset error * fix: Undo incorrect reference change * Fix CI issue * Improve READMEs (fix typos, add information) --------- Co-authored-by: jonschz <jonschz@users.noreply.github.com>
47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
class Lego1Exception(Exception):
|
|
"""
|
|
Our own base class for exceptions.
|
|
Makes it easier to distinguish expected and unexpected errors.
|
|
"""
|
|
|
|
|
|
class TypeNotFoundError(Lego1Exception):
|
|
def __str__(self):
|
|
return f"Type not found in PDB: {self.args[0]}"
|
|
|
|
|
|
class TypeNotFoundInGhidraError(Lego1Exception):
|
|
def __str__(self):
|
|
return f"Type not found in Ghidra: {self.args[0]}"
|
|
|
|
|
|
class TypeNotImplementedError(Lego1Exception):
|
|
def __str__(self):
|
|
return f"Import not implemented for type: {self.args[0]}"
|
|
|
|
|
|
class ClassOrNamespaceNotFoundInGhidraError(Lego1Exception):
|
|
def __init__(self, namespaceHierachy: list[str]):
|
|
super().__init__(namespaceHierachy)
|
|
|
|
def get_namespace_str(self) -> str:
|
|
return "::".join(self.args[0])
|
|
|
|
def __str__(self):
|
|
return f"Class or namespace not found in Ghidra: {self.get_namespace_str()}"
|
|
|
|
|
|
class MultipleTypesFoundInGhidraError(Lego1Exception):
|
|
def __str__(self):
|
|
return (
|
|
f"Found multiple types matching '{self.args[0]}' in Ghidra: {self.args[1]}"
|
|
)
|
|
|
|
|
|
class StackOffsetMismatchError(Lego1Exception):
|
|
pass
|
|
|
|
|
|
class StructModificationError(Lego1Exception):
|
|
def __str__(self):
|
|
return f"Failed to modify struct in Ghidra: '{self.args[0]}'\nDetailed error: {self.__cause__}"
|