mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-22 06:42:56 +08:00
GP-0: test errors
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user