Ghidra is a software reverse engineering (SRE) framework
GP-6478: fixes GP-6478: fixes
d-millar3e698feebacf
diff --git a/Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/commands.py b/Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/commands.pyindex 1112c65f0f..85eff127a1 100644--- a/Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/commands.py+++ b/Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/commands.py@@ -271,10 +271,11 @@ def ghidra_trace_create(start_trace: bool = True) -> None:prog.set_kernel()elif kind == "coredump":img = os.getenv('OPT_TARGET_IMG')- if img is not None:- prog.set_core_dump(img)- if '/' in img:- img = img[img.rindex('/')+1:]+ if img is None:+ return+ prog.set_core_dump(img)+ if '/' in img:+ img = img[img.rindex('/')+1:]else:pid = os.getenv('OPT_TARGET_PID')if pid is not None:@@ -297,7 +298,7 @@ def ghidra_trace_create(start_trace: bool = True) -> None:img = prog.main_module().name # type: ignoreutil.selected_tid = prog.main_thread().tid- if start_trace and img is not None:+ if start_trace:ghidra_trace_start(img)PROGRAMS[util.selected_pid] = prog@@ -1146,7 +1147,7 @@ def put_frames() -> None:if nproc < 0:returnnthrd = util.selected_thread()- if nthrd is None:+ if nthrd is None or nthrd < 0:returnthread = prog.thread(nthrd)if thread is None:diff --git a/Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/util.py b/Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/util.pyindex 902e3eed70..d308bb9a1f 100644--- a/Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/util.py+++ b/Ghidra/Debug/Debugger-agent-drgn/src/main/py/src/ghidradrgn/util.py@@ -26,9 +26,9 @@ import drgn.cliDrgnVersion = namedtuple('DrgnVersion', ['display', 'full'])-selected_pid = 0-selected_tid = 0-selected_level = 0+selected_pid = -1+selected_tid = -1+selected_level = -1def _compute_drgn_ver() -> DrgnVersion: