nommu: ptrace support
authorPaul Brook <paul@codesourcery.com>
Fri, 24 Jul 2009 11:34:58 +0000 (12:34 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 24 Jul 2009 11:34:58 +0000 (12:34 +0100)
The patch below adds ARM ptrace functions to get the process load address.
This is required for useful userspace debugging on mmuless systems.  These
values are obtained by reading magic offsets with PTRACE_PEEKUSR, as on other
nommu targets. I picked arbitrary large values for the offsets.

Signed-off-by: Paul Brook <paul@codesourcery.com>
arch/arm/include/asm/ptrace.h
arch/arm/kernel/ptrace.c

index 67b833c9b6b9cdb2d8784eb7e2e9ab97c10be082..bbecccda76d08560e6ef0200444fc3b3a4484118 100644 (file)
 #define PSR_ENDSTATE   0
 #endif
 
+/* 
+ * These are 'magic' values for PTRACE_PEEKUSR that return info about where a
+ * process is located in memory.
+ */
+#define PT_TEXT_ADDR           0x10000
+#define PT_DATA_ADDR           0x10004
+#define PT_TEXT_END_ADDR       0x10008
+
 #ifndef __ASSEMBLY__
 
 /*
index 89882a1d01874ca184ae6c48b59eb803b80deffa..a2ea3854cb3c8379120abaa94ab6c47fdc91ad67 100644 (file)
@@ -521,7 +521,13 @@ static int ptrace_read_user(struct task_struct *tsk, unsigned long off,
                return -EIO;
 
        tmp = 0;
-       if (off < sizeof(struct pt_regs))
+       if (off == PT_TEXT_ADDR)
+               tmp = tsk->mm->start_code;
+       else if (off == PT_DATA_ADDR)
+               tmp = tsk->mm->start_data;
+       else if (off == PT_TEXT_END_ADDR)
+               tmp = tsk->mm->end_code;
+       else if (off < sizeof(struct pt_regs))
                tmp = get_user_reg(tsk, off >> 2);
 
        return put_user(tmp, ret);
This page took 0.041902 seconds and 5 git commands to generate.