gdbghidra icon indicating copy to clipboard operation
gdbghidra copied to clipboard

remote target causes python exceptions

Open osresearch opened this issue 5 years ago • 0 comments

In order to work with a remote target (such as a device with openocd), it was necessary to stub out the relocation and mappings methods. Otherwise python would throw an exception that "Can't determine the current process's PID: you must name one". As a quick hack I patched around it, but perhaps there is a better way:

diff --git a/data/gdb_ghidra_bridge_client.py b/data/gdb_ghidra_bridge_client.py
index f2bb7a9..e9a0f5f 100755
--- a/data/gdb_ghidra_bridge_client.py
+++ b/data/gdb_ghidra_bridge_client.py
@@ -297,6 +297,8 @@ class GhidraBridgeCommand(gdb.Command):
 class GDBUtils:
     @staticmethod
     def get_relocation():
+        if True:
+            return "0x0"
         r = GDBUtils.query_gdb('info proc stat', 'relocation', 'Start of text: ', 'End of text: ')
         if r == "unknown":
             return "0x0"
@@ -356,6 +358,8 @@ class GDBUtils:
 
     @staticmethod
     def get_mapping(named):
+        if True:
+            return None
         m = GDBUtils.query_gdb("info proc mappings", "mappings")
         if "unable to open" in m:
             return None

osresearch avatar Oct 06 '19 14:10 osresearch