Print stacktrace when a system service fails or when a core dump has to be generated for a user process.
This commit is contained in:
parent
436d6012a3
commit
ef95bf1bb9
4 changed files with 17 additions and 5 deletions
|
@ -84,6 +84,7 @@ typedef unsigned long sigset_t;
|
|||
|| sig == SIGEMT || sig == SIGABRT)
|
||||
#define SIGS_IS_TERMINATION(sig) (SIGS_IS_LETHAL(sig) \
|
||||
|| (sig == SIGKILL || sig == SIGPIPE))
|
||||
#define SIGS_IS_STACKTRACE(sig) (SIGS_IS_LETHAL(sig) && sig != SIGABRT)
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -364,6 +364,12 @@ int ksig; /* non-zero means signal comes from kernel */
|
|||
sys_kill(rmp->mp_endpoint, signo);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Print stacktrace if necessary. */
|
||||
if(SIGS_IS_STACKTRACE(signo)) {
|
||||
sys_sysctl_stacktrace(rmp->mp_endpoint);
|
||||
}
|
||||
|
||||
if(!SIGS_IS_TERMINATION(signo)) {
|
||||
/* Translate every non-termination sys signal into a message. */
|
||||
message m;
|
||||
|
@ -443,8 +449,11 @@ int signo; /* signal that caused termination */
|
|||
{
|
||||
rmp->mp_sigstatus = (char) signo;
|
||||
if (sigismember(&core_sset, signo)) {
|
||||
printf("PM: coredump signal %d for %d / %s\n", signo, rmp->mp_pid,
|
||||
rmp->mp_name);
|
||||
if(!(rmp->mp_flags & PRIV_PROC)) {
|
||||
printf("PM: coredump signal %d for %d / %s\n", signo,
|
||||
rmp->mp_pid, rmp->mp_name);
|
||||
sys_sysctl_stacktrace(rmp->mp_endpoint);
|
||||
}
|
||||
exit_proc(rmp, 0, TRUE /*dump_core*/);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -521,6 +521,11 @@ PRIVATE int sef_cb_signal_manager(endpoint_t target, int signo)
|
|||
printf("RS: %s got %s signal %d\n", srv_to_string(rp),
|
||||
SIGS_IS_TERMINATION(signo) ? "termination" : "non-termination",signo);
|
||||
|
||||
/* Print stacktrace if necessary. */
|
||||
if(SIGS_IS_STACKTRACE(signo)) {
|
||||
sys_sysctl_stacktrace(target);
|
||||
}
|
||||
|
||||
/* In case of termination signal handle the event. */
|
||||
if(SIGS_IS_TERMINATION(signo)) {
|
||||
rp->r_flags |= RS_TERMINATED;
|
||||
|
|
|
@ -73,7 +73,6 @@ PUBLIC void do_pagefaults(void)
|
|||
vm_assert(PFERR_NOPAGE(err));
|
||||
printf("VM: pagefault: SIGSEGV %d bad addr 0x%lx %s\n",
|
||||
ep, arch_map2vir(vmp, addr), pf_errstr(err));
|
||||
sys_sysctl_stacktrace(vmp->vm_endpoint);
|
||||
if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK)
|
||||
panic("sys_kill failed: %d", s);
|
||||
if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, r)) != OK)
|
||||
|
@ -95,7 +94,6 @@ PUBLIC void do_pagefaults(void)
|
|||
if(!(region->flags & VR_WRITABLE) && wr) {
|
||||
printf("VM: pagefault: SIGSEGV %d ro map 0x%lx %s\n",
|
||||
ep, arch_map2vir(vmp, addr), pf_errstr(err));
|
||||
sys_sysctl_stacktrace(vmp->vm_endpoint);
|
||||
if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK)
|
||||
panic("sys_kill failed: %d", s);
|
||||
if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, r)) != OK)
|
||||
|
@ -109,7 +107,6 @@ PUBLIC void do_pagefaults(void)
|
|||
/* Access is allowed; handle it. */
|
||||
if((r=map_pf(vmp, region, offset, wr)) != OK) {
|
||||
printf("VM: pagefault: SIGSEGV %d pagefault not handled\n", ep);
|
||||
sys_sysctl_stacktrace(vmp->vm_endpoint);
|
||||
if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK)
|
||||
panic("sys_kill failed: %d", s);
|
||||
if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, r)) != OK)
|
||||
|
|
Loading…
Reference in a new issue