diff --git a/Show Instruction Reference.py b/Show Instruction Reference.py index 0d31206..56c60f6 100644 --- a/Show Instruction Reference.py +++ b/Show Instruction Reference.py @@ -1,5 +1,8 @@ import sqlite3 as sq import os +import platform +import sys +from sys import platform as _platform import inspect import glob @@ -14,13 +17,15 @@ instr = seg.getInstructionAtAddress(adr) # not sure why but stringForArchitecture returns for arm/v7 (id 4) -if instr.getArchitecture() == 4: +# seg.isThumbAtAddress() ?doc.is64Bits() ? +if instr.getArchitecture() == 4: # 32-bit processor arch = "arm/v7" -elif instr.getArchitecture() == 5: +elif instr.getArchitecture() == 5: # 64-bit processor arch = "arm/v8" else: - arch = instr.stringForArchitecture(instr.getArchitecture()) + arch = instr.stringForArchitecture(instr.getArchitecture()) # Auto-Detect processor +doc.log("ArchID: %s" % instr.getArchitecture()) doc.log("Architecture: %s" % arch) doc.log("instruction: " + instr.getInstructionString()) doc.log("instruction length: %d" % instr.getInstructionLength()) @@ -44,7 +49,11 @@ def __init__(self, mnem, arch): self.title = "Instruction Reference" self.destroying = False - self.base_path = os.path.abspath(os.path.expanduser("~/Library/Application Support/Hopper/Scripts")) + posix_os = platform.system() + if posix_os == "Linux" or _platform == "linux" or _platform == "linux2": + self.base_path = os.path.abspath(os.path.expanduser("~/GNUstep/Library/ApplicationSupport/Hopper/Scripts")) + if posix_os == "Darwin" or _platform == "darwin": + self.base_path = os.path.abspath(os.path.expanduser("~/Library/Application Support/Hopper/Scripts")) self.archs = self.findManuals() @@ -71,7 +80,7 @@ def loadArchitecture(self, name): name = name.lower() if name == "x86_64" or name == "x86" or name == "i386": name = "x86-64" - elif name.startswith("arm"): + elif name.startswith("arm") or name == "aarch64": name = "arm" self.arch = name