Ghidra is a software reverse engineering (SRE) framework
GP-4957: Add debugger launchers for gdb on Windows. ssh scripts take ssh path option.
Dan8b899fe98663
diff --git a/Ghidra/Debug/Debugger-agent-gdb/certification.manifest b/Ghidra/Debug/Debugger-agent-gdb/certification.manifestindex 9f3dcaae7a..a5d9bacee4 100644--- a/Ghidra/Debug/Debugger-agent-gdb/certification.manifest+++ b/Ghidra/Debug/Debugger-agent-gdb/certification.manifest@@ -2,6 +2,11 @@##MODULE IP: JSch LicenseModule.manifest||GHIDRA||||END|data/debugger-launchers/local-gdb.bat||GHIDRA||||END|+data/debugger-launchers/qemu-gdb.bat||GHIDRA||||END|+data/debugger-launchers/raw-gdb.bat||GHIDRA||||END|+data/debugger-launchers/remote-gdb.bat||GHIDRA||||END|+data/debugger-launchers/ssh-gdb.bat||GHIDRA||||END|+data/debugger-launchers/ssh-gdbserver.bat||GHIDRA||||END|data/scripts/fallback_info_proc_mappings.gdb||GHIDRA||||END|data/scripts/fallback_maintenance_info_sections.gdb||GHIDRA||||END|data/scripts/getpid-linux-i386.gdb||GHIDRA||||END|diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-gdb.bat b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-gdb.batindex 4ff30ef732..93a6104676 100644--- a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-gdb.bat+++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-gdb.bat@@ -10,12 +10,10 @@::@icon icon.debugger::@help TraceRmiLauncherServicePlugin#gdb::@enum StartCmd:str run start starti-::@arg :file "Image" "The target binary executable image"-::@args "Arguments" "Command-line arguments to pass to the target"+::@env OPT_TARGET_IMG:file="" "Image" "The target binary executable image"+::@env OPT_TARGET_ARGS:str="" "Arguments" "Command-line arguments to pass to the target"::@env OPT_GDB_PATH:file="gdb" "gdb command" "The path to gdb. Omit the full path to resolve using the system PATH."::@env OPT_START_CMD:StartCmd="starti" "Run command" "The gdb command to actually run the target."-::@env OPT_EXTRA_TTY:bool=false "Inferior TTY" "Provide a separate terminal emulator for the target."-::@tty TTY_TARGET if env:OPT_EXTRA_TTY@echo offset PYTHONPATH0=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-gdb\pypkg\src@@ -30,24 +28,18 @@ IF EXIST %GHIDRA_HOME%\ghidra\.git ()set PYTHONPATH=%PYTHONPATH1%;%PYTHONPATH0%;%PYTHONPATH%-set target_image=%1-shift-set target_args=%*-"%OPT_GDB_PATH%" ^-q ^-ex "set pagination off" ^-ex "set confirm off" ^-ex "show version" ^-ex "python import ghidragdb" ^- -ex "target exec %target_image%" ^- -ex "set args %target_args%" ^+ -ex "target exec %OPT_TARGET_IMG%" ^+ -ex "set args %OPT_TARGET_ARGS%" ^-ex "set inferior-tty %TTY_TARGET%" ^-ex "ghidra trace connect '%GHIDRA_TRACE_RMI_ADDR%'" ^-ex "ghidra trace start" ^-ex "ghidra trace sync-enable" ^-ex "%OPT_START_CMD%" ^-ex "set confirm on" ^- -ex "set pagination on" ^--\ No newline at end of file+ -ex "set pagination on"diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-gdb.bat b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-gdb.batnew file mode 100644index 0000000000..5f4b132042--- /dev/null+++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-gdb.bat@@ -0,0 +1,56 @@+::@title qemu + gdb+::@desc <html><body width="300px">+::@desc <h3>Launch with <tt>qemu</tt> and connect with <tt>gdb</tt></h3>+::@desc <p>+::@desc This will launch the target on the local machine using <tt>qemu</tt>.+::@desc Then in a second terminal, it will connect <tt>gdb</tt> to QEMU's GDBstub.+::@desc For setup instructions, press <b>F1</b>.+::@desc </p>+::@desc </body></html>+::@menu-group cross+::@icon icon.debugger+::@help TraceRmiLauncherServicePlugin#gdb_qemu+::@env OPT_TARGET_IMG:file="" "Image" "The target binary executable image"+::@env OPT_TARGET_ARGS:str="" "Arguments" "Command-line arguments to pass to the target"+::@env GHIDRA_LANG_EXTTOOL_qemu:file="" "QEMU command" "The path to qemu for the target architecture."+::@env QEMU_GDB:int=1234 "QEMU Port" "Port for gdb connection to qemu"+::@env OPT_EXTRA_QEMU_ARGS:str="" "Extra qemu arguments" "Extra arguments to pass to qemu. Use with care."+::@env OPT_GDB_PATH:file="gdb-multiarch" "gdb command" "The path to gdb. Omit the full path to resolve using the system PATH."+::@env OPT_EXTRA_TTY:bool=false "QEMU TTY" "Provide a separate terminal emulator for the target."++@echo off+set PYTHONPATH0=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-gdb\pypkg\src+set PYTHONPATH1=%GHIDRA_HOME%\Ghidra\Debug\Debugger-rmi-trace\pypkg\src+IF EXIST %GHIDRA_HOME%\.git (+ set PYTHONPATH0=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-gdb\build\pypkg\src+ set PYTHONPATH1=%GHIDRA_HOME%\Ghidra\Debug\Debugger-rmi-trace\build\pypkg\src+)+IF EXIST %GHIDRA_HOME%\ghidra\.git (+ set PYTHONPATH0=%GHIDRA_HOME%\ghidra\Ghidra\Debug\Debugger-agent-gdb\build\pypkg\src+ set PYTHONPATH1=%GHIDRA_HOME%\ghidra\Ghidra\Debug\Debugger-rmi-trace\build\pypkg\src+)+set PYTHONPATH=%PYTHONPATH1%;%PYTHONPATH0%;%PYTHONPATH%++IF "%OPT_EXTRA_TTY%"=="true" (+ start "qemu" "%GHIDRA_LANG_EXTTOOL_qemu%" %OPT_EXTRA_QEMU_ARGS% -gdb tcp::%QEMU_GDB% -S "%OPT_TARGET_IMG%" %OPT_TARGET_ARGS%+) ELSE (+ start /B "qemu" "%GHIDRA_LANG_EXTTOOL_qemu%" %OPT_EXTRA_QEMU_ARGS% -gdb tcp::%QEMU_GDB% -S "%OPT_TARGET_IMG%" %OPT_TARGET_ARGS%+)++:: Give QEMU a moment to open the socket+powershell -nop -c "& {sleep -m 100}"++"%OPT_GDB_PATH%" ^+ -q ^+ -ex "set pagination off" ^+ -ex "set confirm off" ^+ -ex "show version" ^+ -ex "python import ghidragdb" ^+ -ex "target exec '%OPT_TARGET_IMG%'" ^+ -ex "set args %OPT_TARGET_ARGS%" ^+ -ex "ghidra trace connect '%GHIDRA_TRACE_RMI_ADDR%'" ^+ -ex "ghidra trace start" ^+ -ex "ghidra trace sync-enable" ^+ -ex "target remote localhost:%QEMU_GDB%" ^+ -ex "set confirm on" ^+ -ex "set pagination on"diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-gdb.sh b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-gdb.shindex f60c051f8b..917211b024 100755--- a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-gdb.sh+++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-gdb.sh@@ -1,18 +1,18 @@#!/usr/bin/bash## ###-# IP: GHIDRA-#-# Licensed under the Apache License, Version 2.0 (the "License");-# you may not use this file except in compliance with the License.-# You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.+# IP: GHIDRA+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.###@title qemu + gdb#@desc <html><body width="300px">@@ -29,7 +29,7 @@#@arg :file "Image" "The target binary executable image"#@args "Arguments" "Command-line arguments to pass to the target"#@env GHIDRA_LANG_EXTTOOL_qemu:file="" "QEMU command" "The path to qemu for the target architecture."-#@env QEMU_GDB:int=12345 "QEMU Port" "Port for gdb connection to qemu"+#@env QEMU_GDB:int=1234 "QEMU Port" "Port for gdb connection to qemu"#@env OPT_EXTRA_QEMU_ARGS:str="" "Extra qemu arguments" "Extra arguments to pass to qemu. Use with care."#@env OPT_GDB_PATH:file="gdb-multiarch" "gdb command" "The path to gdb. Omit the full path to resolve using the system PATH."#@env OPT_EXTRA_TTY:bool=false "QEMU TTY" "Provide a separate terminal emulator for the target."@@ -52,9 +52,9 @@ target_image="$1"if [ -z "$TTY_TARGET" ]then- "$GHIDRA_LANG_EXTTOOL_qemu" $OPT_EXTRA_QEMU_ARGS $@ &+ "$GHIDRA_LANG_EXTTOOL_qemu" -gdb tcp::$QEMU_GDB -S $OPT_EXTRA_QEMU_ARGS $@ &else- "$GHIDRA_LANG_EXTTOOL_qemu" $OPT_EXTRA_QEMU_ARGS $@ <$TTY_TARGET >$TTY_TARGET 2>&1 &+ "$GHIDRA_LANG_EXTTOOL_qemu" -gdb tcp::$QEMU_GDB -S $OPT_EXTRA_QEMU_ARGS $@ <$TTY_TARGET >$TTY_TARGET 2>&1 &fi# Give QEMU a moment to open the socket@@ -68,7 +68,6 @@ sleep 0.1-ex "python import ghidragdb" \-ex "file \"$target_image\"" \-ex "set args $target_args" \- -ex "set inferior-tty $TTY_TARGET" \-ex "ghidra trace connect \"$GHIDRA_TRACE_RMI_ADDR\"" \-ex "ghidra trace start" \-ex "ghidra trace sync-enable" \diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/raw-gdb.bat b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/raw-gdb.batnew file mode 100644index 0000000000..e64f0e96b3--- /dev/null+++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/raw-gdb.bat@@ -0,0 +1,41 @@+::@title raw gdb+::@no-image+::@desc <html><body width="300px">+::@desc <h3>Start <tt>gdb</tt></h3>+::@desc <p>+::@desc This will start <tt>gdb</tt> and connect to it.+::@desc It will not launch a target, so you can (must) set up your target manually.+::@desc For setup instructions, press <b>F1</b>.+::@desc </p>+::@desc </body></html>+::@menu-group raw+::@icon icon.debugger+::@help TraceRmiLauncherServicePlugin#gdb_raw+::@env OPT_GDB_PATH:file="gdb" "gdb command" "The path to gdb. Omit the full path to resolve using the system PATH."+::@env OPT_ARCH:str="i386:x86-64" "Architecture" "Target architecture"++@echo off+set PYTHONPATH0=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-gdb\pypkg\src+set PYTHONPATH1=%GHIDRA_HOME%\Ghidra\Debug\Debugger-rmi-trace\pypkg\src+IF EXIST %GHIDRA_HOME%\.git (+ set PYTHONPATH0=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-gdb\build\pypkg\src+ set PYTHONPATH1=%GHIDRA_HOME%\Ghidra\Debug\Debugger-rmi-trace\build\pypkg\src+)+IF EXIST %GHIDRA_HOME%\ghidra\.git (+ set PYTHONPATH0=%GHIDRA_HOME%\ghidra\Ghidra\Debug\Debugger-agent-gdb\build\pypkg\src+ set PYTHONPATH1=%GHIDRA_HOME%\ghidra\Ghidra\Debug\Debugger-rmi-trace\build\pypkg\src+)+set PYTHONPATH=%PYTHONPATH1%;%PYTHONPATH0%;%PYTHONPATH%++"%OPT_GDB_PATH%" ^+ -q ^+ -ex "set pagination off" ^+ -ex "set confirm off" ^+ -ex "show version" ^+ -ex "python import ghidragdb" ^+ -ex "set architecture %OPT_ARCH%" ^+ -ex "ghidra trace connect '%GHIDRA_TRACE_RMI_ADDR%'" ^+ -ex "ghidra trace start" ^+ -ex "ghidra trace sync-enable" ^+ -ex "set confirm on" ^+ -ex "set pagination on"diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/remote-gdb.bat b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/remote-gdb.batnew file mode 100644index 0000000000..faf1f7310a--- /dev/null+++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/remote-gdb.bat@@ -0,0 +1,53 @@+::@title remote gdb+::@no-image+::@desc <html><body width="300px">+::@desc <h3>Launch with local <tt>gdb</tt> and connect to a stub (e.g., <tt>gdbserver</tt>)</h3>+::@desc <p>+::@desc This will start <tt>gdb</tt> on the local system and then use it to connect to the remote system.+::@desc For setup instructions, press <b>F1</b>.+::@desc </p>+::@desc </body></html>+::@menu-group remote+::@icon icon.debugger+::@help TraceRmiLauncherServicePlugin#gdb_remote+::@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:int=9999 "Port" "The host's listening port"+::@env OPT_ARCH:str="" "Architecture (optional)" "Target architecture override"+::@env OPT_GDB_PATH:file="gdb" "gdb command" "The path to gdb on the local system. Omit the full path to resolve using the system PATH."++@echo off+set PYTHONPATH0=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-gdb\pypkg\src+set PYTHONPATH1=%GHIDRA_HOME%\Ghidra\Debug\Debugger-rmi-trace\pypkg\src+IF EXIST %GHIDRA_HOME%\.git (+ set PYTHONPATH0=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-gdb\build\pypkg\src+ set PYTHONPATH1=%GHIDRA_HOME%\Ghidra\Debug\Debugger-rmi-trace\build\pypkg\src+)+IF EXIST %GHIDRA_HOME%\ghidra\.git (+ set PYTHONPATH0=%GHIDRA_HOME%\ghidra\Ghidra\Debug\Debugger-agent-gdb\build\pypkg\src+ set PYTHONPATH1=%GHIDRA_HOME%\ghidra\Ghidra\Debug\Debugger-rmi-trace\build\pypkg\src+)+set PYTHONPATH=%PYTHONPATH1%;%PYTHONPATH0%;%PYTHONPATH%++IF "%OPT_ARCH%"=="" (+ set archcmd=+) ELSE (+ set archcmd=-ex "set arch %OPT_ARCH%"+)++"%OPT_GDB_PATH%" ^+ -q ^+ -ex "set pagination off" ^+ -ex "set confirm off" ^+ -ex "show version" ^+ -ex "python import ghidragdb" ^+ %archcmd% ^+ -ex "echo Connecting to %OPT_HOST%:%OPT_PORT%... " ^+ -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" ^+ -ex "ghidra trace sync-synth-stopped" ^+ -ex "set confirm on" ^+ -ex "set pagination on"diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdb.bat b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdb.batnew file mode 100644index 0000000000..ff7820d634--- /dev/null+++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdb.bat@@ -0,0 +1,39 @@+::@timeout 60000+::@title gdb via ssh+::@desc <html><body width="300px">+::@desc <h3>Launch with <tt>gdb</tt> via <tt>ssh</tt></h3>+::@desc <p>+::@desc This will launch the target on a remote machine using <tt>gdb</tt> via <tt>ssh</tt>.+::@desc For setup instructions, press <b>F1</b>.+::@desc </p>+::@desc </body></html>+::@menu-group remote+::@icon icon.debugger+::@help TraceRmiLauncherServicePlugin#gdb_ssh+::@enum StartCmd:str run start starti+::@env OPT_TARGET_IMG:str="" "Image" "The target binary executable image on the remote system"+::@env OPT_TARGET_ARGS:str="" "Arguments" "Command-line arguments to pass to the target"+::@env OPT_SSH_PATH:file="ssh" "ssh command" "The path to ssh on the local system. Omit the full path to resolve using the system PATH."+::@env OPT_HOST:str="localhost" "[User@]Host" "The hostname or user@host"+::@env OPT_REMOTE_PORT:int=12345 "Remote Trace RMI Port" "A free port on the remote end to receive and forward the Trace RMI connection."+::@env OPT_EXTRA_SSH_ARGS:str="" "Extra ssh arguments" "Extra arguments to pass to ssh. Use with care."+::@env OPT_GDB_PATH:str="gdb" "gdb command" "The path to gdb on the remote system. Omit the full path to resolve using the system PATH."+::@env OPT_START_CMD:StartCmd="starti" "Run command" "The gdb command to actually run the target."++@echo off+set cmd=TERM='%TERM%' '%OPT_GDB_PATH%' ^+ -q ^+ -ex 'set pagination off' ^+ -ex 'set confirm off' ^+ -ex 'show version' ^+ -ex 'python import ghidragdb' ^+ -ex 'file \"%OPT_TARGET_IMG%\"' ^+ -ex 'set args %OPT_TARGET_ARGS%' ^+ -ex 'ghidra trace connect \"localhost:%OPT_REMOTE_PORT%\"' ^+ -ex 'ghidra trace start' ^+ -ex 'ghidra trace sync-enable' ^+ -ex '%OPT_START_CMD%' ^+ -ex 'set confirm on' ^+ -ex 'set pagination on'++"%OPT_SSH_PATH%" "-R%OPT_REMOTE_PORT%:%GHIDRA_TRACE_RMI_ADDR%" -t %OPT_EXTRA_SSH_ARGS% "%OPT_HOST%" "%cmd%"diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdb.sh b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdb.shindex 99a71b6dd6..964fe9cf1b 100755--- a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdb.sh+++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdb.sh@@ -1,18 +1,18 @@#!/usr/bin/bash## ###-# IP: GHIDRA-#-# Licensed under the Apache License, Version 2.0 (the "License");-# you may not use this file except in compliance with the License.-# You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.+# IP: GHIDRA+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.###@timeout 60000#@title gdb via ssh@@ -29,6 +29,7 @@#@enum StartCmd:str run start starti#@arg :str "Image" "The target binary executable image on the remote system"#@args "Arguments" "Command-line arguments to pass to the target"+#@env OPT_SSH_PATH:file="ssh" "ssh command" "The path to ssh on the local system. Omit the full path to resolve using the system PATH."#@env OPT_HOST:str="localhost" "[User@]Host" "The hostname or user@host"#@env OPT_REMOTE_PORT:int=12345 "Remote Trace RMI Port" "A free port on the remote end to receive and forward the Trace RMI connection."#@env OPT_EXTRA_SSH_ARGS:str="" "Extra ssh arguments" "Extra arguments to pass to ssh. Use with care."@@ -39,7 +40,7 @@ target_image="$1"shifttarget_args="$@"-ssh "-R$OPT_REMOTE_PORT:$GHIDRA_TRACE_RMI_ADDR" -t $OPT_EXTRA_SSH_ARGS "$OPT_HOST" "TERM='$TERM' '$OPT_GDB_PATH' \+"$OPT_SSH_PATH" "-R$OPT_REMOTE_PORT:$GHIDRA_TRACE_RMI_ADDR" -t $OPT_EXTRA_SSH_ARGS "$OPT_HOST" "TERM='$TERM' '$OPT_GDB_PATH' \-q \-ex 'set pagination off' \-ex 'set confirm off' \diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdbserver.bat b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdbserver.batnew file mode 100644index 0000000000..91c4cc48aa--- /dev/null+++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdbserver.bat@@ -0,0 +1,47 @@+::@timeout 60000+::@title gdb + gdbserver via ssh+::@desc <html><body width="300px">+::@desc <h3>Launch with local <tt>gdb</tt> and <tt>gdbserver</tt> via <tt>ssh</tt></h3>+::@desc <p>+::@desc This will start <tt>gdb</tt> on the local system and then use it to connect and launch the target in <tt>gdbserver</tt> on the remote system via <tt>ssh</tt>.+::@desc For setup instructions, press <b>F1</b>.+::@desc </p>+::@desc </body></html>+::@menu-group remote+::@icon icon.debugger+::@help TraceRmiLauncherServicePlugin#gdb_gdbserver_ssh+::@env OPT_TARGET_IMG:str="" "Image" "The target binary executable image on the remote system"+::@env OPT_TARGET_ARGS:str="" "Arguments" "Command-line arguments to pass to the target"+::@env OPT_SSH_PATH:file="ssh" "ssh command" "The path to ssh on the local system. Omit the full path to resolve using the system PATH."+::@env OPT_HOST:str="localhost" "[User@]Host" "The hostname or user@host"+::@env OPT_EXTRA_SSH_ARGS:str="" "Extra ssh arguments" "Extra arguments to pass to ssh. Use with care."+::@env OPT_GDBSERVER_PATH:str="gdbserver" "gdbserver command (remote)" "The path to gdbserver on the remote system. Omit the full path to resolve using the system PATH."+::@env OPT_EXTRA_GDBSERVER_ARGS:str="" "Extra gdbserver arguments" "Extra arguments to pass to gdbserver. Use with care."+::@env OPT_GDB_PATH:file="gdb" "gdb command" "The path to gdb on the local system. Omit the full path to resolve using the system PATH."++@echo off+set PYTHONPATH0=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-gdb\pypkg\src+set PYTHONPATH1=%GHIDRA_HOME%\Ghidra\Debug\Debugger-rmi-trace\pypkg\src+IF EXIST %GHIDRA_HOME%\.git (+ set PYTHONPATH0=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-gdb\build\pypkg\src+ set PYTHONPATH1=%GHIDRA_HOME%\Ghidra\Debug\Debugger-rmi-trace\build\pypkg\src+)+IF EXIST %GHIDRA_HOME%\ghidra\.git (+ set PYTHONPATH0=%GHIDRA_HOME%\ghidra\Ghidra\Debug\Debugger-agent-gdb\build\pypkg\src+ set PYTHONPATH1=%GHIDRA_HOME%\ghidra\Ghidra\Debug\Debugger-rmi-trace\build\pypkg\src+)+set PYTHONPATH=%PYTHONPATH1%;%PYTHONPATH0%;%PYTHONPATH%++"%OPT_GDB_PATH%" ^+ -q ^+ -ex "set pagination off" ^+ -ex "set confirm off" ^+ -ex "show version" ^+ -ex "python import ghidragdb" ^+ -ex "target remote | '%OPT_SSH_PATH%' %OPT_EXTRA_SSH_ARGS% '%OPT_HOST%' '%OPT_GDBSERVER_PATH%' %OPT_EXTRA_GDBSERVER_ARGS% - '%OPT_TARGET_IMG%' %OPT_TARGET_ARGS%" ^+ -ex "ghidra trace connect '%GHIDRA_TRACE_RMI_ADDR%'" ^+ -ex "ghidra trace start" ^+ -ex "ghidra trace sync-enable" ^+ -ex "ghidra trace sync-synth-stopped" ^+ -ex "set confirm on" ^+ -ex "set pagination on"diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdbserver.sh b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdbserver.shindex c6bd71b6df..4639d1b9d2 100755--- a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdbserver.sh+++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdbserver.sh@@ -1,18 +1,18 @@#!/usr/bin/bash## ###-# IP: GHIDRA-#-# Licensed under the Apache License, Version 2.0 (the "License");-# you may not use this file except in compliance with the License.-# You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing, software-# distributed under the License is distributed on an "AS IS" BASIS,-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-# See the License for the specific language governing permissions and-# limitations under the License.+# IP: GHIDRA+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.###@timeout 60000#@title gdb + gdbserver via ssh@@ -28,6 +28,7 @@#@help TraceRmiLauncherServicePlugin#gdb_gdbserver_ssh#@arg :str "Image" "The target binary executable image on the remote system"#@args "Arguments" "Command-line arguments to pass to the target"+#@env OPT_SSH_PATH:file="ssh" "ssh command" "The path to ssh on the local system. Omit the full path to resolve using the system PATH."#@env OPT_HOST:str="localhost" "[User@]Host" "The hostname or user@host"#@env OPT_EXTRA_SSH_ARGS:str="" "Extra ssh arguments" "Extra arguments to pass to ssh. Use with care."#@env OPT_GDBSERVER_PATH:str="gdbserver" "gdbserver command (remote)" "The path to gdbserver on the remote system. Omit the full path to resolve using the system PATH."@@ -53,8 +54,7 @@ fi-ex "set confirm off" \-ex "show version" \-ex "python import ghidragdb" \- -ex "set inferior-tty $TTY_TARGET" \- -ex "target remote | ssh $OPT_EXTRA_SSH_ARGS '$OPT_HOST' '$OPT_GDBSERVER_PATH' $OPT_EXTRA_GDBSERVER_ARGS - $@" \+ -ex "target remote | '$OPT_SSH_PATH' $OPT_EXTRA_SSH_ARGS '$OPT_HOST' '$OPT_GDBSERVER_PATH' $OPT_EXTRA_GDBSERVER_ARGS - $@" \-ex "ghidra trace connect \"$GHIDRA_TRACE_RMI_ADDR\"" \-ex "ghidra trace start" \-ex "ghidra trace sync-enable" \