mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-24 00:31:16 +00:00
run black
This commit is contained in:
parent
8678ad72c4
commit
46dbe1a608
@ -109,11 +109,9 @@ def add_python_path(path: str):
|
|||||||
sys.path.insert(1, str(venv_path))
|
sys.path.insert(1, str(venv_path))
|
||||||
|
|
||||||
|
|
||||||
|
# We need to quote the types here because they might not exist when running without Ghidra
|
||||||
def migrate_function_to_ghidra(
|
def migrate_function_to_ghidra(
|
||||||
api: "FlatProgramAPI",
|
api: "FlatProgramAPI", match_info: "MatchInfo", signature: "FunctionSignature"
|
||||||
match_info: "MatchInfo",
|
|
||||||
signature: "FunctionSignature"
|
|
||||||
):
|
):
|
||||||
hex_original_address = f"{match_info.orig_addr:x}"
|
hex_original_address = f"{match_info.orig_addr:x}"
|
||||||
|
|
||||||
@ -157,7 +155,11 @@ def migrate_function_to_ghidra(
|
|||||||
logger.critical("User quit, terminating")
|
logger.critical("User quit, terminating")
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|
||||||
logger.debug("Modifying function %s at 0x%s", typed_pdb_function.get_full_name(), hex_original_address)
|
logger.debug(
|
||||||
|
"Modifying function %s at 0x%s",
|
||||||
|
typed_pdb_function.get_full_name(),
|
||||||
|
hex_original_address,
|
||||||
|
)
|
||||||
|
|
||||||
typed_pdb_function.overwrite_ghidra_function(ghidra_function)
|
typed_pdb_function.overwrite_ghidra_function(ghidra_function)
|
||||||
|
|
||||||
@ -243,15 +245,19 @@ def main():
|
|||||||
add_python_path("tools/isledecomp")
|
add_python_path("tools/isledecomp")
|
||||||
|
|
||||||
import setuptools # pylint: disable=unused-import # required to fix a distutils issue in Python 3.12
|
import setuptools # pylint: disable=unused-import # required to fix a distutils issue in Python 3.12
|
||||||
|
|
||||||
reload_module("isledecomp")
|
reload_module("isledecomp")
|
||||||
from isledecomp import Bin
|
from isledecomp import Bin
|
||||||
|
|
||||||
reload_module("isledecomp.compare")
|
reload_module("isledecomp.compare")
|
||||||
from isledecomp.compare import Compare as IsleCompare
|
from isledecomp.compare import Compare as IsleCompare
|
||||||
|
|
||||||
reload_module("isledecomp.compare.db")
|
reload_module("isledecomp.compare.db")
|
||||||
from isledecomp.compare.db import MatchInfo
|
from isledecomp.compare.db import MatchInfo
|
||||||
|
|
||||||
reload_module("lego_util.exceptions")
|
reload_module("lego_util.exceptions")
|
||||||
from lego_util.exceptions import Lego1Exception
|
from lego_util.exceptions import Lego1Exception
|
||||||
|
|
||||||
reload_module("lego_util.pdb_extraction")
|
reload_module("lego_util.pdb_extraction")
|
||||||
from lego_util.pdb_extraction import (
|
from lego_util.pdb_extraction import (
|
||||||
PdbExtractionForGhidraMigration,
|
PdbExtractionForGhidraMigration,
|
||||||
@ -262,7 +268,6 @@ def main():
|
|||||||
reload_module("lego_util.pdb_to_ghidra")
|
reload_module("lego_util.pdb_to_ghidra")
|
||||||
from lego_util.pdb_to_ghidra import PdbFunctionWithGhidraObjects
|
from lego_util.pdb_to_ghidra import PdbFunctionWithGhidraObjects
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
@ -54,7 +54,9 @@ def add_pointer_type(api: FlatProgramAPI, pointee: DataType):
|
|||||||
return data_type
|
return data_type
|
||||||
|
|
||||||
|
|
||||||
def get_ghidra_namespace(api: FlatProgramAPI, namespace_hierachy: list[str]) -> Namespace:
|
def get_ghidra_namespace(
|
||||||
|
api: FlatProgramAPI, namespace_hierachy: list[str]
|
||||||
|
) -> Namespace:
|
||||||
namespace = api.getCurrentProgram().getGlobalNamespace()
|
namespace = api.getCurrentProgram().getGlobalNamespace()
|
||||||
for part in namespace_hierachy:
|
for part in namespace_hierachy:
|
||||||
namespace = api.getNamespace(namespace, part)
|
namespace = api.getNamespace(namespace, part)
|
||||||
|
|||||||
@ -25,7 +25,6 @@
|
|||||||
from lego_util.exceptions import StackOffsetMismatchError
|
from lego_util.exceptions import StackOffsetMismatchError
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -220,7 +219,9 @@ def get_matching_stack_symbol(self, stack_offset: int) -> Optional[CppStackSymbo
|
|||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_matching_register_symbol(self, register: str) -> Optional[CppRegisterSymbol]:
|
def get_matching_register_symbol(
|
||||||
|
self, register: str
|
||||||
|
) -> Optional[CppRegisterSymbol]:
|
||||||
return next(
|
return next(
|
||||||
(
|
(
|
||||||
symbol
|
symbol
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
"""Types shared by other modules"""
|
"""Types shared by other modules"""
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user