1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 12:00:49 +00:00

Kernel: Update registers in tracer when attaching to a stopped thread

This commit is contained in:
Itamar 2023-02-04 17:09:27 +02:00 committed by Andreas Kling
parent 0f3e1668bb
commit 7544b35694

View File

@ -56,7 +56,9 @@ static ErrorOr<FlatPtr> handle_ptrace(Kernel::Syscall::SC_ptrace_params const& p
}
TRY(peer_process.start_tracing_from(caller.pid()));
SpinlockLocker lock(peer->get_lock());
if (peer->state() != Thread::State::Stopped) {
if (peer->state() == Thread::State::Stopped) {
peer_process.tracer()->set_regs(peer->get_register_dump_from_stack());
} else {
peer->send_signal(SIGSTOP, &caller);
}
return 0;