diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-gdb.ps1 b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-gdb.ps1 index fe1e3ba424..405d8cd0a0 100644 --- a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-gdb.ps1 +++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-gdb.ps1 @@ -31,6 +31,7 @@ #@arg :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_GDB_ARGS:str="" "gdb cmd args" "Arguments passed to gdb (versus the target)" #@env OPT_START_CMD:StartCmd="starti" "Run command" "The gdb command to actually run the target." #@env OPT_ARCH:str="auto" "Architecture" "Target architecture" #@env OPT_ENDIAN:Endian="auto" "Endian" "Target byte order" diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-gdb.sh b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-gdb.sh index c2945d3f4c..c8ba88534f 100755 --- a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-gdb.sh +++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-gdb.sh @@ -32,6 +32,7 @@ #@arg :file "Image" "The target binary executable image, empty for no target" #@args "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_GDB_ARGS:str="" "gdb cmd args" "Arguments passed to gdb (versus the target)" #@env OPT_START_CMD:StartCmd="starti" "Run command" "The gdb command to actually run the target." #@env OPT_ARCH:str="i386:x86-64" "Architecture" "Target architecture" #@env OPT_ENDIAN:Endian="auto" "Endian" "Target byte order" diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-rr.sh b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-rr.sh index ca8684b05a..cb92423801 100755 --- a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-rr.sh +++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/local-rr.sh @@ -30,6 +30,7 @@ #@enum Endian:str auto big little #@arg :file "Trace Dir" "The target trace directory (e.g. .local/share/rr/trace)" #@env OPT_RR_PATH:file="rr" "rr command" "The path to rr. Omit the full path to resolve using the system PATH." +#@env OPT_RR_ARGS:str="" "rr cmd args" "Arguments passed to rr (versus the target)" #@env OPT_ARCH:str="i386:x86-64" "Architecture" "Target architecture" #@env OPT_ENDIAN:Endian="auto" "Endian" "Target byte order" #@env OPT_EXTRA_TTY:bool=false "Inferior TTY" "Provide a separate terminal emulator for the target." @@ -62,5 +63,5 @@ set confirm on set pagination on ' > $RRINIT -"$OPT_RR_PATH" replay -x $RRINIT "$target_trace" +"$OPT_RR_PATH" $OPT_RR_ARGS replay -x $RRINIT "$target_trace" 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.sh index c43a4b159f..00ce5988d2 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 @@ -35,6 +35,7 @@ #@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_GDB_ARGS:str="" "gdb cmd args" "Arguments passed to gdb (versus the target)" #@env OPT_ARCH:str="auto" "Architecture" "Target architecture" #@env OPT_ENDIAN:Endian="auto" "Endian" "Target byte order" #@env OPT_EXTRA_TTY:bool=false "QEMU TTY" "Provide a separate terminal emulator for the target." diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-sys-gdb.ps1 b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-sys-gdb.ps1 index 531f644bc0..b8566212f0 100644 --- a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-sys-gdb.ps1 +++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-sys-gdb.ps1 @@ -33,6 +33,7 @@ #@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_GDB_ARGS:str="" "gdb cmd args" "Arguments passed to gdb (versus the target)" #@env OPT_ARCH:str="auto" "Architecture" "Target architecture" #@env OPT_ENDIAN:Endian="auto" "Endian" "Target byte order" #@env OPT_EXTRA_TTY:bool=false "QEMU TTY" "Provide a separate terminal emulator for qemu." diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-sys-gdb.sh b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-sys-gdb.sh index e9b490bbf9..a7054286cd 100755 --- a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-sys-gdb.sh +++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-sys-gdb.sh @@ -34,6 +34,7 @@ #@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_GDB_ARGS:str="" "gdb cmd args" "Arguments passed to gdb (versus the target)" #@env OPT_ARCH:str="auto" "Architecture" "Target architecture" #@env OPT_ENDIAN:Endian="auto" "Endian" "Target byte order" #@env OPT_EXTRA_TTY:bool=false "QEMU TTY" "Provide a separate terminal emulator for qemu." diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/remote-gdb.ps1 b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/remote-gdb.ps1 index b4dd4fa6a9..9b368def67 100644 --- a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/remote-gdb.ps1 +++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/remote-gdb.ps1 @@ -33,6 +33,7 @@ #@env OPT_HOST:str="localhost" "Host" "The hostname of the target" #@env OPT_PORT:int=9999 "Port" "The host's listening port" #@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." +#@env OPT_GDB_ARGS:str="" "gdb cmd args" "Arguments passed to gdb (versus the target)" #@env OPT_ARCH:str="auto" "Architecture" "Target architecture override" #@env OPT_ENDIAN:Endian="auto" "Endian" "Target byte order" diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/remote-gdb.sh b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/remote-gdb.sh index 2378da4e75..c17a037a89 100755 --- a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/remote-gdb.sh +++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/remote-gdb.sh @@ -34,6 +34,7 @@ #@env OPT_HOST:str="localhost" "Host" "The hostname of the target" #@env OPT_PORT:int=9999 "Port" "The host's listening port" #@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." +#@env OPT_GDB_ARGS:str="" "gdb cmd args" "Arguments passed to gdb (versus the target)" #@env OPT_ARCH:str="auto" "Architecture" "Target architecture override" #@env OPT_ENDIAN:Endian="auto" "Endian" "Target byte order" diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdb.ps1 b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdb.ps1 index 7da578cd36..d02b1ee7a3 100644 --- a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdb.ps1 +++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdb.ps1 @@ -35,6 +35,7 @@ #@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_GDB_ARGS:str="" "gdb cmd args" "Arguments passed to gdb (versus the target)" #@env OPT_START_CMD:StartCmd="starti" "Run command" "The gdb command to actually run the target." #@env OPT_ARCH:str="i386:x86-64" "Architecture" "Target architecture" #@env OPT_ENDIAN:Endian="auto" "Endian" "Target byte order" 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.sh index 8befb88948..fc24b26ffe 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 @@ -36,6 +36,7 @@ #@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_GDB_ARGS:str="" "gdb cmd args" "Arguments passed to gdb (versus the target)" #@env OPT_START_CMD:StartCmd="starti" "Run command" "The gdb command to actually run the target." #@env OPT_ARCH:str="i386:x86-64" "Architecture" "Target architecture" #@env OPT_ENDIAN:Endian="auto" "Endian" "Target byte order" diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdbserver.ps1 b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdbserver.ps1 index d1b866bbc2..745544b7ba 100644 --- a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdbserver.ps1 +++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdbserver.ps1 @@ -35,6 +35,7 @@ #@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." +#@env OPT_GDB_ARGS:str="" "gdb cmd args" "Arguments passed to gdb (versus the target)" #@env OPT_ARCH:str="auto" "Architecture" "Target architecture" #@env OPT_ENDIAN:Endian="auto" "Endian" "Target byte order" 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.sh index 1692276674..3d2cceabb6 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 @@ -36,6 +36,7 @@ #@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." +#@env OPT_GDB_ARGS:str="" "gdb cmd args" "Arguments passed to gdb (versus the target)" #@env OPT_ARCH:str="auto" "Architecture" "Target architecture" #@env OPT_ENDIAN:Endian="auto" "Endian" "Target byte order" diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/wine-gdb.sh b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/wine-gdb.sh index d7a8532595..e5884c710c 100755 --- a/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/wine-gdb.sh +++ b/Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/wine-gdb.sh @@ -32,6 +32,7 @@ #@args "Arguments" "Command-line arguments to pass to the target" #@env OPT_WINE_PATH:file="/usr/lib/wine/wine64" "Path to wine binary" "The path to the wine executable for your target architecture." #@env OPT_GDB_PATH:file="gdb" "gdb command" "The path to gdb. Omit the full path to resolve using the system PATH." +#@env OPT_GDB_ARGS:str="" "gdb cmd args" "Arguments passed to gdb (versus the target)" #@env OPT_ARCH:str="i386:x86-64" "Architecture" "Target architecture" #@env OPT_ENDIAN:Endian="auto" "Endian" "Target byte order" #@env OPT_EXTRA_TTY:bool=false "Inferior TTY" "Provide a separate terminal emulator for the target." diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/support/gdbsetuputils.ps1 b/Ghidra/Debug/Debugger-agent-gdb/data/support/gdbsetuputils.ps1 index bfcdcda03e..5208e764b6 100644 --- a/Ghidra/Debug/Debugger-agent-gdb/data/support/gdbsetuputils.ps1 +++ b/Ghidra/Debug/Debugger-agent-gdb/data/support/gdbsetuputils.ps1 @@ -26,6 +26,7 @@ function Add-Gdb-Init-Args { $ArgList.Value+=("-ex", "`"python if not 'ghidragdb' in locals(): exit(253)`"") $ArgList.Value+=("-ex", "`"set architecture $Env:OPT_ARCH`"") $ArgList.Value+=("-ex", "`"set endian $Env:OPT_ENDIAN`"") + $ArgList.Value+=($Env:OPT_GDB_ARGS) } function Add-Gdb-Image-And-Args { diff --git a/Ghidra/Debug/Debugger-agent-gdb/data/support/gdbsetuputils.sh b/Ghidra/Debug/Debugger-agent-gdb/data/support/gdbsetuputils.sh index e449b890b6..ed134b962a 100644 --- a/Ghidra/Debug/Debugger-agent-gdb/data/support/gdbsetuputils.sh +++ b/Ghidra/Debug/Debugger-agent-gdb/data/support/gdbsetuputils.sh @@ -24,6 +24,7 @@ add-gdb-init-args() { args+=(-ex "python if not 'ghidragdb' in locals(): exit(253)") args+=(-ex "set architecture $OPT_ARCH") args+=(-ex "set endian $OPT_ENDIAN") + args+=($OPT_GDB_ARGS) } add-gdb-image-and-args() { diff --git a/Ghidra/Debug/Debugger-agent-gdb/src/main/help/help/topics/gdb/gdb.html b/Ghidra/Debug/Debugger-agent-gdb/src/main/help/help/topics/gdb/gdb.html index 04415f321d..91895838ce 100644 --- a/Ghidra/Debug/Debugger-agent-gdb/src/main/help/help/topics/gdb/gdb.html +++ b/Ghidra/Debug/Debugger-agent-gdb/src/main/help/help/topics/gdb/gdb.html @@ -102,6 +102,9 @@ python3 -m pip install --no-index -f Debugger-rmi-trace/pypkg/dist -f Debugger-a
  • gdb command: This is the command or path to GDB. We recommend version 13 or later. We require version 8 or later.
  • +
  • gdb cmd args: Arguments passed directly to GDB (versus the target). + Note: these arguments may override user arguments passed to the cmd.
  • +
  • Run command: This is the GDB command to actually launch the target. In most cases this should be "starti," since this will assure you an initial break and a chance to enable your breakpoints.
  • diff --git a/Ghidra/Debug/Debugger-agent-gdb/src/main/help/help/topics/gdb/images/GdbLauncher.png b/Ghidra/Debug/Debugger-agent-gdb/src/main/help/help/topics/gdb/images/GdbLauncher.png index 3e05daf55b..db34ea8697 100644 Binary files a/Ghidra/Debug/Debugger-agent-gdb/src/main/help/help/topics/gdb/images/GdbLauncher.png and b/Ghidra/Debug/Debugger-agent-gdb/src/main/help/help/topics/gdb/images/GdbLauncher.png differ diff --git a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/android-lldb-attach.ps1 b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/android-lldb-attach.ps1 index b0448d8568..d75a12fa23 100644 --- a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/android-lldb-attach.ps1 +++ b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/android-lldb-attach.ps1 @@ -30,6 +30,7 @@ #@env OPT_PORT:str="9999" "Port" "The host's listening port" #@env OPT_ARCH:str="" "Architecture" "Target architecture override" #@env OPT_LLDB_PATH:file="lldb" "lldb command" "The path to lldb on the local system. Omit the full path to resolve using the system PATH." +#@env OPT_LLDB_ARGS:str="" "lldb cmd args" "Arguments passed to lldb (versus the target)" #@env OPT_EXTRA_CMDS:str="" "Additional commands" "Follow-up lldb commands." . ..\support\lldbsetuputils.ps1 diff --git a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/android-lldb-attach.sh b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/android-lldb-attach.sh index 183aa6cb22..579284b6df 100755 --- a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/android-lldb-attach.sh +++ b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/android-lldb-attach.sh @@ -31,6 +31,7 @@ #@env OPT_PORT:str="9999" "Port" "The host's listening port" #@env OPT_ARCH:str="" "Architecture" "Target architecture override" #@env OPT_LLDB_PATH:file="lldb" "lldb command" "The path to lldb on the local system. Omit the full path to resolve using the system PATH." +#@env OPT_LLDB_ARGS:str="" "lldb cmd args" "Arguments passed to lldb (versus the target)" #@env OPT_EXTRA_CMDS:str="" "Additional commands" "Follow-up lldb commands." . ../support/lldbsetuputils.sh diff --git a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/android-lldb.ps1 b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/android-lldb.ps1 index 52dc9ce0c4..bbfdf05c90 100644 --- a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/android-lldb.ps1 +++ b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/android-lldb.ps1 @@ -33,6 +33,7 @@ #@env OPT_PORT:str="9999" "Port" "The host's listening port" #@env OPT_ARCH:str="" "Architecture" "Target architecture override" #@env OPT_LLDB_PATH:file="lldb" "lldb command" "The path to lldb on the local system. Omit the full path to resolve using the system PATH." +#@env OPT_LLDB_ARGS:str="" "lldb cmd args" "Arguments passed to lldb (versus the target)" #@env OPT_START_CMD:StartCmd="process launch" "Run command" "The lldb command to actually run the target." . ..\support\lldbsetuputils.ps1 diff --git a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/android-lldb.sh b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/android-lldb.sh index f82e41d17c..7e6cee8fb4 100755 --- a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/android-lldb.sh +++ b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/android-lldb.sh @@ -34,6 +34,7 @@ #@env OPT_PORT:str="9999" "Port" "The host's listening port" #@env OPT_ARCH:str="" "Architecture" "Target architecture override" #@env OPT_LLDB_PATH:file="lldb" "lldb command" "The path to lldb on the local system. Omit the full path to resolve using the system PATH." +#@env OPT_LLDB_ARGS:str="" "lldb cmd args" "Arguments passed to lldb (versus the target)" #@env OPT_START_CMD:StartCmd="process launch" "Run command" "The lldb command to actually run the target." . ../support/lldbsetuputils.sh diff --git a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/kernel-lldb.ps1 b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/kernel-lldb.ps1 index ac7275db76..6023a039a9 100644 --- a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/kernel-lldb.ps1 +++ b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/kernel-lldb.ps1 @@ -28,6 +28,7 @@ #@env OPT_HOST:str="localhost" "Host" "The hostname of the target" #@env OPT_ARCH:str="" "Architecture" "Target architecture override" #@env OPT_LLDB_PATH:file="lldb" "lldb command" "The path to lldb on the local system. Omit the full path to resolve using the system PATH." +#@env OPT_LLDB_ARGS:str="" "lldb cmd args" "Arguments passed to lldb (versus the target)" . ..\support\lldbsetuputils.ps1 diff --git a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/kernel-lldb.sh b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/kernel-lldb.sh index a72176ac55..d684644cc0 100755 --- a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/kernel-lldb.sh +++ b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/kernel-lldb.sh @@ -29,6 +29,7 @@ #@env OPT_HOST:str="localhost" "Host" "The hostname of the target" #@env OPT_ARCH:str="" "Architecture" "Target architecture override" #@env OPT_LLDB_PATH:file="lldb" "lldb command" "The path to lldb on the local system. Omit the full path to resolve using the system PATH." +#@env OPT_LLDB_ARGS:str="" "lldb cmd args" "Arguments passed to lldb (versus the target)" . ../support/lldbsetuputils.sh diff --git a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/local-lldb.ps1 b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/local-lldb.ps1 index 44de04f9e9..488c23ce38 100644 --- a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/local-lldb.ps1 +++ b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/local-lldb.ps1 @@ -30,6 +30,7 @@ #@arg :file "Image" "The target binary executable image" #@env OPT_TARGET_ARGS:str="" "Arguments" "Command-line arguments to pass to the target" #@env OPT_LLDB_PATH:file="lldb" "lldb command" "The path to lldb. Omit the full path to resolve using the system PATH." +#@env OPT_LLDB_ARGS:str="" "lldb cmd args" "Arguments passed to lldb (versus the target)" #@env OPT_START_CMD:StartCmd="process launch" "Run command" "The lldb command to actually run the target." . ..\support\lldbsetuputils.ps1 diff --git a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/local-lldb.sh b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/local-lldb.sh index b9715b2b5b..26aa1e2128 100755 --- a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/local-lldb.sh +++ b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/local-lldb.sh @@ -31,6 +31,7 @@ #@arg :file "Image" "The target binary executable image" #@args "Arguments" "Command-line arguments to pass to the target" #@env OPT_LLDB_PATH:file="lldb" "lldb command" "The path to lldb. Omit the full path to resolve using the system PATH." +#@env OPT_LLDB_ARGS:str="" "lldb cmd args" "Arguments passed to lldb (versus the target)" #@env OPT_START_CMD:StartCmd="process launch" "Run command" "The lldb command to actually run the target." #@env OPT_EXTRA_TTY:bool=false "Target TTY" "Provide a separate terminal emulator for the target." #@tty TTY_TARGET if env:OPT_EXTRA_TTY diff --git a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/remote-lldb.ps1 b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/remote-lldb.ps1 index a3e61fe529..ad0e6ed664 100644 --- a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/remote-lldb.ps1 +++ b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/remote-lldb.ps1 @@ -31,6 +31,7 @@ #@env OPT_PORT:str="9999" "Port" "The host's listening port" #@env OPT_ARCH:str="" "Architecture" "Target architecture override" #@env OPT_LLDB_PATH:file="lldb" "lldb command" "The path to lldb on the local system. Omit the full path to resolve using the system PATH." +#@env OPT_LLDB_ARGS:str="" "lldb cmd args" "Arguments passed to lldb (versus the target)" . ..\support\lldbsetuputils.ps1 diff --git a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/remote-lldb.sh b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/remote-lldb.sh index 08e7c307d6..bce1bb33db 100755 --- a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/remote-lldb.sh +++ b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/remote-lldb.sh @@ -32,6 +32,7 @@ #@env OPT_PORT:str="9999" "Port" "The host's listening port" #@env OPT_ARCH:str="" "Architecture" "Target architecture override" #@env OPT_LLDB_PATH:file="lldb" "lldb command" "The path to lldb on the local system. Omit the full path to resolve using the system PATH." +#@env OPT_LLDB_ARGS:str="" "lldb cmd args" "Arguments passed to lldb (versus the target)" . ../support/lldbsetuputils.sh diff --git a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/ssh-lldb.ps1 b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/ssh-lldb.ps1 index 3b9c31f799..c6e398faa6 100644 --- a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/ssh-lldb.ps1 +++ b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/ssh-lldb.ps1 @@ -35,6 +35,7 @@ #@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_LLDB_PATH:str="lldb" "lldb command" "The path to lldb on the remote system. Omit the full path to resolve using the system PATH." +#@env OPT_LLDB_ARGS:str="" "lldb cmd args" "Arguments passed to lldb (versus the target)" #@env OPT_START_CMD:StartCmd="process launch" "Run command" "The lldb command to actually run the target." #@env OPT_ARCH:str="x86_64" "Architecture" "Target architecture" diff --git a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/ssh-lldb.sh b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/ssh-lldb.sh index 65e59634a0..d70580f336 100755 --- a/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/ssh-lldb.sh +++ b/Ghidra/Debug/Debugger-agent-lldb/data/debugger-launchers/ssh-lldb.sh @@ -36,6 +36,7 @@ #@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_LLDB_PATH:str="lldb" "lldb command" "The path to lldb on the remote system. Omit the full path to resolve using the system PATH." +#@env OPT_LLDB_ARGS:str="" "lldb cmd args" "Arguments passed to lldb (versus the target)" #@env OPT_START_CMD:StartCmd="process launch" "Run command" "The lldb command to actually run the target." #@env OPT_ARCH:str="x86_64" "Architecture" "Target architecture" diff --git a/Ghidra/Debug/Debugger-agent-lldb/data/support/lldbsetuputils.ps1 b/Ghidra/Debug/Debugger-agent-lldb/data/support/lldbsetuputils.ps1 index 6467183c83..9e2cba3bba 100644 --- a/Ghidra/Debug/Debugger-agent-lldb/data/support/lldbsetuputils.ps1 +++ b/Ghidra/Debug/Debugger-agent-lldb/data/support/lldbsetuputils.ps1 @@ -24,6 +24,7 @@ function Add-Lldb-Init-Args { if ("$Env:OPT_ARCH" -ne "") { $ArgList.Value+=("-o", "`"settings set target.default-arch $Env:OPT_ARCH`"") } + $ArgList.Value+=($Env:OPT_LLDB_ARGS) } function Add-Lldb-Image-And-Args { diff --git a/Ghidra/Debug/Debugger-agent-lldb/data/support/lldbsetuputils.sh b/Ghidra/Debug/Debugger-agent-lldb/data/support/lldbsetuputils.sh index 67f5920487..a7f65f2b00 100644 --- a/Ghidra/Debug/Debugger-agent-lldb/data/support/lldbsetuputils.sh +++ b/Ghidra/Debug/Debugger-agent-lldb/data/support/lldbsetuputils.sh @@ -19,10 +19,10 @@ add-lldb-init-args() { args+=(-o "version") args+=(-o "script import os, ghidralldb") args+=(-o "script if not 'ghidralldb' in locals(): os._exit(253)") - if [ -n "$OPT_ARCH" ]; then args+=(-o "settings set target.default-arch $OPT_ARCH") fi + args+=($OPT_LLDB_ARGS) } add-lldb-image-and-args() { diff --git a/Ghidra/Debug/Debugger-agent-lldb/src/main/help/help/topics/lldb/lldb.html b/Ghidra/Debug/Debugger-agent-lldb/src/main/help/help/topics/lldb/lldb.html index e56238173a..fe570f0bda 100644 --- a/Ghidra/Debug/Debugger-agent-lldb/src/main/help/help/topics/lldb/lldb.html +++ b/Ghidra/Debug/Debugger-agent-lldb/src/main/help/help/topics/lldb/lldb.html @@ -94,6 +94,9 @@ python3 -m pip install --no-index -f Debugger-rmi-trace/pypkg/dist -f Debugger-a
  • lldb command: This is the command or path to LLDB. We recommend version 15 or later.
  • +
  • lldb cmd args: Arguments passed directly to LLDB (versus the target). + Note: these arguments may override user arguments passed to the cmd.
  • +
  • Run command: This is the LLDB command to actually launch the target. In most cases this should include "--stop-at-entry", since this will assure you an initial break and a chance to enable your breakpoints.
  • diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/DebuggerEmulationServicePlugin.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/DebuggerEmulationServicePlugin.java index 8a81cf73a7..8b7dd85b6a 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/DebuggerEmulationServicePlugin.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/DebuggerEmulationServicePlugin.java @@ -101,8 +101,10 @@ import ghidra.util.task.TaskMonitor; public class DebuggerEmulationServicePlugin extends Plugin implements DebuggerEmulationService { protected static final int MAX_CACHE_SIZE = 5; - private static final AutoConfigState.ClassHandler CONFIG_STATE_HANDLER = - AutoConfigState.wireHandler(DebuggerEmulationServicePlugin.class, MethodHandles.lookup()); + private static final AutoConfigState.ClassHandler< + DebuggerEmulationServicePlugin> CONFIG_STATE_HANDLER = + AutoConfigState.wireHandler(DebuggerEmulationServicePlugin.class, + MethodHandles.lookup()); public interface EmulateProgramAction { String NAME = "Emulate Program in new Trace"; @@ -299,7 +301,7 @@ public class DebuggerEmulationServicePlugin extends Plugin implements DebuggerEm } @AutoConfigStateField - private String defaultEmulator; + private String defaultEmulator = DefaultEmulatorFactory.TITLE; protected EmulatorFactory emulatorFactory = new DefaultEmulatorFactory(); diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/DefaultEmulatorFactory.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/DefaultEmulatorFactory.java index 817fe702d9..b08a5bdc1a 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/DefaultEmulatorFactory.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/DefaultEmulatorFactory.java @@ -25,12 +25,13 @@ import ghidra.pcode.exec.trace.TraceEmulationIntegration.Writer; * The Debugger's default emulator factory */ public class DefaultEmulatorFactory implements EmulatorFactory { + public static final String TITLE = "Default Concrete P-code Emulator"; // TODO: Config options: // 1) userop library @Override public String getTitle() { - return "Default Concrete P-code Emulator"; + return TITLE; } @Override diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/TraceRmiLauncherServicePluginScreenShots.java b/Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/gdbScreenShots.java similarity index 84% rename from Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/TraceRmiLauncherServicePluginScreenShots.java rename to Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/gdbScreenShots.java index 07a49cc174..440043be38 100644 --- a/Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/TraceRmiLauncherServicePluginScreenShots.java +++ b/Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/gdbScreenShots.java @@ -15,9 +15,12 @@ */ package ghidra.app.plugin.core.debug.gui.tracermi.launcher; +import java.awt.Window; import java.nio.file.Paths; import java.util.Map; +import javax.swing.SwingUtilities; + import org.junit.Test; import ghidra.app.plugin.core.terminal.TerminalProvider; @@ -27,7 +30,8 @@ import ghidra.framework.plugintool.AutoConfigState.PathIsFile; import ghidra.test.ToyProgramBuilder; import help.screenshot.GhidraScreenShotGenerator; -public class TraceRmiLauncherServicePluginScreenShots extends GhidraScreenShotGenerator { +// Class name must be ScreenShots, and topic is "gdb", so yeah, lowercase! +public class gdbScreenShots extends GhidraScreenShotGenerator { TraceRmiLauncherServicePlugin servicePlugin; protected void captureLauncherByTitle(String title, Map> args) @@ -47,7 +51,10 @@ public class TraceRmiLauncherServicePluginScreenShots extends GhidraScreenShotGe runSwingLater(() -> servicePlugin.configureAndLaunch(offer)); - captureDialog(TraceRmiLaunchDialog.class); + TraceRmiLaunchDialog dialog = waitForDialogComponent(TraceRmiLaunchDialog.class); + Window window = SwingUtilities.windowForComponent(dialog.getComponent()); + window.requestFocus(); + captureDialog(dialog); } protected ValStr fileArg(String path) { diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidraclass/debugger/screenshot/TutorialDebuggerScreenShots.java b/Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidraclass/debugger/screenshot/TutorialDebuggerScreenShots.java index 18e61664c6..f6a77c9b9a 100644 --- a/Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidraclass/debugger/screenshot/TutorialDebuggerScreenShots.java +++ b/Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidraclass/debugger/screenshot/TutorialDebuggerScreenShots.java @@ -18,6 +18,7 @@ package ghidraclass.debugger.screenshot; import static org.junit.Assert.*; import java.awt.Rectangle; +import java.awt.Window; import java.awt.event.MouseEvent; import java.io.*; import java.nio.charset.Charset; @@ -26,6 +27,8 @@ import java.nio.file.Files; import java.util.*; import java.util.concurrent.TimeUnit; +import javax.swing.SwingUtilities; + import org.junit.Before; import org.junit.Test; @@ -277,7 +280,10 @@ public class TutorialDebuggerScreenShots extends GhidraScreenShotGenerator } })); - captureDialog(TraceRmiLaunchDialog.class); + TraceRmiLaunchDialog dialog = waitForDialogComponent(TraceRmiLaunchDialog.class); + Window window = SwingUtilities.windowForComponent(dialog.getComponent()); + window.requestFocus(); + captureDialog(dialog); } @Test @@ -382,9 +388,9 @@ public class TutorialDebuggerScreenShots extends GhidraScreenShotGenerator Program prog = null; long snap = flatDbg.getCurrentSnap(); try (LoadResults result = ProgramLoader.builder() - .source(new File(module.getName(snap))) - .project(env.getProject()) - .monitor(monitor) + .source(new File(module.getName(snap))) + .project(env.getProject()) + .monitor(monitor) .load()) { result.save(monitor); diff --git a/GhidraDocs/GhidraClass/Debugger/images/GettingStarted_LaunchGDBDialog.png b/GhidraDocs/GhidraClass/Debugger/images/GettingStarted_LaunchGDBDialog.png index 2d4dbd089d..fe0b28a4a9 100644 Binary files a/GhidraDocs/GhidraClass/Debugger/images/GettingStarted_LaunchGDBDialog.png and b/GhidraDocs/GhidraClass/Debugger/images/GettingStarted_LaunchGDBDialog.png differ diff --git a/GhidraDocs/GhidraClass/Debugger/images/RemoteTargets_GdbPlusGdbserverViaSsh.png b/GhidraDocs/GhidraClass/Debugger/images/RemoteTargets_GdbPlusGdbserverViaSsh.png index 9245b8aa28..29e87bc19c 100644 Binary files a/GhidraDocs/GhidraClass/Debugger/images/RemoteTargets_GdbPlusGdbserverViaSsh.png and b/GhidraDocs/GhidraClass/Debugger/images/RemoteTargets_GdbPlusGdbserverViaSsh.png differ diff --git a/GhidraDocs/GhidraClass/Debugger/images/RemoteTargets_GdbViaSsh.png b/GhidraDocs/GhidraClass/Debugger/images/RemoteTargets_GdbViaSsh.png index fa4f9c36ef..043c1e08a3 100644 Binary files a/GhidraDocs/GhidraClass/Debugger/images/RemoteTargets_GdbViaSsh.png and b/GhidraDocs/GhidraClass/Debugger/images/RemoteTargets_GdbViaSsh.png differ