read mem mAA..AA,LLLL AA..AA is address, LLLL is length.
write mem MAA..AA,LLLL:XX..XX
AA..AA is address,
LLLL is number of bytes,
XX..XX is data
continue cAA.AA AA..AA is address to resume
IF AA..AA is omitted
resume at same address.
step sAA..AA AA..AA is address to resume
If AA..AA is omitted,
resume at same address.
kill request k
last signal ? Reply the current reason for stopping.
This is the same reply as is generated
for step or cont : SAA where AA is the
signal number.
toggle debug d toggle debug flag (see 386 & 68k stubs)
All other commands will be ignored... too bad 'search' isn't implemented.
The protocol is simple, quoting remote.c comments:
A debug packet whose contents are <data> is encapsulated for transmission in the form.
$ <data> # CSUM1 CSUM2
<data> must be ASCII alphanumeric and cannot include characters
'$' or '#'. If <data> starts with two characters followed by
':', then the existing stubs interpret this as a sequence number.
CSUM1 and CSUM2 are ascii hex representation of an 8-bit checksum of <data>, the most significant nibble is sent first.
the hex digits 0-9,a-f are used.
Before trying to make gdb work i wrote a little program that computed the right checksum:
#include <stdio.h>
unsigned char const hexchars[] = "0123456789abcdef";
char tohexchar (unsigned char c)
{
c &= 0x0f;
return(hexchars[c]);
}
int main(int argc, char **argv)
{
unsigned char checksum;
int count;
char *command;
char ch;
if (argc <= 1)
exit(1);
printf("gdb protocol command: ");
command = argv[1];
putchar ('$');
checksum = count = 0;
while ((ch = command[count]))
{
putchar(ch);
checksum += ch;
count++;
}
putchar('#');
putchar(tohexchar(checksum >> 4));
putchar(tohexchar(checksum));
putchar(' ');
}
./gdbproto g
gdb protocol command: $g#67
now paste that on the |||| prompt and you get register output:
sce