diff options
author | Malfurious <m@lfurio.us> | 2023-09-29 21:45:07 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2024-04-24 13:31:08 -0400 |
commit | d6add3a39a71081efe8b5b45ba2ed8a4f5075969 (patch) | |
tree | 09df32410887a50b9bc2b4e96dc4f15b4771bb38 /debugger.c | |
parent | 66c02b503ac283506eabfcb943b4247ee6efc7b5 (diff) | |
download | misplays-d6add3a39a71081efe8b5b45ba2ed8a4f5075969.tar.gz misplays-d6add3a39a71081efe8b5b45ba2ed8a4f5075969.zip |
Prevent lingering traps after detach
There can sometimes be a pending SIGTRAP when we resume a thread. This
is usually due to interrupting a hung single-step. If this trap is hit
after the debugger leaves, the original process will crash. This is a
quick workaround to attempt to consume such traps ourselves before
detaching.
Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'debugger.c')
-rw-r--r-- | debugger.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -289,6 +289,9 @@ struct process *dbg_attach(pid_t pid, int child) { int dbg_detach(struct process *proc) { interrupt_all_threads(proc); + dbg_realcont(proc->threads.head); + usleep(100000); + interrupt_all_threads(proc); uninstall_breakpoints(proc->threads.head); free_breakpoints(proc); |