From 0b1c125c171d9213ac104044a614d72b704358e7 Mon Sep 17 00:00:00 2001 From: Yahya Lmallas Date: Mon, 7 Dec 2015 05:29:18 +0100 Subject: [PATCH 1/2] Add Linux Support Support linux platform and double check from sys and platform imports. --- Show Instruction Reference.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Show Instruction Reference.py b/Show Instruction Reference.py index 0d31206..ebeca9a 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 @@ -44,7 +47,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() From 1f7cf0d77f33eea083185cd1a19dbaaf57025187 Mon Sep 17 00:00:00 2001 From: Yahya Lmallas Date: Mon, 7 Dec 2015 07:33:16 +0100 Subject: [PATCH 2/2] FIXE : ARM64 not working This fix is just a workaround for issue #2 @ https://github.com/zbuc/hopperref --- Show Instruction Reference.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Show Instruction Reference.py b/Show Instruction Reference.py index ebeca9a..56c60f6 100644 --- a/Show Instruction Reference.py +++ b/Show Instruction Reference.py @@ -17,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()) @@ -78,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