1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 14:10:45 +00:00

Kernel: Update stored registers in a thread's tracer on SIGSTOP

This is needed so we can retrieve the registers of a traced
thread that was attached to while it was running.

Attaching with ptrace to a running thread sends SIGSTOP to it.
This commit is contained in:
Itamar 2023-02-04 16:57:45 +02:00 committed by Andreas Kling
parent 7544b35694
commit ddec9cb1f0

View File

@ -958,6 +958,8 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal)
auto* tracer = process.tracer();
if (signal == SIGSTOP || (tracer && default_signal_action(signal) == DefaultSignalAction::DumpCore)) {
dbgln_if(SIGNAL_DEBUG, "Signal {} stopping this thread", signal);
if (tracer)
tracer->set_regs(get_register_dump_from_stack());
set_state(Thread::State::Stopped, signal);
return DispatchSignalResult::Yield;
}