GP-4441: new option for target remote

GP-4441: post-review edits
GP-4441: first pass
GP-4441: working remote gdb/lldbGP-4441: updated via 4437GP-4441: embedded updatesGP-4441: set arch conditionally
This commit is contained in:
d-millar
2024-03-20 15:24:04 -04:00
parent f034eca003
commit 918d38c468
10 changed files with 204 additions and 30 deletions

View File

@@ -1,4 +1,4 @@
#!/usr/bin/bash
#!/usr/bin/env bash
## ###
# IP: GHIDRA
#
@@ -30,9 +30,11 @@
#@menu-group remote
#@icon icon.debugger
#@help TraceRmiLauncherServicePlugin#gdb
#@arg :str "Image" "The target binary executable image on the remote system"
#@enum TargetType:str remote extended-remote
#@env OPT_TARGET_TYPE:TargetType="remote" "Target" "The type of remote target"
#@env OPT_HOST:str="localhost" "Host" "The hostname of the target"
#@env OPT_PORT:str="9999" "Port" "The host's listening port"
#@env OPT_ARCH:str="" "Architecture (optional)" "Target architecture override"
#@env OPT_GDB_PATH:str="gdb" "Path to gdb" "The path to gdb on the local system. Omit the full path to resolve using the system PATH."
if [ -d ${GHIDRA_HOME}/ghidra/.git ]
@@ -48,13 +50,21 @@ else
export PYTHONPATH=$GHIDRA_HOME/Ghidra/Debug/Debugger-rmi-trace/pypkg/src:$PYTHONPATH
fi
if [ -z "$OPT_ARCH" ]
then
archcmd=
else
archcmd=-ex "set arch $OPT_ARCH"
fi
"$OPT_GDB_PATH" \
-q \
-ex "set pagination off" \
-ex "set confirm off" \
-ex "show version" \
-ex "python import ghidragdb" \
-ex "target remote $OPT_HOST:$OPT_PORT" \
$archcmd \
-ex "target $OPT_TARGET_TYPE $OPT_HOST:$OPT_PORT" \
-ex "ghidra trace connect \"$GHIDRA_TRACE_RMI_ADDR\"" \
-ex "ghidra trace start" \
-ex "ghidra trace sync-enable" \