mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-02 08:18:58 +08:00
GP-6422: better event handling
This commit is contained in:
@@ -68,6 +68,8 @@ class ProcessState(object):
|
|||||||
commands.put_threads()
|
commands.put_threads()
|
||||||
self.threads = False
|
self.threads = False
|
||||||
thread = util.selected_thread()
|
thread = util.selected_thread()
|
||||||
|
if not thread.GetProcess().is_alive:
|
||||||
|
return
|
||||||
if thread is not None:
|
if thread is not None:
|
||||||
if first or thread.GetThreadID() not in self.visited:
|
if first or thread.GetThreadID() not in self.visited:
|
||||||
commands.put_frames()
|
commands.put_frames()
|
||||||
@@ -294,11 +296,14 @@ class EventThread(threading.Thread):
|
|||||||
if not rc:
|
if not rc:
|
||||||
print("add listener for process failed")
|
print("add listener for process failed")
|
||||||
|
|
||||||
# Not sure what effect this logic has
|
rc = listener.StartListeningForEventClass(
|
||||||
#cli.GetBroadcaster().AddInitialEventsToListener(listener, ALL_EVENTS)
|
util.get_debugger(), lldb.SBTarget.GetBroadcasterClassName(), ALL_EVENTS)
|
||||||
#target.GetBroadcaster().AddInitialEventsToListener(listener, ALL_EVENTS)
|
if not rc:
|
||||||
#proc.GetBroadcaster().AddInitialEventsToListener(listener, ALL_EVENTS)
|
print("add listener for targets failed")
|
||||||
|
rc = listener.StartListeningForEventClass(
|
||||||
|
util.get_debugger(), lldb.SBProcess.GetBroadcasterClassName(), ALL_EVENTS)
|
||||||
|
if not rc:
|
||||||
|
print("add listener for processes failed")
|
||||||
rc = listener.StartListeningForEventClass(
|
rc = listener.StartListeningForEventClass(
|
||||||
util.get_debugger(), lldb.SBThread.GetBroadcasterClassName(), ALL_EVENTS)
|
util.get_debugger(), lldb.SBThread.GetBroadcasterClassName(), ALL_EVENTS)
|
||||||
if not rc:
|
if not rc:
|
||||||
@@ -324,8 +329,6 @@ class EventThread(threading.Thread):
|
|||||||
print(e)
|
print(e)
|
||||||
event_recvd = True
|
event_recvd = True
|
||||||
proc = util.get_process()
|
proc = util.get_process()
|
||||||
if proc is not None and not proc.is_alive:
|
|
||||||
break
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@@ -493,8 +496,8 @@ def on_stop(event: lldb.SBEvent) -> bool:
|
|||||||
proc = lldb.SBProcess.GetProcessFromEvent(
|
proc = lldb.SBProcess.GetProcessFromEvent(
|
||||||
event) if event is not None else util.get_process()
|
event) if event is not None else util.get_process()
|
||||||
if proc.GetProcessID() not in PROC_STATE:
|
if proc.GetProcessID() not in PROC_STATE:
|
||||||
print("not in state")
|
enable_current_process()
|
||||||
return False
|
commands.put_processes()
|
||||||
trace = commands.STATE.trace
|
trace = commands.STATE.trace
|
||||||
if trace is None:
|
if trace is None:
|
||||||
print("no trace")
|
print("no trace")
|
||||||
|
|||||||
Reference in New Issue
Block a user