gdb: support async interrupt (ctrl-c) to break into a running guest · qilingframework/qiling@aa0f7f3 · GitHub
Skip to content

Commit aa0f7f3

Browse files
retrocpugeekclaude
andcommitted
gdb: support async interrupt (ctrl-c) to break into a running guest
The stub drove continue by calling emu_start synchronously and only read the socket again once the target stopped on its own, so the bare \x03 break byte a client sends to pause a running target was never seen. A guest that free-runs (e.g. an idle/event loop) could not be interrupted at all -- gdb/Ghidra reported 'Cannot execute this command while the target is running'. Poll the client socket for the break byte from the per-instruction run hook (dbg_hook), which does run on the emulation thread during emu_start: - GdbSerialConn.poll_interrupt(): non-blocking select+recv, True on \x03. - QlGdbUtils.dbg_hook: throttled (every INTR_POLL_INTERVAL insns) check of an installed check_interrupt callback; on a break, stop emulation and record it. - handle_c: reply SIGINT when the stop was an interrupt rather than a breakpoint or normal exit. Verified against a free-running MIPS64 BE guest: \x03 -> S02 in <1ms; the existing gdb-stub regression test still passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent b3fa0a2 commit aa0f7f3

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎qiling/debugger/gdb/utils.py‎

Lines changed: 8 additions & 0 deletions

0 commit comments

Comments
 (0)