浏览代码

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.
Itamar 2 年之前
父节点
当前提交
ddec9cb1f0
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      Kernel/Thread.cpp

+ 2 - 0
Kernel/Thread.cpp

@@ -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;
     }