From: Ben Gras Date: Tue, 16 Dec 2008 14:33:53 +0000 (+0000) Subject: added code for debugging pagefaults X-Git-Tag: v3.1.4~171 X-Git-Url: http://zhaoyanbai.com/repos/?a=commitdiff_plain;h=710f44c4b89c2dcbfa695e67f2cf9a4f3fcf1666;p=minix.git added code for debugging pagefaults --- diff --git a/include/minix/syslib.h b/include/minix/syslib.h index d1be77cca..20a7649ba 100755 --- a/include/minix/syslib.h +++ b/include/minix/syslib.h @@ -54,7 +54,7 @@ _PROTOTYPE( int sys_vmctl_get_pagefault_i386, (endpoint_t *who, u32_t *cr2, u32_ _PROTOTYPE( int sys_vmctl_get_cr3_i386, (endpoint_t who, u32_t *cr3) ); _PROTOTYPE( int sys_vmctl_get_memreq, (endpoint_t *who, vir_bytes *mem, vir_bytes *len, int *wrflag) ); -_PROTOTYPE( int sys_vmctl_stacktrace(endpoint_t who)); +_PROTOTYPE( int sys_vmctl_stacktrace, (endpoint_t who)); diff --git a/servers/vm/pagefaults.c b/servers/vm/pagefaults.c index ccfcb2036..ddbe8ff68 100644 --- a/servers/vm/pagefaults.c +++ b/servers/vm/pagefaults.c @@ -70,8 +70,9 @@ PUBLIC void handle_pagefaults(void) /* See if address is valid at all. */ if(!(region = map_lookup(vmp, addr))) { vm_assert(PFERR_NOPAGE(err)); - printf("VM: SIGSEGV %d bad addr 0x%lx %s\n", + printf("VM: pagefault: SIGSEGV %d bad addr 0x%lx %s\n", ep, arch_map2vir(vmp, addr), pf_errstr(err)); + sys_vmctl_stacktrace(vmp->vm_endpoint); if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK) vm_panic("sys_kill failed", s); continue; @@ -84,8 +85,9 @@ PUBLIC void handle_pagefaults(void) /* If process was writing, see if it's writable. */ if(!(region->flags & VR_WRITABLE) && wr) { - printf("VM: SIGSEGV %d ro map 0x%lx %s\n", + printf("VM: pagefault: SIGSEGV %d ro map 0x%lx %s\n", ep, arch_map2vir(vmp, addr), pf_errstr(err)); + sys_vmctl_stacktrace(vmp->vm_endpoint); if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK) vm_panic("sys_kill failed", s); continue; @@ -96,7 +98,8 @@ PUBLIC void handle_pagefaults(void) /* Access is allowed; handle it. */ if((r=map_pagefault(vmp, region, offset, wr)) != OK) { - printf("VM: SIGSEGV %d pagefault not handled\n", ep); + printf("VM: pagefault: SIGSEGV %d pagefault not handled\n", ep); + sys_vmctl_stacktrace(vmp->vm_endpoint); if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK) vm_panic("sys_kill failed", s); continue;