joshwatson / binaryninja-msp430

msp430 Architecture plugin for Binary Ninja
MIT License
32 stars 6 forks source link

msp430 doesn't show up in the Architecture list #15

Open atlas0fd00m opened 1 year ago

atlas0fd00m commented 1 year ago

am i doing something wrong?

i opened a binary memory dump file, and attempted to choose the MSP430 architecture from the drop-down box when prompted. it's not there.

i'm on 3.0.3234-dev.

sjossi commented 1 year ago

If you have Python errors regarding the OR-ing of types, it's an issue with the plugin written against a Python 3.10 feature. @joshwatson do you think it makes sense to support older versions (I'm still on 3.9 myself) by switching to using Unions, or rather suggest people upgrade to a more reasonable Python version?

That was my fix:

diff --git a/lifter.py b/lifter.py
index 56b4aa0..0598abf 100644
--- a/lifter.py
+++ b/lifter.py
@@ -1,4 +1,4 @@
-from typing import Callable, List
+from typing import Callable, List, Union
 from binaryninja import (
     LLIL_TEMP,
     Architecture,
@@ -15,7 +15,7 @@ from .instructions import IMMEDIATE_MODE, INDIRECT_AUTOINCREMENT_MODE, REGISTER_

 SourceOperandsIL: List[
     Callable[
-        [LowLevelILFunction, int | None, RegisterType | None, int | None],
+        [LowLevelILFunction, Union[int, None], Union[RegisterType, None], Union[int, None]],
         ExpressionIndex,
     ]
 ] = [