RE: GDB and gdbserver for CR16 target

Kaushik Phatak
2011-12-19T11:56:14Z

Hi,
Thanks for the reply.

>> PTRACE_PEEKUSER is defined in <sys/ptrace.h>.
The default includes from sys seems to generate errors,
linux-low.c:545:15: error: 'PTRACE_ATTACH' undeclared (first use in this function)
linux-low.c:814:11: error: 'PTRACE_DETACH' undeclared (first use in this function)

Also, the ptrace.h that seemed to get included from "runtime/usr/include/asm/"
contains definitions,
#define PTRACE_GETREGS 15
#define PTRACE_SETREGS 16
These were conflicting with /sys/ptrace.h definitions.
Commenting these out, and then including the <sys/ptrace.h> seemed to build
the linux-low.c file.

However, at link time it tried to pass the options "-rdynamic". Can this be
removed safely as this toolchain does not understand this option?

Thanks and Best Regards,
Kaushik Phatak
www.kpitgnutools.com

-----Original Message-----
From: Kaushik Phatak
Sent: 13 December 2011 18:26
To: 'gdb@sourceware.org'
Subject: GDB and gdbserver for CR16 target

Hi,
We are currently adding a GDB port for the CR16 target architecture.
The run simulator port for CR16 is already present in the main line.
Currently, we have build a basic GDB that would work along with sim and we are trying
to build the GDB server for cr16-uclinux-gcc but I am facing some issues.

I have changed #include <sys/ptrace.h> to #include <linux/ptrace.h> which contains
defines for ptrace system calls.
I am getting following errors while compiling linux-low.c
linux-low.c:2171:10: error: 'PTRACE_PEEKUSER' undeclared (first use in this function)
linux-low.c:2244:12: error: 'PTRACE_POKEUSER' undeclared (first use in this function)

The ptrace.h file contains similar definitions,
#define PTRACE_PEEKUSR 3
#define PTRACE_POKEUSR 6
Is this like a typo or am I including the incorrect file?

Any pointers would be very much appreciated.