[PATCH] uml: improve stub debugging
authorJeff Dike <jdike@addtoit.com>
Mon, 7 Nov 2005 08:58:45 +0000 (00:58 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 7 Nov 2005 15:53:30 +0000 (07:53 -0800)
Add some more debugging information when a stub does something unexpected,
usually segfaulting.  Now, it dumps out the stub's registers as well as the
signal.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/um/kernel/skas/process.c

index 5cd0e992978969c8d076b3fd9ce4fd0fe9d3a4c1..42f2da687dc83a782ce360376457b0c347ec29c7 100644 (file)
@@ -69,6 +69,17 @@ void wait_stub_done(int pid, int sig, char * fname)
 
         if((n < 0) || !WIFSTOPPED(status) ||
            (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){
+               unsigned long regs[FRAME_SIZE];
+               if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
+                       printk("Failed to get registers from stub, "
+                              "errno = %d\n", errno);
+               else {
+                       int i;
+
+                       printk("Stub registers -\n");
+                       for(i = 0; i < FRAME_SIZE; i++)
+                               printk("\t%d - %lx\n", i, regs[i]);
+               }
                 panic("%s : failed to wait for SIGUSR1/SIGTRAP, "
                       "pid = %d, n = %d, errno = %d, status = 0x%x\n",
                       fname, pid, n, errno, status);