mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-03-06 13:35:03 +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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user