Merge remote-tracking branch 'origin/GP-5700_Dan_reworkLauncherGhidraHome--SQUASHED'

This commit is contained in:
Ryan Kurtz
2025-07-03 06:21:08 -04:00
73 changed files with 862 additions and 516 deletions
@@ -9,6 +9,7 @@
::@menu-group dbgeng ::@menu-group dbgeng
::@icon icon.debugger ::@icon icon.debugger
::@help dbgeng#win_kernel ::@help dbgeng#win_kernel
::@depends Debugger-rmi-trace
::@enum Connection:str Remote Local EXDI ::@enum Connection:str Remote Local EXDI
::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH." ::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH."
:: Use env instead of args, because "all args except first" is terrible to implement in batch :: Use env instead of args, because "all args except first" is terrible to implement in batch
@@ -9,6 +9,7 @@
::@menu-group dbgeng ::@menu-group dbgeng
::@icon icon.debugger ::@icon icon.debugger
::@help dbgeng#attach ::@help dbgeng#attach
::@depends Debugger-rmi-trace
::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH." ::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH."
::@env OPT_TARGET_PID:int=0 "Process id" "The target process id" ::@env OPT_TARGET_PID:int=0 "Process id" "The target process id"
::@env OPT_ATTACH_FLAGS:int=0 "Attach flags" "Attach flags" ::@env OPT_ATTACH_FLAGS:int=0 "Attach flags" "Attach flags"
@@ -10,6 +10,7 @@
::@menu-group dbgeng ::@menu-group dbgeng
::@icon icon.debugger ::@icon icon.debugger
::@help dbgeng#ext ::@help dbgeng#ext
::@depends Debugger-rmi-trace
::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH." ::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH."
:: Use env instead of args, because "all args except first" is terrible to implement in batch :: Use env instead of args, because "all args except first" is terrible to implement in batch
::@env OPT_TARGET_IMG:file="" "Image" "The target binary executable image" ::@env OPT_TARGET_IMG:file="" "Image" "The target binary executable image"
@@ -9,6 +9,7 @@
::@menu-group dbgeng ::@menu-group dbgeng
::@icon icon.debugger ::@icon icon.debugger
::@help dbgeng#ttd ::@help dbgeng#ttd
::@depends Debugger-rmi-trace
::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH." ::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH."
:: Use env instead of args, because "all args except first" is terrible to implement in batch :: Use env instead of args, because "all args except first" is terrible to implement in batch
::@env OPT_TARGET_TRACE:file="" "Trace (.run)" "The target trace image" ::@env OPT_TARGET_TRACE:file="" "Trace (.run)" "The target trace image"
@@ -10,6 +10,7 @@
::@menu-group dbgeng ::@menu-group dbgeng
::@icon icon.debugger ::@icon icon.debugger
::@help dbgeng#local ::@help dbgeng#local
::@depends Debugger-rmi-trace
::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH." ::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH."
:: Use env instead of args, because "all args except first" is terrible to implement in batch :: Use env instead of args, because "all args except first" is terrible to implement in batch
::@env OPT_TARGET_IMG:file="" "Image" "The target binary executable image" ::@env OPT_TARGET_IMG:file="" "Image" "The target binary executable image"
@@ -9,6 +9,7 @@
::@menu-group dbgeng ::@menu-group dbgeng
::@icon icon.debugger ::@icon icon.debugger
::@help dbgeng#remote ::@help dbgeng#remote
::@depends Debugger-rmi-trace
::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH." ::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH."
::@env OPT_CONNECT_STRING:str="" "Connection" "Connection-string arguments (a la .server)" ::@env OPT_CONNECT_STRING:str="" "Connection" "Connection-string arguments (a la .server)"
::@env WINDBG_DIR:dir="" "Path to dbgeng.dll directory" "Path containing dbgeng and associated DLLS (if not Windows Kits)." ::@env WINDBG_DIR:dir="" "Path to dbgeng.dll directory" "Path containing dbgeng and associated DLLS (if not Windows Kits)."
@@ -10,6 +10,7 @@
::@menu-group dbgeng ::@menu-group dbgeng
::@icon icon.debugger ::@icon icon.debugger
::@help dbgeng#svrcx ::@help dbgeng#svrcx
::@depends Debugger-rmi-trace
::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH." ::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH."
:: Use env instead of args, because "all args except first" is terrible to implement in batch :: Use env instead of args, because "all args except first" is terrible to implement in batch
::@env OPT_TARGET_IMG:str="" "Image" "The target binary executable image" ::@env OPT_TARGET_IMG:str="" "Image" "The target binary executable image"
@@ -19,10 +19,11 @@ import sys
def append_paths(): def append_paths():
sys.path.append("../../../Debugger-rmi-trace/data/support") sys.path.append(
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
from gmodutils import ghidra_module_pypath from gmodutils import ghidra_module_pypath
sys.path.append(ghidra_module_pypath("Debug/Debugger-rmi-trace")) sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
sys.path.append(ghidra_module_pypath("Debug/Debugger-agent-dbgeng")) sys.path.append(ghidra_module_pypath())
def main(): def main():
@@ -19,10 +19,11 @@ import sys
def append_paths(): def append_paths():
sys.path.append("../../../Debugger-rmi-trace/data/support") sys.path.append(
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
from gmodutils import ghidra_module_pypath from gmodutils import ghidra_module_pypath
sys.path.append(ghidra_module_pypath("Debug/Debugger-rmi-trace")) sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
sys.path.append(ghidra_module_pypath("Debug/Debugger-agent-dbgeng")) sys.path.append(ghidra_module_pypath())
def main(): def main():
@@ -19,10 +19,11 @@ import sys
def append_paths(): def append_paths():
sys.path.append("../../../Debugger-rmi-trace/data/support") sys.path.append(
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
from gmodutils import ghidra_module_pypath from gmodutils import ghidra_module_pypath
sys.path.append(ghidra_module_pypath("Debug/Debugger-rmi-trace")) sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
sys.path.append(ghidra_module_pypath("Debug/Debugger-agent-dbgeng")) sys.path.append(ghidra_module_pypath())
def main(): def main():
@@ -19,10 +19,11 @@ import sys
def append_paths(): def append_paths():
sys.path.append("../../../Debugger-rmi-trace/data/support") sys.path.append(
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
from gmodutils import ghidra_module_pypath from gmodutils import ghidra_module_pypath
sys.path.append(ghidra_module_pypath("Debug/Debugger-rmi-trace")) sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
sys.path.append(ghidra_module_pypath("Debug/Debugger-agent-dbgeng")) sys.path.append(ghidra_module_pypath())
def main(): def main():
@@ -19,10 +19,11 @@ import sys
def append_paths(): def append_paths():
sys.path.append("../../../Debugger-rmi-trace/data/support") sys.path.append(
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
from gmodutils import ghidra_module_pypath from gmodutils import ghidra_module_pypath
sys.path.append(ghidra_module_pypath("Debug/Debugger-rmi-trace")) sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
sys.path.append(ghidra_module_pypath("Debug/Debugger-agent-dbgeng")) sys.path.append(ghidra_module_pypath())
def main(): def main():
@@ -19,10 +19,11 @@ import sys
def append_paths(): def append_paths():
sys.path.append("../../../Debugger-rmi-trace/data/support") sys.path.append(
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
from gmodutils import ghidra_module_pypath from gmodutils import ghidra_module_pypath
sys.path.append(ghidra_module_pypath("Debug/Debugger-rmi-trace")) sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
sys.path.append(ghidra_module_pypath("Debug/Debugger-agent-dbgeng")) sys.path.append(ghidra_module_pypath())
def main(): def main():
@@ -21,10 +21,11 @@ import sys
def append_paths(): def append_paths():
sys.path.append("../../../Debugger-rmi-trace/data/support") sys.path.append(
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
from gmodutils import ghidra_module_pypath from gmodutils import ghidra_module_pypath
sys.path.append(ghidra_module_pypath("Debug/Debugger-rmi-trace")) sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
sys.path.append(ghidra_module_pypath("Debug/Debugger-agent-dbgeng")) sys.path.append(ghidra_module_pypath())
def main(): def main():
@@ -19,10 +19,11 @@ import sys
def append_paths(): def append_paths():
sys.path.append("../../../Debugger-rmi-trace/data/support") sys.path.append(
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
from gmodutils import ghidra_module_pypath from gmodutils import ghidra_module_pypath
sys.path.append(ghidra_module_pypath("Debug/Debugger-rmi-trace")) sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
sys.path.append(ghidra_module_pypath("Debug/Debugger-agent-dbgeng")) sys.path.append(ghidra_module_pypath())
def main(): def main():
@@ -18,7 +18,7 @@ try:
import pybag import pybag
except Exception as e: except Exception as e:
from ghidratrace.setuputils import prompt_and_mitigate_dependencies from ghidratrace.setuputils import prompt_and_mitigate_dependencies
prompt_and_mitigate_dependencies("Debug/Debugger-agent-dbgeng") prompt_and_mitigate_dependencies("<SELF>")
# NOTE: libraries must precede EVERYTHING, esp pybag and DbgMod # NOTE: libraries must precede EVERYTHING, esp pybag and DbgMod
from . import libraries, util, commands, methods, hooks from . import libraries, util, commands, methods, hooks
@@ -25,6 +25,7 @@
#@menu-group drgn #@menu-group drgn
#@icon icon.debugger #@icon icon.debugger
#@help drgn#core #@help drgn#core
#@depends Debugger-rmi-trace
#@env OPT_TARGET_IMG:file!="" "Core dump" "The target core dump" #@env OPT_TARGET_IMG:file!="" "Core dump" "The target core dump"
export OPT_TARGET_KIND="coredump" export OPT_TARGET_KIND="coredump"
@@ -25,6 +25,7 @@
#@menu-group drgn #@menu-group drgn
#@icon icon.debugger #@icon icon.debugger
#@help drgn#linux_kernel #@help drgn#linux_kernel
#@depends Debugger-rmi-trace
export OPT_TARGET_KIND="kernel" export OPT_TARGET_KIND="kernel"
sudo -E drgn ../support/local-drgn.py sudo -E drgn ../support/local-drgn.py
@@ -25,6 +25,7 @@
#@menu-group drgn #@menu-group drgn
#@icon icon.debugger #@icon icon.debugger
#@help drgn#attach #@help drgn#attach
#@depends Debugger-rmi-trace
#@env OPT_TARGET_PID:int=44068 "PID" "The target's process id" #@env OPT_TARGET_PID:int=44068 "PID" "The target's process id"
export OPT_TARGET_KIND="user" export OPT_TARGET_KIND="user"
@@ -22,25 +22,18 @@ import sys
import drgn.cli import drgn.cli
home = os.getenv('GHIDRA_HOME')
if os.path.isdir(f'{home}/ghidra/.git'): def append_paths():
sys.path.append( sys.path.append(
f'{home}/ghidra/Ghidra/Debug/Debugger-agent-drgn/build/pypkg/src') f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
sys.path.append( from gmodutils import ghidra_module_pypath
f'{home}/ghidra/Ghidra/Debug/Debugger-rmi-trace/build/pypkg/src') sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
elif os.path.isdir(f'{home}/.git'): sys.path.append(ghidra_module_pypath())
sys.path.append(
f'{home}/Ghidra/Debug/Debugger-agent-drgn/build/pypkg/src')
sys.path.append(
f'{home}/Ghidra/Debug/Debugger-rmi-trace/build/pypkg/src')
else:
sys.path.append(
f'{home}/Ghidra/Debug/Debugger-agent-drgn/pypkg/src')
sys.path.append(f'{home}/Ghidra/Debug/Debugger-rmi-trace/pypkg/src')
def main(): def main():
append_paths()
from ghidradrgn import commands as cmd from ghidradrgn import commands as cmd
cmd.ghidra_trace_connect(address=os.getenv('GHIDRA_TRACE_RMI_ADDR')) cmd.ghidra_trace_connect(address=os.getenv('GHIDRA_TRACE_RMI_ADDR'))
cmd.ghidra_trace_create(start_trace=True) cmd.ghidra_trace_create(start_trace=True)
@@ -53,5 +46,3 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
main() main()
@@ -10,6 +10,7 @@
#@menu-group gdb #@menu-group gdb
#@icon icon.debugger #@icon icon.debugger
#@help gdb#local #@help gdb#local
#@depends Debugger-rmi-trace
#@enum StartCmd:str run start starti #@enum StartCmd:str run start starti
#@enum Endian:str auto big little #@enum Endian:str auto big little
#@arg :file "Image" "The target binary executable image" #@arg :file "Image" "The target binary executable image"
@@ -21,8 +22,8 @@
. ..\support\gdbsetuputils.ps1 . ..\support\gdbsetuputils.ps1
$pypathTrace = Ghidra-Module-PyPath "Debug/Debugger-rmi-trace" $pypathTrace = Ghidra-Module-PyPath "Debugger-rmi-trace"
$pypathGdb = Ghidra-Module-PyPath "Debug/Debugger-agent-gdb" $pypathGdb = Ghidra-Module-PyPath
$Env:PYTHONPATH = "$pypathGdb;$pypathTrace;$Env:PYTHONPATH" $Env:PYTHONPATH = "$pypathGdb;$pypathTrace;$Env:PYTHONPATH"
$arglist = Compute-Gdb-Usermode-Args ` $arglist = Compute-Gdb-Usermode-Args `
@@ -26,6 +26,7 @@
#@menu-group gdb #@menu-group gdb
#@icon icon.debugger #@icon icon.debugger
#@help gdb#local #@help gdb#local
#@depends Debugger-rmi-trace
#@enum StartCmd:str run start starti #@enum StartCmd:str run start starti
#@enum Endian:str auto big little #@enum Endian:str auto big little
#@arg :file "Image" "The target binary executable image, empty for no target" #@arg :file "Image" "The target binary executable image, empty for no target"
@@ -39,8 +40,8 @@
. ../support/gdbsetuputils.sh . ../support/gdbsetuputils.sh
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace") pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
pypathGdb=$(ghidra-module-pypath "Debug/Debugger-agent-gdb") pypathGdb=$(ghidra-module-pypath)
export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH
target_image="$1" target_image="$1"
@@ -25,6 +25,7 @@
#@menu-group gdb #@menu-group gdb
#@icon icon.debugger #@icon icon.debugger
#@help gdb#rr #@help gdb#rr
#@depends Debugger-rmi-trace
#@enum StartCmd:str run start starti #@enum StartCmd:str run start starti
#@enum Endian:str auto big little #@enum Endian:str auto big little
#@arg :file "Trace Dir" "The target trace directory (e.g. .local/share/rr/trace)" #@arg :file "Trace Dir" "The target trace directory (e.g. .local/share/rr/trace)"
@@ -36,8 +37,8 @@
. ../support/gdbsetuputils.sh . ../support/gdbsetuputils.sh
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace") pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
pypathGdb=$(ghidra-module-pypath "Debug/Debugger-agent-gdb") pypathGdb=$(ghidra-module-pypath)
export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH
target_trace="$1" target_trace="$1"
@@ -27,6 +27,7 @@
#@menu-group gdb #@menu-group gdb
#@icon icon.debugger #@icon icon.debugger
#@help gdb#qemu #@help gdb#qemu
#@depends Debugger-rmi-trace
#@enum Endian:str auto big little #@enum Endian:str auto big little
#@arg :file! "Image" "The target binary executable image" #@arg :file! "Image" "The target binary executable image"
#@args "Arguments" "Command-line arguments to pass to the target" #@args "Arguments" "Command-line arguments to pass to the target"
@@ -42,8 +43,8 @@
. ../support/gdbsetuputils.sh . ../support/gdbsetuputils.sh
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace") pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
pypathGdb=$(ghidra-module-pypath "Debug/Debugger-agent-gdb") pypathGdb=$(ghidra-module-pypath)
export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH
target_image="$1" target_image="$1"
@@ -11,6 +11,7 @@
#@menu-group gdb #@menu-group gdb
#@icon icon.debugger #@icon icon.debugger
#@help gdb#qemu #@help gdb#qemu
#@depends Debugger-rmi-trace
#@enum Endian:str auto big little #@enum Endian:str auto big little
#@env OPT_TARGET_IMG:file!="" "Image" "The target binary executable image" #@env OPT_TARGET_IMG:file!="" "Image" "The target binary executable image"
#@env GHIDRA_LANG_EXTTOOL_qemu_system:file="" "QEMU command" "The path to qemu-system for the target architecture." #@env GHIDRA_LANG_EXTTOOL_qemu_system:file="" "QEMU command" "The path to qemu-system for the target architecture."
@@ -23,8 +24,8 @@
. ..\support\gdbsetuputils.ps1 . ..\support\gdbsetuputils.ps1
$pypathTrace = Ghidra-Module-PyPath "Debug/Debugger-rmi-trace" $pypathTrace = Ghidra-Module-PyPath "Debugger-rmi-trace"
$pypathGdb = Ghidra-Module-PyPath "Debug/Debugger-agent-gdb" $pypathGdb = Ghidra-Module-PyPath
$Env:PYTHONPATH = "$pypathGdb;$pypathTrace;$Env:PYTHONPATH" $Env:PYTHONPATH = "$pypathGdb;$pypathTrace;$Env:PYTHONPATH"
$qemuargs = @("`"$Env:GHIDRA_LANG_EXTTOOL_qemu_system`"") $qemuargs = @("`"$Env:GHIDRA_LANG_EXTTOOL_qemu_system`"")
@@ -27,6 +27,7 @@
#@menu-group gdb #@menu-group gdb
#@icon icon.debugger #@icon icon.debugger
#@help gdb#qemu #@help gdb#qemu
#@depends Debugger-rmi-trace
#@enum Endian:str auto big little #@enum Endian:str auto big little
#@arg :file! "Image" "The target binary executable image" #@arg :file! "Image" "The target binary executable image"
#@env GHIDRA_LANG_EXTTOOL_qemu_system:file="" "QEMU command" "The path to qemu-system for the target architecture." #@env GHIDRA_LANG_EXTTOOL_qemu_system:file="" "QEMU command" "The path to qemu-system for the target architecture."
@@ -41,8 +42,8 @@
. ../support/gdbsetuputils.sh . ../support/gdbsetuputils.sh
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace") pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
pypathGdb=$(ghidra-module-pypath "Debug/Debugger-agent-gdb") pypathGdb=$(ghidra-module-pypath)
export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH
target_image="$1" target_image="$1"
@@ -10,6 +10,7 @@
#@menu-group gdb #@menu-group gdb
#@icon icon.debugger #@icon icon.debugger
#@help gdb#remote #@help gdb#remote
#@depends Debugger-rmi-trace
#@enum TargetType:str remote extended-remote #@enum TargetType:str remote extended-remote
#@enum Endian:str auto big little #@enum Endian:str auto big little
#@arg :file "Image" "The target binary executable image (a copy on the local system)" #@arg :file "Image" "The target binary executable image (a copy on the local system)"
@@ -22,8 +23,8 @@
. ..\support\gdbsetuputils.ps1 . ..\support\gdbsetuputils.ps1
$pypathTrace = Ghidra-Module-PyPath "Debug/Debugger-rmi-trace" $pypathTrace = Ghidra-Module-PyPath "Debugger-rmi-trace"
$pypathGdb = Ghidra-Module-PyPath "Debug/Debugger-agent-gdb" $pypathGdb = Ghidra-Module-PyPath
$Env:PYTHONPATH = "$pypathGdb;$pypathTrace;$Env:PYTHONPATH" $Env:PYTHONPATH = "$pypathGdb;$pypathTrace;$Env:PYTHONPATH"
$arglist = Compute-Gdb-Remote-Args ` $arglist = Compute-Gdb-Remote-Args `
@@ -26,6 +26,7 @@
#@menu-group gdb #@menu-group gdb
#@icon icon.debugger #@icon icon.debugger
#@help gdb#remote #@help gdb#remote
#@depends Debugger-rmi-trace
#@enum TargetType:str remote extended-remote #@enum TargetType:str remote extended-remote
#@enum Endian:str auto big little #@enum Endian:str auto big little
#@arg :file "Image" "The target binary executable image (a copy on the local system)" #@arg :file "Image" "The target binary executable image (a copy on the local system)"
@@ -38,8 +39,8 @@
. ../support/gdbsetuputils.sh . ../support/gdbsetuputils.sh
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace") pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
pypathGdb=$(ghidra-module-pypath "Debug/Debugger-agent-gdb") pypathGdb=$(ghidra-module-pypath)
export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH
target_image="$1" target_image="$1"
@@ -1,4 +1,3 @@
#@timeout 60000
#@title gdb via ssh #@title gdb via ssh
#@image-opt arg:1 #@image-opt arg:1
#@desc <html><body width="300px"> #@desc <html><body width="300px">
@@ -11,6 +10,7 @@
#@menu-group gdb #@menu-group gdb
#@icon icon.debugger #@icon icon.debugger
#@help gdb#ssh #@help gdb#ssh
#@depends Debugger-rmi-trace
#@enum StartCmd:str run start starti #@enum StartCmd:str run start starti
#@enum Endian:str auto big little #@enum Endian:str auto big little
#@arg :str "Image" "The target binary executable image on the remote system" #@arg :str "Image" "The target binary executable image on the remote system"
@@ -61,7 +61,7 @@ finished, try launching again.
if ($answer) { if ($answer) {
Write-Host "Copying Wheels to $Env:OPT_HOST" Write-Host "Copying Wheels to $Env:OPT_HOST"
Mitigate-Scp-PyModules "Debug/Debugger-rmi-trace" "Debug/Debugger-agent-gdb" Mitigate-Scp-PyModules "Debugger-rmi-trace" "<SELF>"
Write-Host "Installing Wheels into GDB's embedded Python" Write-Host "Installing Wheels into GDB's embedded Python"
$arglist = Compute-Gdb-PipInstall-Args "'-f'" "os.environ['HOME']" "'ghidragdb>=$version'" $arglist = Compute-Gdb-PipInstall-Args "'-f'" "os.environ['HOME']" "'ghidragdb>=$version'"
@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
## ##
#@timeout 60000
#@title gdb via ssh #@title gdb via ssh
#@image-opt arg:1 #@image-opt arg:1
#@desc <html><body width="300px"> #@desc <html><body width="300px">
@@ -27,6 +26,7 @@
#@menu-group gdb #@menu-group gdb
#@icon icon.debugger #@icon icon.debugger
#@help gdb#ssh #@help gdb#ssh
#@depends Debugger-rmi-trace
#@enum StartCmd:str run start starti #@enum StartCmd:str run start starti
#@enum Endian:str auto big little #@enum Endian:str auto big little
#@arg :str "Image" "The target binary executable image on the remote system" #@arg :str "Image" "The target binary executable image on the remote system"
@@ -93,7 +93,7 @@ finished, try launching again.
" "Would you like to install 'ghidragdb>=$version'?"; then " "Would you like to install 'ghidragdb>=$version'?"; then
echo "Copying Wheels to $OPT_HOST" echo "Copying Wheels to $OPT_HOST"
mitigate-scp-pymodules "Debug/Debugger-rmi-trace" "Debug/Debugger-agent-gdb" mitigate-scp-pymodules "Debugger-rmi-trace" "<SELF>"
echo "Installing Wheels into GDB's embedded Python" echo "Installing Wheels into GDB's embedded Python"
do-installation do-installation
@@ -1,4 +1,3 @@
#@timeout 60000
#@title gdb + gdbserver via ssh #@title gdb + gdbserver via ssh
#@image-opt arg:1 #@image-opt arg:1
#@desc <html><body width="300px"> #@desc <html><body width="300px">
@@ -11,6 +10,7 @@
#@menu-group gdb #@menu-group gdb
#@icon icon.debugger #@icon icon.debugger
#@help gdb#gdbserver_ssh #@help gdb#gdbserver_ssh
#@depends Debugger-rmi-trace
#@enum Endian:str auto big little #@enum Endian:str auto big little
#@arg :str! "Image" "The target binary executable image on the remote system" #@arg :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_TARGET_ARGS:str="" "Arguments" "Command-line arguments to pass to the target"
@@ -25,8 +25,8 @@
. ..\support\gdbsetuputils.ps1 . ..\support\gdbsetuputils.ps1
$pypathTrace = Ghidra-Module-PyPath "Debug/Debugger-rmi-trace" $pypathTrace = Ghidra-Module-PyPath "Debugger-rmi-trace"
$pypathGdb = Ghidra-Module-PyPath "Debug/Debugger-agent-gdb" $pypathGdb = Ghidra-Module-PyPath
$Env:PYTHONPATH = "$pypathGdb;$pypathTrace;$Env:PYTHONPATH" $Env:PYTHONPATH = "$pypathGdb;$pypathTrace;$Env:PYTHONPATH"
$arglist = Compute-Gdb-Remote-Args ` $arglist = Compute-Gdb-Remote-Args `
@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
## ##
#@timeout 60000
#@title gdb + gdbserver via ssh #@title gdb + gdbserver via ssh
#@image-opt arg:1 #@image-opt arg:1
#@desc <html><body width="300px"> #@desc <html><body width="300px">
@@ -27,6 +26,7 @@
#@menu-group gdb #@menu-group gdb
#@icon icon.debugger #@icon icon.debugger
#@help gdb#gdbserver_ssh #@help gdb#gdbserver_ssh
#@depends Debugger-rmi-trace
#@enum Endian:str auto big little #@enum Endian:str auto big little
#@arg :str! "Image" "The target binary executable image on the remote system" #@arg :str! "Image" "The target binary executable image on the remote system"
#@args "Arguments" "Command-line arguments to pass to the target" #@args "Arguments" "Command-line arguments to pass to the target"
@@ -41,8 +41,8 @@
. ../support/gdbsetuputils.sh . ../support/gdbsetuputils.sh
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace") pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
pypathGdb=$(ghidra-module-pypath "Debug/Debugger-agent-gdb") pypathGdb=$(ghidra-module-pypath)
export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH
target_image="$1" target_image="$1"
@@ -26,6 +26,7 @@
#@menu-group gdb #@menu-group gdb
#@icon icon.debugger #@icon icon.debugger
#@help gdb#wine #@help gdb#wine
#@depends Debugger-rmi-trace
#@enum Endian:str auto big little #@enum Endian:str auto big little
#@arg :file! "Image" "The target binary executable image" #@arg :file! "Image" "The target binary executable image"
#@args "Arguments" "Command-line arguments to pass to the target" #@args "Arguments" "Command-line arguments to pass to the target"
@@ -39,8 +40,8 @@
. ../support/gdbsetuputils.sh . ../support/gdbsetuputils.sh
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace") pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
pypathGdb=$(ghidra-module-pypath "Debug/Debugger-agent-gdb") pypathGdb=$(ghidra-module-pypath)
export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH
target_image="$1" target_image="$1"
@@ -1,5 +1,5 @@
. ..\..\..\Debugger-rmi-trace\data\support\setuputils.ps1 . $Env:MODULE_Debugger_rmi_trace_HOME\data\support\setuputils.ps1
function Add-Gdb-Init-Args { function Add-Gdb-Init-Args {
param([ref]$ArgList) param([ref]$ArgList)
@@ -48,7 +48,7 @@ function Add-Gdb-Tail-Args {
param([ref]$ArgList) param([ref]$ArgList)
$ArgList.Value+=("-ex", "`"set confirm on`"") $ArgList.Value+=("-ex", "`"set confirm on`"")
$ArgList.Value+=("-ex", "`"set pagination on`"") # $ArgList.Value+=("-ex", "`"set pagination on`"")
} }
function Compute-Gdb-Usermode-Args { function Compute-Gdb-Usermode-Args {
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
## ##
. ../../../Debugger-rmi-trace/data/support/setuputils.sh . $MODULE_Debugger_rmi_trace_HOME/data/support/setuputils.sh
add-gdb-init-args() { add-gdb-init-args() {
args+=(-q) args+=(-q)
@@ -64,7 +64,7 @@ add-gdb-start-if-image() {
add-gdb-tail-args() { add-gdb-tail-args() {
args+=(-ex "set confirm on") args+=(-ex "set confirm on")
args+=(-ex "set pagination on") # args+=(-ex "set pagination on")
} }
compute-gdb-usermode-args() { compute-gdb-usermode-args() {
@@ -10,6 +10,7 @@
#@menu-group lldb #@menu-group lldb
#@icon icon.debugger #@icon icon.debugger
#@help lldb#android #@help lldb#android
#@depends Debugger-rmi-trace
#@enum StartCmd:str "process launch" "process launch --stop-at-entry" #@enum StartCmd:str "process launch" "process launch --stop-at-entry"
#@arg :file "Image" "The target binary executable image" #@arg :file "Image" "The target binary executable image"
#@env OPT_TARGET_ARGS:str="" "Arguments" "Command-line arguments to pass to the target" #@env OPT_TARGET_ARGS:str="" "Arguments" "Command-line arguments to pass to the target"
@@ -21,8 +22,8 @@
. ..\support\lldbsetuputils.ps1 . ..\support\lldbsetuputils.ps1
$pypathTrace = Ghidra-Module-PyPath "Debug/Debugger-rmi-trace" $pypathTrace = Ghidra-Module-PyPath "Debugger-rmi-trace"
$pypathLldb = Ghidra-Module-PyPath "Debug/Debugger-agent-lldb" $pypathLldb = Ghidra-Module-PyPath
$Env:PYTHONPATH = "$pypathLldb;$pypathTrace;$Env:PYTHONPATH" $Env:PYTHONPATH = "$pypathLldb;$pypathTrace;$Env:PYTHONPATH"
$arglist = Compute-Lldb-Platform-Args ` $arglist = Compute-Lldb-Platform-Args `
@@ -26,6 +26,7 @@
#@menu-group lldb #@menu-group lldb
#@icon icon.debugger #@icon icon.debugger
#@help lldb#android #@help lldb#android
#@depends Debugger-rmi-trace
#@enum StartCmd:str "process launch" "process launch --stop-at-entry" #@enum StartCmd:str "process launch" "process launch --stop-at-entry"
#@arg :file "Image" "The target binary executable image" #@arg :file "Image" "The target binary executable image"
#@args "Arguments" "Command-line arguments to pass to the target" #@args "Arguments" "Command-line arguments to pass to the target"
@@ -37,8 +38,8 @@
. ../support/lldbsetuputils.sh . ../support/lldbsetuputils.sh
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace") pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
pypathLldb=$(ghidra-module-pypath "Debug/Debugger-agent-lldb") pypathLldb=$(ghidra-module-pypath)
export PYTHONPATH=$pypathLldb:$pypathTrace:$PYTHONPATH export PYTHONPATH=$pypathLldb:$pypathTrace:$PYTHONPATH
target_image="$1" target_image="$1"
@@ -9,14 +9,15 @@
#@menu-group lldb #@menu-group lldb
#@icon icon.debugger #@icon icon.debugger
#@help lldb#macos_kernel #@help lldb#macos_kernel
#@depends Debugger-rmi-trace
#@env OPT_HOST:str="localhost" "Host" "The hostname of the target" #@env OPT_HOST:str="localhost" "Host" "The hostname of the target"
#@env OPT_ARCH:str="" "Architecture" "Target architecture override" #@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_PATH:file="lldb" "lldb command" "The path to lldb on the local system. Omit the full path to resolve using the system PATH."
. ..\support\lldbsetuputils.ps1 . ..\support\lldbsetuputils.ps1
$pypathTrace = Ghidra-Module-PyPath "Debug/Debugger-rmi-trace" $pypathTrace = Ghidra-Module-PyPath "Debugger-rmi-trace"
$pypathLldb = Ghidra-Module-PyPath "Debug/Debugger-agent-lldb" $pypathLldb = Ghidra-Module-PyPath
$Env:PYTHONPATH = "$pypathLldb;$pypathTrace;$Env:PYTHONPATH" $Env:PYTHONPATH = "$pypathLldb;$pypathTrace;$Env:PYTHONPATH"
$arglist = Compute-Lldb-Remote-Args ` $arglist = Compute-Lldb-Remote-Args `
@@ -25,14 +25,15 @@
#@menu-group lldb #@menu-group lldb
#@icon icon.debugger #@icon icon.debugger
#@help lldb#macos_kernel #@help lldb#macos_kernel
#@depends Debugger-rmi-trace
#@env OPT_HOST:str="localhost" "Host" "The hostname of the target" #@env OPT_HOST:str="localhost" "Host" "The hostname of the target"
#@env OPT_ARCH:str="" "Architecture" "Target architecture override" #@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_PATH:file="lldb" "lldb command" "The path to lldb on the local system. Omit the full path to resolve using the system PATH."
. ../support/lldbsetuputils.sh . ../support/lldbsetuputils.sh
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace") pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
pypathLldb=$(ghidra-module-pypath "Debug/Debugger-agent-lldb") pypathLldb=$(ghidra-module-pypath)
export PYTHONPATH=$pypathLldb:$pypathTrace:$PYTHONPATH export PYTHONPATH=$pypathLldb:$pypathTrace:$PYTHONPATH
function launch-lldb() { function launch-lldb() {
@@ -10,6 +10,7 @@
#@menu-group lldb #@menu-group lldb
#@icon icon.debugger #@icon icon.debugger
#@help lldb#local #@help lldb#local
#@depends Debugger-rmi-trace
#@enum StartCmd:str "process launch" "process launch --stop-at-entry" #@enum StartCmd:str "process launch" "process launch --stop-at-entry"
#@arg :file "Image" "The target binary executable image" #@arg :file "Image" "The target binary executable image"
#@env OPT_TARGET_ARGS:str="" "Arguments" "Command-line arguments to pass to the target" #@env OPT_TARGET_ARGS:str="" "Arguments" "Command-line arguments to pass to the target"
@@ -18,8 +19,8 @@
. ..\support\lldbsetuputils.ps1 . ..\support\lldbsetuputils.ps1
$pypathTrace = Ghidra-Module-PyPath "Debug/Debugger-rmi-trace" $pypathTrace = Ghidra-Module-PyPath "Debugger-rmi-trace"
$pypathLldb = Ghidra-Module-PyPath "Debug/Debugger-agent-lldb" $pypathLldb = Ghidra-Module-PyPath
$Env:PYTHONPATH = "$pypathLldb;$pypathTrace;$Env:PYTHONPATH" $Env:PYTHONPATH = "$pypathLldb;$pypathTrace;$Env:PYTHONPATH"
$arglist = Compute-Lldb-Usermode-Args ` $arglist = Compute-Lldb-Usermode-Args `
@@ -26,6 +26,7 @@
#@menu-group lldb #@menu-group lldb
#@icon icon.debugger #@icon icon.debugger
#@help lldb#local #@help lldb#local
#@depends Debugger-rmi-trace
#@enum StartCmd:str "process launch" "process launch --stop-at-entry" #@enum StartCmd:str "process launch" "process launch --stop-at-entry"
#@arg :file "Image" "The target binary executable image" #@arg :file "Image" "The target binary executable image"
#@args "Arguments" "Command-line arguments to pass to the target" #@args "Arguments" "Command-line arguments to pass to the target"
@@ -36,8 +37,8 @@
. ../support/lldbsetuputils.sh . ../support/lldbsetuputils.sh
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace") pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
pypathLldb=$(ghidra-module-pypath "Debug/Debugger-agent-lldb") pypathLldb=$(ghidra-module-pypath)
export PYTHONPATH=$pypathLldb:$pypathTrace:$PYTHONPATH export PYTHONPATH=$pypathLldb:$pypathTrace:$PYTHONPATH
target_image="$1" target_image="$1"
@@ -10,6 +10,7 @@
#@menu-group lldb #@menu-group lldb
#@icon icon.debugger #@icon icon.debugger
#@help lldb#remote #@help lldb#remote
#@depends Debugger-rmi-trace
#@arg :file "Image" "The target binary executable image (a copy on the local system)" #@arg :file "Image" "The target binary executable image (a copy on the local system)"
#@env OPT_HOST:str="localhost" "Host" "The hostname of the 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_PORT:str="9999" "Port" "The host's listening port"
@@ -18,8 +19,8 @@
. ..\support\lldbsetuputils.ps1 . ..\support\lldbsetuputils.ps1
$pypathTrace = Ghidra-Module-PyPath "Debug/Debugger-rmi-trace" $pypathTrace = Ghidra-Module-PyPath "Debugger-rmi-trace"
$pypathLldb = Ghidra-Module-PyPath "Debug/Debugger-agent-lldb" $pypathLldb = Ghidra-Module-PyPath
$Env:PYTHONPATH = "$pypathLldb;$pypathTrace;$Env:PYTHONPATH" $Env:PYTHONPATH = "$pypathLldb;$pypathTrace;$Env:PYTHONPATH"
$arglist = Compute-Lldb-Remote-Args ` $arglist = Compute-Lldb-Remote-Args `
@@ -26,6 +26,7 @@
#@menu-group lldb #@menu-group lldb
#@icon icon.debugger #@icon icon.debugger
#@help lldb#remote #@help lldb#remote
#@depends Debugger-rmi-trace
#@arg :file "Image" "The target binary executable image (a copy on the local system)" #@arg :file "Image" "The target binary executable image (a copy on the local system)"
#@env OPT_HOST:str="localhost" "Host" "The hostname of the 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_PORT:str="9999" "Port" "The host's listening port"
@@ -34,8 +35,8 @@
. ../support/lldbsetuputils.sh . ../support/lldbsetuputils.sh
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace") pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
pypathLldb=$(ghidra-module-pypath "Debug/Debugger-agent-lldb") pypathLldb=$(ghidra-module-pypath)
export PYTHONPATH=$pypathLldb:$pypathTrace:$PYTHONPATH export PYTHONPATH=$pypathLldb:$pypathTrace:$PYTHONPATH
target_image="$1" target_image="$1"
@@ -1,4 +1,3 @@
#@timeout 60000
#@title lldb via ssh #@title lldb via ssh
#@image-opt arg:1 #@image-opt arg:1
#@desc <html><body width="300px"> #@desc <html><body width="300px">
@@ -11,6 +10,7 @@
#@menu-group lldb #@menu-group lldb
#@icon icon.debugger #@icon icon.debugger
#@help lldb#ssh #@help lldb#ssh
#@depends Debugger-rmi-trace
#@enum StartCmd:str "process launch" "process launch --stop-at-entry" #@enum StartCmd:str "process launch" "process launch --stop-at-entry"
#@enum Endian:str auto big little #@enum Endian:str auto big little
#@arg :str "Image" "The target binary executable image on the remote system" #@arg :str "Image" "The target binary executable image on the remote system"
@@ -60,7 +60,7 @@ finished, try launching again.
if ($answer) { if ($answer) {
Write-Host "Copying Wheels to $Env:OPT_HOST" Write-Host "Copying Wheels to $Env:OPT_HOST"
Mitigate-Scp-PyModules "Debug/Debugger-rmi-trace" "Debug/Debugger-agent-lldb" Mitigate-Scp-PyModules "Debugger-rmi-trace" "<SELF>"
Write-Host "Installing Wheels into LLDB's embedded Python" Write-Host "Installing Wheels into LLDB's embedded Python"
$arglist = Compute-Lldb-PipInstall-Args "'-f'" "os.environ['HOME']" "'ghidralldb>=$version'" $arglist = Compute-Lldb-PipInstall-Args "'-f'" "os.environ['HOME']" "'ghidralldb>=$version'"
@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
## ##
#@timeout 60000
#@title lldb via ssh #@title lldb via ssh
#@image-opt arg:1 #@image-opt arg:1
#@desc <html><body width="300px"> #@desc <html><body width="300px">
@@ -27,6 +26,7 @@
#@menu-group lldb #@menu-group lldb
#@icon icon.debugger #@icon icon.debugger
#@help lldb#ssh #@help lldb#ssh
#@depends Debugger-rmi-trace
#@enum StartCmd:str "process launch" "process launch --stop-at-entry" #@enum StartCmd:str "process launch" "process launch --stop-at-entry"
#@enum Endian:str auto big little #@enum Endian:str auto big little
#@arg :str "Image" "The target binary executable image on the remote system" #@arg :str "Image" "The target binary executable image on the remote system"
@@ -92,7 +92,7 @@ finished, try launching again.
" "Would you like to install 'ghidralldb>=$version'?"; then " "Would you like to install 'ghidralldb>=$version'?"; then
echo "Copying Wheels to $OPT_HOST" echo "Copying Wheels to $OPT_HOST"
mitigate-scp-pymodules "Debug/Debugger-rmi-trace" "Debug/Debugger-agent-lldb" mitigate-scp-pymodules "Debugger-rmi-trace" "<SELF>"
echo "Installing Wheels into LLDB's embedded Python" echo "Installing Wheels into LLDB's embedded Python"
do-installation do-installation
@@ -1,5 +1,5 @@
. ..\..\..\Debugger-rmi-trace\data\support\setuputils.ps1 . $Env:MODULE_Debugger_rmi_trace_HOME\data\support\setuputils.ps1
function Add-Lldb-Init-Args { function Add-Lldb-Init-Args {
param([ref]$ArgList) param([ref]$ArgList)
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
## ##
. ../../../Debugger-rmi-trace/data/support/setuputils.sh . $MODULE_Debugger_rmi_trace_HOME/data/support/setuputils.sh
add-lldb-init-args() { add-lldb-init-args() {
args+=(-o "version") args+=(-o "version")
@@ -86,8 +86,9 @@ public class JavaTraceRmiLaunchOffer extends AbstractScriptTraceRmiLaunchOffer {
} }
@Override @Override
protected void launchBackEnd(TaskMonitor monitor, Map<String, TerminalSession> sessions, protected TraceRmiBackEnd launchBackEnd(TaskMonitor monitor,
Map<String, ValStr<?>> args, SocketAddress address) throws Exception { Map<String, TerminalSession> sessions, Map<String, ValStr<?>> args,
SocketAddress address) throws Exception {
List<String> commandLine = new ArrayList<>(); List<String> commandLine = new ArrayList<>();
Map<String, String> env = new HashMap<>(System.getenv()); Map<String, String> env = new HashMap<>(System.getenv());
prepareSubprocess(commandLine, env, args, address); prepareSubprocess(commandLine, env, args, address);
@@ -101,18 +102,28 @@ public class JavaTraceRmiLaunchOffer extends AbstractScriptTraceRmiLaunchOffer {
sessions.put(ns.name(), ns); sessions.put(ns.name(), ns);
} }
TraceRmiBackEnd result = new TraceRmiBackEnd();
if (hasKeyReally(env, "OPT_JSHELL_PATH")) { if (hasKeyReally(env, "OPT_JSHELL_PATH")) {
String classPath = computeClassPath(env); String classPath = computeClassPath(env);
commandLine.add(0, "--startup"); commandLine.add(0, "--startup");
commandLine.add(0, "--class-path=" + classPath); commandLine.add(0, "--class-path=" + classPath);
commandLine.add(0, env.get("OPT_JSHELL_PATH")); commandLine.add(0, env.get("OPT_JSHELL_PATH"));
sessions.put("Shell", PtyTerminalSession session =
runInTerminal(commandLine, env, script.getParentFile(), sessions.values())); runInTerminal(commandLine, env, script.getParentFile(), sessions.values());
sessions.put("Shell", session);
session.terminal().addTerminalListener(result);
} }
else { else {
JdiClientThread thread = new JdiClientThread(env); JdiClientThread thread = new JdiClientThread(env) {
@Override
public void run() {
super.run();
result.terminated(0);
}
};
thread.start(); thread.start();
} }
return result;
} }
private String computeClassPath(Map<String, String> env) { private String computeClassPath(Map<String, String> env) {
@@ -30,14 +30,9 @@
#@env OPT_LANG:str="DATA:LE:64:default" "Ghidra Language" "The Ghidra LanguageID for the trace" #@env OPT_LANG:str="DATA:LE:64:default" "Ghidra Language" "The Ghidra LanguageID for the trace"
#@env OPT_COMP:str="pointer64" "Ghidra Compiler" "The Ghidra CompilerSpecID for the trace" #@env OPT_COMP:str="pointer64" "Ghidra Compiler" "The Ghidra CompilerSpecID for the trace"
if [ -d ${GHIDRA_HOME}/ghidra/.git ] . ../support/setuputils.sh
then
export PYTHONPATH=$GHIDRA_HOME/ghidra/Ghidra/Debug/Debugger-rmi-trace/build/pypkg/src:$PYTHONPATH pypathTrace=$(ghidra-module-pypath)
elif [ -d ${GHIDRA_HOME}/.git ] export PYTHONPATH=$pypathTrace:$PYTHONPATH
then
export PYTHONPATH=$GHIDRA_HOME/Ghidra/Debug/Debugger-rmi-trace/build/pypkg/src:$PYTHONPATH
else
export PYTHONPATH=$GHIDRA_HOME/Ghidra/Debug/Debugger-rmi-trace/pypkg/src:$PYTHONPATH
fi
"$OPT_PYTHON_EXE" -i ../support/raw-python3.py "$OPT_PYTHON_EXE" -i ../support/raw-python3.py
@@ -28,19 +28,17 @@ This file CANNOT be assumed to be available on a remote target. For
that, consider ghidratrace.setuputils. that, consider ghidratrace.setuputils.
""" """
import os import os
from typing import Optional
home = os.getenv('GHIDRA_HOME')
def ghidra_module_pypath(name: str) -> str: def ghidra_module_pypath(name: Optional[str]=None) -> str:
installed = f'{home}/Ghidra/{name}/pypkg/src' mod_home_name = 'MODULE_HOME' if name is None else f'MODULE_{name.replace("-","_")}_HOME'
mod_home = os.getenv(mod_home_name)
installed = f'{mod_home}/pypkg/src'
if os.path.isdir(installed): if os.path.isdir(installed):
return installed return installed
dev1 = f'{home}/Ghidra/{name}/build/pypkg/src' dev = f'{mod_home}/build/pypkg/src'
if os.path.isdir(dev1): if os.path.isdir(dev):
return dev1 return dev
dev2 = f'{home}/ghidra/Ghidra/{name}/build/pypkg/src'
if os.path.isdir(dev2):
return dev2
raise Exception( raise Exception(
f"Cannot find Python source for {name}. Try gradle assemblePyPackage?") f"Cannot find Python source for {name}. Try gradle assemblePyPackage?")

Some files were not shown because too many files have changed in this diff Show More