mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-07 00:19:27 +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:
parent
7544b35694
commit
ddec9cb1f0
|
@ -958,6 +958,8 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal)
|
||||||
auto* tracer = process.tracer();
|
auto* tracer = process.tracer();
|
||||||
if (signal == SIGSTOP || (tracer && default_signal_action(signal) == DefaultSignalAction::DumpCore)) {
|
if (signal == SIGSTOP || (tracer && default_signal_action(signal) == DefaultSignalAction::DumpCore)) {
|
||||||
dbgln_if(SIGNAL_DEBUG, "Signal {} stopping this thread", signal);
|
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);
|
set_state(Thread::State::Stopped, signal);
|
||||||
return DispatchSignalResult::Yield;
|
return DispatchSignalResult::Yield;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue