]> Zhao Yanbai Git Server - minix.git/commitdiff
added code for debugging pagefaults
authorBen Gras <ben@minix3.org>
Tue, 16 Dec 2008 14:33:53 +0000 (14:33 +0000)
committerBen Gras <ben@minix3.org>
Tue, 16 Dec 2008 14:33:53 +0000 (14:33 +0000)
include/minix/syslib.h
servers/vm/pagefaults.c

index d1be77cca09818a087e41aa1a38e76681e419f53..20a7649ba5eedebe0dc93647390fb3458823a545 100755 (executable)
@@ -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));
 
 
 
index ccfcb2036533bc994a7254779af2e30dc9660314..ddbe8ff68dfe887c8110e44686c72f94bd1d8d5a 100644 (file)
@@ -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;