mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 02:09:44 +02:00
GP-4620: Fix process termination (esp., on kill)
This commit is contained in:
parent
587307eefe
commit
121608aeea
3 changed files with 10 additions and 1 deletions
|
@ -41,6 +41,10 @@ def main():
|
||||||
from ghidradbg import commands as cmd
|
from ghidradbg import commands as cmd
|
||||||
from ghidradbg.util import dbg
|
from ghidradbg.util import dbg
|
||||||
|
|
||||||
|
# So that the user can re-enter by typing repl()
|
||||||
|
global repl
|
||||||
|
repl = cmd.repl
|
||||||
|
|
||||||
cmd.ghidra_trace_connect(os.getenv('GHIDRA_TRACE_RMI_ADDR'))
|
cmd.ghidra_trace_connect(os.getenv('GHIDRA_TRACE_RMI_ADDR'))
|
||||||
args = os.getenv('OPT_TARGET_ARGS')
|
args = os.getenv('OPT_TARGET_ARGS')
|
||||||
if args:
|
if args:
|
||||||
|
|
|
@ -27,6 +27,7 @@ from ghidratrace.client import Client, Address, AddressRange, TraceObject
|
||||||
from pybag import pydbg, userdbg, kerneldbg
|
from pybag import pydbg, userdbg, kerneldbg
|
||||||
from pybag.dbgeng import core as DbgEng
|
from pybag.dbgeng import core as DbgEng
|
||||||
from pybag.dbgeng import exception
|
from pybag.dbgeng import exception
|
||||||
|
from pybag.dbgeng.win32.kernel32 import STILL_ACTIVE
|
||||||
|
|
||||||
from . import util, arch, methods, hooks
|
from . import util, arch, methods, hooks
|
||||||
from .dbgmodel.imodelobject import ModelObjectKind
|
from .dbgmodel.imodelobject import ModelObjectKind
|
||||||
|
@ -841,6 +842,9 @@ def ghidra_trace_disassemble(address):
|
||||||
|
|
||||||
@util.dbg.eng_thread
|
@util.dbg.eng_thread
|
||||||
def compute_proc_state(nproc=None):
|
def compute_proc_state(nproc=None):
|
||||||
|
exit_code = util.GetExitCode()
|
||||||
|
if exit_code is not None and exit_code != STILL_ACTIVE:
|
||||||
|
return 'TERMINATED'
|
||||||
status = util.dbg._base._control.GetExecutionStatus()
|
status = util.dbg._base._control.GetExecutionStatus()
|
||||||
if status == DbgEng.DEBUG_STATUS_BREAK:
|
if status == DbgEng.DEBUG_STATUS_BREAK:
|
||||||
return 'STOPPED'
|
return 'STOPPED'
|
||||||
|
|
|
@ -268,7 +268,8 @@ def on_process_selected():
|
||||||
@log_errors
|
@log_errors
|
||||||
def on_process_deleted(*args):
|
def on_process_deleted(*args):
|
||||||
# print("ON_PROCESS_DELETED")
|
# print("ON_PROCESS_DELETED")
|
||||||
proc = args[0]
|
exit_code = args[0]
|
||||||
|
proc = util.selected_process()
|
||||||
on_exited(proc)
|
on_exited(proc)
|
||||||
if proc in PROC_STATE:
|
if proc in PROC_STATE:
|
||||||
del PROC_STATE[proc]
|
del PROC_STATE[proc]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue