mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +00:00
ptrace: Stop a traced thread when it exists from execve
This was a missing feature in the PT_TRACEME command. This feature allows the tracer to interact with the tracee before the tracee has started executing its program. It will be useful for automatically inserting a breakpoint at a debugged program's entry point.
This commit is contained in:
parent
4568a628f9
commit
0431712660
3 changed files with 58 additions and 16 deletions
|
@ -1243,6 +1243,13 @@ int Process::exec(String path, Vector<String> arguments, Vector<String> environm
|
|||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
if (m_wait_for_tracer_at_next_execve) {
|
||||
ASSERT(Thread::current->state() == Thread::State::Skip1SchedulerPass);
|
||||
// State::Skip1SchedulerPass is irrelevant since we block the thread
|
||||
Thread::current->set_state(Thread::State::Running);
|
||||
Thread::current->send_urgent_signal_to_self(SIGSTOP);
|
||||
}
|
||||
|
||||
if (Process::current == this) {
|
||||
Scheduler::yield();
|
||||
ASSERT_NOT_REACHED();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue