Skip to content

Instantly share code, notes, and snippets.

@eblot
Created March 12, 2026 16:18
Show Gist options
  • Select an option

  • Save eblot/ca7cf368ce5d6aece5e99c2b63bd1f63 to your computer and use it in GitHub Desktop.

Select an option

Save eblot/ca7cf368ce5d6aece5e99c2b63bd1f63 to your computer and use it in GitHub Desktop.
LLDB config w/ QEMU
import lldb
import threading
import time
from signal import SIGUSR2
class UnixSignalDisabler(threading.Thread):
def __init__(self, debugger):
super(UnixSignalDisabler, self).__init__()
self._debugger = debugger
self._handled = set()
def _suppress_signals(self, process):
print("UnixSignalDisabler: disabling SIGUSR2 in process #" + str(process.GetUniqueID()))
signals = process.GetUnixSignals()
signals.SetShouldStop(SIGUSR2.value, False) # SIGSEGV
def run(self):
while True:
for target in self._debugger:
if target:
process = target.GetProcess()
if process and not process.GetUniqueID() in self._handled:
self._suppress_signals(process)
self._handled.add(process.GetUniqueID())
# Don't hog CPU
time.sleep(0.03)
def __lldb_init_module(debugger, *rest):
# Can't use 'debugger' reference directly because it gets deleted after calling '__lldb_init_module'
debugger = lldb.SBDebugger.FindDebuggerWithID(debugger.GetID())
listener_thread = UnixSignalDisabler(debugger)
listener_thread.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment