GP-0: test errors

This commit is contained in:
d-millar
2025-03-28 20:08:45 +00:00
parent b319b3df7f
commit e19ff2a739
3 changed files with 16 additions and 12 deletions
@@ -267,10 +267,10 @@ def ghidra_trace_create(start_trace: bool = True) -> None:
global prog
prog = Program()
kind = os.getenv('OPT_TARGET_KIND')
img = os.getenv('OPT_TARGET_IMG')
if kind == "kernel":
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:
@@ -287,14 +287,15 @@ def ghidra_trace_create(start_trace: bool = True) -> None:
except drgn.MissingDebugInfoError as e:
print(e)
if kind == "kernel":
img = prog.main_module().name # type: ignore
util.selected_tid = next(prog.threads()).tid
elif kind == "coredump":
util.selected_tid = prog.crashed_thread().tid
else:
img = prog.main_module().name # type: ignore
util.selected_tid = prog.main_thread().tid
if hasattr(drgn, 'Module') or kind == "coredump":
if kind == "kernel":
img = prog.main_module().name # type: ignore
util.selected_tid = next(prog.threads()).tid
elif kind == "coredump":
util.selected_tid = prog.crashed_thread().tid
else:
img = prog.main_module().name # type: ignore
util.selected_tid = prog.main_thread().tid
if start_trace and img is not None:
ghidra_trace_start(img)
@@ -23,7 +23,12 @@ from typing import Annotated, Any, Dict, Optional, Tuple
import drgn
import drgn.cli
from drgn import Module, StackFrame # type: ignore
from drgn import StackFrame
try:
from drgn import Module # type: ignore
except Exception as e:
class Module:
pass # not supported on older versions
from ghidratrace import sch
from ghidratrace.client import (
@@ -628,8 +628,6 @@ def putreg(frame: gdb.Frame, reg_descs: Sequence[
cobj.insert()
mapper = trace.extra.require_rm()
gdb.write(f"---Register Mapper: {mapper}---\n")
keys = []
values = []
# NB: This command will fail if the process is running