Don't accept this as much more than a hint patch ... its not submitted
yet - but this is all what I did to extend the SH kernel and gdbserver.
--
Hope it helps.
Kieran Bingham
On Fri, 2008-04-11 at 14:39 +0200, Markus Franke wrote:
> Zitat von Kieran Bingham <[EMAIL PROTECTED]>:
> > I've been talking to one of the GDB dev's on IRC, and he's pointed me
> > towards gdb-6.7.1/gdb/gdbserver/linux-low.c
> >
> > the part that does the offsets is in linux_read_offsets(). If it doesn't
> > have the correct values defined for PTrace to obtain them, then you'll
> > probably have to find them out yourself, or as it was in my case, extend
> > the kernel implementation for PTrace to support the required
> > PT_TEXT_ADDR PT_TEXT_END_ADDR and PT_DATA_ADDR.
> >
> > I've done this now, and it lets me load as normal without playing around
>
> Well, I guess I'll have to extend the kernel implementation in
> "arch/m68knommu/ptrace.c" as well. As far as I can see there is
> nothing mentioned about PT_TEXT_ADDR, PT_TEXT_END_ADDR or
> PT_DATA_ADDR. I had a look
> at "arch/v850/kernel/ptrace.c:arch_ptrace()". Seems like that the
> above mentioned functionality is implemented there. Any hints how I
> can do this for my arch?
>
> Best Regards,
> Markus
>
>
Index: arch/sh/kernel/ptrace.c
===================================================================
--- arch/sh/kernel/ptrace.c (revision 364)
+++ arch/sh/kernel/ptrace.c (working copy)
@@ -113,8 +113,17 @@
[(addr - (long)&dummy->fpu) >> 2];
} else if (addr == (long) &dummy->u_fpvalid)
tmp = !!tsk_used_math(child);
- else
- tmp = 0;
+ else if ( addr == PT_TEXT_ADDR )
+ tmp = child->mm->start_code;
+ else if ( addr == PT_DATA_ADDR )
+ tmp = child->mm->start_data;
+ else if ( addr == PT_TEXT_END_ADDR )
+ tmp = child->mm->end_code;
+ else if ( addr == PT_TEXT_LEN )
+ tmp = child->mm->end_code - child->mm->start_code;
+ else
+ tmp = 0;
+
ret = put_user(tmp, (unsigned long *)data);
break;
}
Index: include/asm-sh/ptrace.h
===================================================================
--- include/asm-sh/ptrace.h (revision 364)
+++ include/asm-sh/ptrace.h (working copy)
@@ -44,6 +45,12 @@
#define REG_FPSCR 55
#define REG_FPUL 56
+/* Values chosen to fit case statement and be outside of userspace. */
+#define PT_TEXT_ADDR 60 * 4
+#define PT_TEXT_END_ADDR 61 * 4
+#define PT_TEXT_LEN 62 * 4
+#define PT_DATA_ADDR 63 * 4
+
/* options set using PTRACE_SETOPTIONS */
#define PTRACE_O_TRACESYSGOOD 0x00000001
Index: a/gdb-6.7.1/gdb/gdbserver/linux-low.c
===================================================================
--- a.orig/gdb-6.7.1/gdb/gdbserver/linux-low.c 2008-04-11 09:50:38.000000000 +0100
+++ a/gdb-6.7.1/gdb/gdbserver/linux-low.c 2008-04-11 09:49:47.000000000 +0100
@@ -1661,6 +1661,13 @@
#define PT_TEXT_END_ADDR 51*4
#endif
+/* Values chosen to fit case statement and be outside of userspace. */
+#define PT_TEXT_ADDR 60 * 4
+#define PT_TEXT_END_ADDR 61 * 4
+#define PT_TEXT_LEN 62 * 4
+#define PT_DATA_ADDR 63 * 4
+
+
/* Under uClinux, programs are loaded at non-zero offsets, which we need
to tell gdb about. */
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev