-
Notifications
You must be signed in to change notification settings - Fork 4
/
ignore_signals.py
28 lines (24 loc) · 992 Bytes
/
ignore_signals.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import lldb
import threading
class ProcessEventListener(threading.Thread):
def __init__(self, debugger):
super(ProcessEventListener, self).__init__()
self._listener = debugger.GetListener()
self._debugger = debugger
self._interpreter = debugger.GetCommandInterpreter()
self._handled = set()
def _suppress_signals(self, process):
signals = process.GetUnixSignals()
signals.SetShouldStop(11, False)
def run(self):
while True:
event = lldb.SBEvent()
if not self._listener.PeekAtNextEvent(event):
continue
process = self._interpreter.GetProcess()
if process and not process.GetUniqueID() in self._handled:
self._suppress_signals(process)
self._handled.add(process.GetUniqueID())
def __lldb_init_module(debugger, *rest):
listener_thread = ProcessEventListener(debugger)
listener_thread.start()