From 3e698feebacf1860b0765c7e1a2a8c00178399b4 Mon Sep 17 00:00:00 2001 From: d-millar <33498836+d-millar@users.noreply.github.com> Date: Tue, 24 Feb 2026 14:49:19 -0500 Subject: [PATCH] GP-6478: fixes GP-6478: fixes --- .../src/main/py/src/ghidradrgn/commands.py | 13 +++++++------ .../src/main/py/src/ghidradrgn/util.py | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) 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.py index 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: ignore util.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: return nthrd = util.selected_thread() - if nthrd is None: + if nthrd is None or nthrd < 0: return thread = 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.py index 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.cli DrgnVersion = namedtuple('DrgnVersion', ['display', 'full']) -selected_pid = 0 -selected_tid = 0 -selected_level = 0 +selected_pid = -1 +selected_tid = -1 +selected_level = -1 def _compute_drgn_ver() -> DrgnVersion: