* Improved some output and coding style.
* If a segment violation occurs, we do now check whether the thread in question has a handler for SIGSEGV. If so, we just send it the signal. Otherwise we notify the debugger as before. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26851 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -4113,10 +4113,13 @@ vm_page_fault(addr_t address, addr_t faultAddress, bool isWrite, bool isUser,
|
|||||||
// fault and someone is already waiting for a write lock on the same address
|
// fault and someone is already waiting for a write lock on the same address
|
||||||
// space. This thread will then try to acquire the semaphore again and will
|
// space. This thread will then try to acquire the semaphore again and will
|
||||||
// be queued after the writer.
|
// be queued after the writer.
|
||||||
dprintf("vm_page_fault: sending team \"%s\" 0x%lx SIGSEGV, ip %#lx (\"%s\" +%#lx)\n",
|
struct thread *thread = thread_get_current_thread();
|
||||||
thread_get_current_thread()->team->name,
|
dprintf("vm_page_fault: thread \"%s\" (%ld) in team \"%s\" (%ld) "
|
||||||
thread_get_current_thread()->team->id, faultAddress,
|
"tried to %s address %#lx, ip %#lx (\"%s\" +%#lx)\n",
|
||||||
area ? area->name : "???", faultAddress - (area ? area->base : 0x0));
|
thread->name, thread->id, thread->team->name, thread->team->id,
|
||||||
|
isWrite ? "write" : "read", address, faultAddress,
|
||||||
|
area ? area->name : "???",
|
||||||
|
faultAddress - (area ? area->base : 0x0));
|
||||||
|
|
||||||
// We can print a stack trace of the userland thread here.
|
// We can print a stack trace of the userland thread here.
|
||||||
#if 1
|
#if 1
|
||||||
@@ -4171,12 +4174,21 @@ vm_page_fault(addr_t address, addr_t faultAddress, bool isWrite, bool isUser,
|
|||||||
rw_lock_read_unlock(&addressSpace->lock);
|
rw_lock_read_unlock(&addressSpace->lock);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct thread *thread = thread_get_current_thread();
|
|
||||||
// TODO: the fault_callback is a temporary solution for vm86
|
// TODO: the fault_callback is a temporary solution for vm86
|
||||||
if (thread->fault_callback == NULL
|
if (thread->fault_callback == NULL
|
||||||
|| thread->fault_callback(address, faultAddress, isWrite)) {
|
|| thread->fault_callback(address, faultAddress, isWrite)) {
|
||||||
if (user_debug_exception_occurred(B_SEGMENT_VIOLATION, SIGSEGV))
|
// If the thread has a signal handler for SIGSEGV we simply send
|
||||||
send_signal(team_get_current_team_id(), SIGSEGV);
|
// it the signal. Otherwise we notify the user debugger. If
|
||||||
|
// anything goes wrong, we kill the team.
|
||||||
|
struct sigaction action;
|
||||||
|
if (sigaction(SIGSEGV, NULL, &action) == 0
|
||||||
|
&& action.sa_handler != SIG_DFL
|
||||||
|
&& action.sa_handler != SIG_IGN) {
|
||||||
|
send_signal(thread->id, SIGSEGV);
|
||||||
|
} else if (user_debug_exception_occurred(B_SEGMENT_VIOLATION,
|
||||||
|
SIGSEGV)) {
|
||||||
|
send_signal(team_get_current_team_id(), SIGKILL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user