If the current thread has the trap bit set (i.e. a debugger had

single stepped the process to the system call), we need to clear
the trap flag from the new frame. Otherwise, the new thread will
receive a (likely unexpected) SIGTRAP when it executes the first
instruction after returning to userland.
This commit is contained in:
David Xu 2008-10-05 02:03:54 +00:00
parent 73254c9ee7
commit 7ce5e15ebe
2 changed files with 16 additions and 0 deletions

View File

@ -280,6 +280,14 @@ cpu_set_upcall(struct thread *td, struct thread *td0)
*/
bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe));
/* If the current thread has the trap bit set (i.e. a debugger had
* single stepped the process to the system call), we need to clear
* the trap flag from the new frame. Otherwise, the new thread will
* receive a (likely unexpected) SIGTRAP when it executes the first
* instruction after returning to userland.
*/
td->td_frame->tf_rflags &= ~PSL_T;
/*
* Set registers for trampoline to user mode. Leave space for the
* return address on stack. These are the kernel mode register values.

View File

@ -412,6 +412,14 @@ cpu_set_upcall(struct thread *td, struct thread *td0)
*/
bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe));
/* If the current thread has the trap bit set (i.e. a debugger had
* single stepped the process to the system call), we need to clear
* the trap flag from the new frame. Otherwise, the new thread will
* receive a (likely unexpected) SIGTRAP when it executes the first
* instruction after returning to userland.
*/
td->td_frame->tf_eflags &= ~PSL_T;
/*
* Set registers for trampoline to user mode. Leave space for the
* return address on stack. These are the kernel mode register values.