RE: GDB and gdbserver for CR16 target

Kaushik Phatak
2011-12-22T13:07:21Z

Hi,
Continuing with our efforts on the addition of GDB and gdbserver for CR16.

The gdb, running on the host seems to be connecting to the gdbserver as expected.
However, the gdbserver terminates with "Signal 127".
I have added --debug to the gdbserver parameters and "set debug remote 1" to the
gdb host side which gives me some logs. My PC value reads 0xFFFFFFFF which may
be the problem but I am not sure.
Below are the logs from gdbserver side and gdb side. Any inputs as to why the
server exits would be very much appreciated.
Thanks!

gdbserver logs:
# ./gdbserver --debug :2345 test.out
Process test.out created; pid = 105
linux_wait: [Process 105]
linux_wait_for_lwp: <all threads>
my_waitpid (-1, 0x40000000)
blocking
sigchld_handler
my_waitpid (-1, 0x1): status(57f), 105
Got an event from 105 (57f)
stop pc is ffffffff
linux_wait_for_lwp: pc is 0xffffffff
stop pc is ffffffff
stop pc is 0xffffffff
Hit a non-gdbserver breakpoint.
linux_wait ret = LWP 105.105, 1, 5
Listening on port 2345
Remote debugging from host IPADDR
handling possible serial event
Signal 127
# exit

gdb host side log:
(gdb) set debug remote 1
(gdb) target remote IPADDR:2345
Remote debugging using IPADDR:2345
Sending packet: $qSupported#37...Ack
Packet received: PacketSize=3fff;QPassSignals+;qXfer:libraries:read+;qXfer:auxv: read+;qXfer:spu:read+;qXfer:spu:write+;qXfer:siginfo:read+;qXfer:siginfo:write+; qXfer:features:read+;QStartNoAckMode+;qXfer:osdata:read+;multiprocess+;QNonStop+
;qXfer:threads:read+
Packet qSupported (supported-packets) is supported
Sending packet: $QStartNoAckMode#b0...Ack
Packet received: OK
Sending packet: $Hg0#df...Packet received: OK
Sending packet: $qXfer:features:read:target.xml:0,fff#7d...Packet received: E00
Sending packet: $QNonStop:0#8c...Packet received: OK
Sending packet: $?#3f...Packet received: T050f:ffffffff;0e:ffffffff;10:ffffffff;
thread:69;core:0;
Sending packet: $Hc-1#09...Packet received: E01
Sending packet: $qC#b4...Packet received: QC69
Sending packet: $qAttached#8f...Packet received: 0
Packet qAttached (query-attached) is supported
Sending packet: $qOffsets#4b...Packet received: E01
warning: Remote failure reply: E01
0xffffffff in ?? ()
Sending packet: $qSymbol::#5b...Packet received: qSymbol:5f5f707468726561645f746
872656164735f6576656e7473
Packet qSymbol (symbol-lookup) is supported
Sending packet: $qSymbol::5f5f707468726561645f746872656164735f6576656e7473#47...
Packet received: OK
(gdb)

Thanks & Best Regards,
Kaushik Phatak

-----Original Message-----
From: Kaushik Phatak
Sent: 19 December 2011 17:26
To: 'gdb@sourceware.org'
Cc: 'yao@codesourcery.com'
Subject: RE: GDB and gdbserver for CR16 target

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?