2005-05-29 17:01:38 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Copyright 2002, Manuel J. Petit. All rights reserved.
|
|
|
|
* Distributed under the terms of the NewOS License.
|
|
|
|
*/
|
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
/* Contains the code to interface with a remote GDB */
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <vm.h>
|
|
|
|
#include <smp.h>
|
|
|
|
#include <debug.h>
|
|
|
|
#include <gdb.h>
|
|
|
|
#include <arch/dbg_console.h>
|
|
|
|
|
|
|
|
|
2005-05-29 17:01:38 +04:00
|
|
|
enum { INIT = 0, CMDREAD, CKSUM1, CKSUM2, WAITACK, QUIT, GDBSTATES };
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
|
|
|
|
static char cmd[512];
|
2005-05-29 17:01:38 +04:00
|
|
|
static int cmd_ptr;
|
|
|
|
static int checksum;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
static char reply[512];
|
|
|
|
|
|
|
|
static char safe_mem[512];
|
|
|
|
|
|
|
|
|
2005-05-29 17:01:38 +04:00
|
|
|
// utility functions
|
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
static int
|
2002-07-09 16:24:59 +04:00
|
|
|
parse_nibble(int input)
|
|
|
|
{
|
2004-06-01 02:49:06 +04:00
|
|
|
int nibble = 0xff;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
if (input >= '0' && input <= '9')
|
|
|
|
nibble = input - '0';
|
|
|
|
|
|
|
|
if (input >= 'A' && input <= 'F')
|
|
|
|
nibble = 0x0a + input - 'A';
|
|
|
|
|
|
|
|
if (input >= 'a' && input <= 'f')
|
|
|
|
nibble = 0x0a + input - 'a';
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
return nibble;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-05-29 17:01:38 +04:00
|
|
|
// #pragma mark - GDB protocol
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static void
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_ack(void)
|
|
|
|
{
|
2005-05-29 17:01:38 +04:00
|
|
|
debug_putchar('+');
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static void
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_nak(void)
|
|
|
|
{
|
2005-05-29 17:01:38 +04:00
|
|
|
debug_putchar('-');
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static void
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_resend_reply(void)
|
|
|
|
{
|
2005-05-29 17:01:38 +04:00
|
|
|
debug_puts(reply);
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static void
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_reply(char const *fmt, ...)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int len;
|
|
|
|
int sum;
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start(args, fmt);
|
2004-06-01 02:49:06 +04:00
|
|
|
reply[0] = '$';
|
|
|
|
vsprintf(reply + 1, fmt, args);
|
2002-07-09 16:24:59 +04:00
|
|
|
va_end(args);
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
len = strlen(reply);
|
|
|
|
sum = 0;
|
|
|
|
for (i = 1; i < len; i++) {
|
|
|
|
sum += reply[i];
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|
2004-06-01 02:49:06 +04:00
|
|
|
sum %= 256;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
sprintf(reply + len, "#%02x", sum);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
gdb_resend_reply();
|
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static void
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_regreply(int const *regs, int numregs)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int len;
|
|
|
|
int sum;
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
reply[0] = '$';
|
|
|
|
for (i = 0; i < numregs; i++) {
|
|
|
|
sprintf(reply+1+8*i, "%08lx", B_HOST_TO_BENDIAN_INT32(regs[i]));
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
len = strlen(reply);
|
|
|
|
sum = 0;
|
|
|
|
for (i = 1; i < len; i++) {
|
|
|
|
sum += reply[i];
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|
2004-06-01 02:49:06 +04:00
|
|
|
sum %= 256;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
sprintf(reply + len, "#%02x", sum);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
gdb_resend_reply();
|
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static void
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_memreply(char const *bytes, int numbytes)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int len;
|
|
|
|
int sum;
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
reply[0] = '$';
|
|
|
|
for (i = 0; i < numbytes; i++) {
|
|
|
|
sprintf(reply+1+2*i, "%02x", (uint8)bytes[i]);
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
len = strlen(reply);
|
|
|
|
sum = 0;
|
|
|
|
for (i = 1; i < len; i++) {
|
|
|
|
sum += reply[i];
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|
2004-06-01 02:49:06 +04:00
|
|
|
sum %= 256;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
sprintf(reply + len, "#%02x", sum);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
gdb_resend_reply();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-05-29 17:01:38 +04:00
|
|
|
// #pragma mark - checksum verification
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static int
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_verify_checksum(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int len;
|
|
|
|
int sum;
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
len = strlen(cmd);
|
|
|
|
sum = 0;
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
sum += cmd[i];
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|
2004-06-01 02:49:06 +04:00
|
|
|
sum %= 256;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
return (sum == checksum) ? 1 : 0;
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-05-29 17:01:38 +04:00
|
|
|
// #pragma mark - command parsing
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static int
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_parse_command(void)
|
|
|
|
{
|
2004-06-01 02:49:06 +04:00
|
|
|
if (!gdb_verify_checksum()) {
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_nak();
|
|
|
|
return INIT;
|
2004-06-01 02:49:06 +04:00
|
|
|
} else
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_ack();
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
switch (cmd[0]) {
|
2002-07-09 16:24:59 +04:00
|
|
|
case 'H':
|
2004-06-01 02:49:06 +04:00
|
|
|
/*
|
|
|
|
* Command H (actually Hct) is used to select
|
|
|
|
* the current thread (-1 meaning all threads)
|
|
|
|
* We just fake we recognize the the command
|
|
|
|
* and send an 'OK' response.
|
|
|
|
*/
|
|
|
|
gdb_reply("OK");
|
|
|
|
break;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
case 'q':
|
|
|
|
{
|
|
|
|
extern unsigned __data_start;
|
|
|
|
extern unsigned __bss_start;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* There are several q commands:
|
|
|
|
*
|
|
|
|
* qXXXX Request info about XXXX.
|
|
|
|
* QXXXX=yyyy Set value of XXXX to yyyy.
|
|
|
|
* qOffsets Get segment offsets
|
|
|
|
*
|
|
|
|
* Currently we only support the 'qOffsets'
|
|
|
|
* form.
|
|
|
|
*
|
|
|
|
* *Note* that we actually have to lie,
|
|
|
|
* At first thought looks like we should
|
|
|
|
* return '_start', '__data_start' &
|
|
|
|
* '__bss_start', however gdb gets
|
|
|
|
* confused because the kernel link script
|
|
|
|
* pre-links at 0x80000000. To keep gdb
|
|
|
|
* gdb happy we just substract that amount.
|
|
|
|
*/
|
2004-06-01 02:49:06 +04:00
|
|
|
if (strcmp(cmd+1, "Offsets") == 0) {
|
|
|
|
gdb_reply("Text=%x;Data=%x;Bss=%x", 0,
|
2002-07-09 16:24:59 +04:00
|
|
|
((unsigned)(&__data_start))-0x80000000,
|
2004-06-01 02:49:06 +04:00
|
|
|
((unsigned)(&__bss_start))-0x80000000);
|
|
|
|
} else
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_reply("ENS");
|
2004-06-01 02:49:06 +04:00
|
|
|
}
|
|
|
|
break;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
case '?':
|
2004-06-01 02:49:06 +04:00
|
|
|
/*
|
|
|
|
* command '?' is used for retrieving the signal
|
|
|
|
* that stopped the program. Fully implemeting
|
|
|
|
* this command requires help from the debugger,
|
|
|
|
* by now we just fake a SIGKILL
|
|
|
|
*/
|
|
|
|
gdb_reply("S09"); /* SIGKILL = 9 */
|
|
|
|
break;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
case 'g':
|
|
|
|
{
|
|
|
|
int cpu;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* command 'g' is used for reading the register
|
|
|
|
* file. Faked by now.
|
|
|
|
*
|
|
|
|
* For x86 the register order is:
|
|
|
|
*
|
|
|
|
* eax, ebx, ecx, edx,
|
|
|
|
* esp, ebp, esi, edi,
|
|
|
|
* eip, eflags,
|
|
|
|
* cs, ss, ds, es
|
|
|
|
*
|
|
|
|
* Note that even thought the segment descriptors
|
|
|
|
* are actually 16 bits wide, gdb requires them
|
|
|
|
* as 32 bit integers. Note also that for some
|
|
|
|
* reason (unknown to me) gdb wants the register
|
|
|
|
* dump in *big endian* format.
|
|
|
|
*/
|
2004-06-01 02:49:06 +04:00
|
|
|
cpu = smp_get_current_cpu();
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_regreply(dbg_register_file[cpu], 14);
|
2004-06-01 02:49:06 +04:00
|
|
|
}
|
|
|
|
break;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
case 'm':
|
|
|
|
{
|
|
|
|
char *ptr;
|
|
|
|
unsigned address;
|
|
|
|
unsigned len;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The 'm' command has the form mAAA,LLL
|
|
|
|
* where AAA is the address and LLL is the
|
|
|
|
* number of bytes.
|
|
|
|
*/
|
2004-06-01 02:49:06 +04:00
|
|
|
ptr = cmd+1;
|
|
|
|
address = 0;
|
|
|
|
len = 0;
|
|
|
|
while (ptr && *ptr && (*ptr != ',')) {
|
|
|
|
address <<= 4;
|
|
|
|
address += parse_nibble(*ptr);
|
|
|
|
ptr += 1;
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|
2004-06-01 02:49:06 +04:00
|
|
|
if (*ptr == ',')
|
2002-07-09 16:24:59 +04:00
|
|
|
ptr+= 1;
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
while (ptr && *ptr) {
|
|
|
|
len <<= 4;
|
|
|
|
len += parse_nibble(*ptr);
|
|
|
|
ptr += 1;
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
if (len> 128)
|
|
|
|
len = 128;
|
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
/*
|
|
|
|
* We cannot directly access the requested memory
|
|
|
|
* for gdb may be trying to access an stray pointer
|
|
|
|
* We copy the memory to a safe buffer using
|
|
|
|
* the bulletproof user_memcpy().
|
|
|
|
*/
|
2004-06-01 02:49:06 +04:00
|
|
|
if (user_memcpy(safe_mem, (char *)address, len) < 0)
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_reply("E02");
|
2004-06-01 02:49:06 +04:00
|
|
|
else
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_memreply(safe_mem, len);
|
2004-06-01 02:49:06 +04:00
|
|
|
}
|
|
|
|
break;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
case 'k':
|
2004-06-01 02:49:06 +04:00
|
|
|
/*
|
|
|
|
* Command 'k' actual semantics is 'kill the damn thing'.
|
|
|
|
* However gdb sends that command when you disconnect
|
|
|
|
* from a debug session. I guess that 'kill' for the
|
|
|
|
* kernel would map to reboot... however that's a
|
|
|
|
* a very mean thing to do, instead we just quit
|
|
|
|
* the gdb state machine and fallback to the regular
|
|
|
|
* kernel debugger command prompt.
|
|
|
|
*/
|
|
|
|
return QUIT;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
default:
|
2004-06-01 02:49:06 +04:00
|
|
|
gdb_reply("E01");
|
|
|
|
break;
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return WAITACK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-05-29 17:01:38 +04:00
|
|
|
// #pragma mark - protocol state machine
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static int
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_init_handler(int input)
|
|
|
|
{
|
2004-06-01 02:49:06 +04:00
|
|
|
switch (input) {
|
2002-07-09 16:24:59 +04:00
|
|
|
case '$':
|
|
|
|
memset(cmd, 0, sizeof(cmd));
|
2004-06-01 02:49:06 +04:00
|
|
|
cmd_ptr = 0;
|
2002-07-09 16:24:59 +04:00
|
|
|
return CMDREAD;
|
2004-06-01 02:49:06 +04:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
default:
|
|
|
|
#if 0
|
|
|
|
gdb_nak();
|
|
|
|
#else
|
|
|
|
/*
|
|
|
|
* looks to me like we should send
|
|
|
|
* a NAK here but it kinda works
|
|
|
|
* better if we just gobble all
|
|
|
|
* junk chars silently
|
|
|
|
*/
|
|
|
|
#endif
|
|
|
|
return INIT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static int
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_cmdread_handler(int input)
|
|
|
|
{
|
2004-06-01 02:49:06 +04:00
|
|
|
switch (input) {
|
2002-07-09 16:24:59 +04:00
|
|
|
case '#':
|
|
|
|
return CKSUM1;
|
2004-06-01 02:49:06 +04:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
default:
|
2004-06-01 02:49:06 +04:00
|
|
|
cmd[cmd_ptr] = input;
|
|
|
|
cmd_ptr += 1;
|
2002-07-09 16:24:59 +04:00
|
|
|
return CMDREAD;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static int
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_cksum1_handler(int input)
|
|
|
|
{
|
2004-06-01 02:49:06 +04:00
|
|
|
int nibble = parse_nibble(input);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
if (nibble == 0xff) {
|
2002-07-09 16:24:59 +04:00
|
|
|
#if 0
|
|
|
|
gdb_nak();
|
|
|
|
return INIT;
|
|
|
|
#else
|
|
|
|
/*
|
|
|
|
* looks to me like we should send
|
|
|
|
* a NAK here but it kinda works
|
|
|
|
* better if we just gobble all
|
|
|
|
* junk chars silently
|
|
|
|
*/
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
checksum = nibble << 4;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
return CKSUM2;
|
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static int
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_cksum2_handler(int input)
|
|
|
|
{
|
2004-06-01 02:49:06 +04:00
|
|
|
int nibble = parse_nibble(input);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
if (nibble == 0xff) {
|
2002-07-09 16:24:59 +04:00
|
|
|
#if 0
|
|
|
|
gdb_nak();
|
|
|
|
return INIT;
|
|
|
|
#else
|
|
|
|
/*
|
|
|
|
* looks to me like we should send
|
|
|
|
* a NAK here but it kinda works
|
|
|
|
* better if we just gobble all
|
|
|
|
* junk chars silently
|
|
|
|
*/
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
checksum += nibble;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
return gdb_parse_command();
|
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static int
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_waitack_handler(int input)
|
|
|
|
{
|
2004-06-01 02:49:06 +04:00
|
|
|
switch (input) {
|
2002-07-09 16:24:59 +04:00
|
|
|
case '+':
|
|
|
|
return INIT;
|
|
|
|
case '-':
|
|
|
|
gdb_resend_reply();
|
|
|
|
return WAITACK;
|
2004-06-01 02:49:06 +04:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
default:
|
|
|
|
/*
|
|
|
|
* looks like gdb and us are out of synch,
|
|
|
|
* send a NAK and retry from INIT state.
|
|
|
|
*/
|
|
|
|
gdb_nak();
|
|
|
|
return INIT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static int
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_quit_handler(int input)
|
|
|
|
{
|
|
|
|
(void)(input);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* actually we should never be here
|
|
|
|
*/
|
|
|
|
return QUIT;
|
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static int (*dispatch_table[GDBSTATES])(int) = {
|
2002-07-09 16:24:59 +04:00
|
|
|
&gdb_init_handler,
|
|
|
|
&gdb_cmdread_handler,
|
|
|
|
&gdb_cksum1_handler,
|
|
|
|
&gdb_cksum2_handler,
|
|
|
|
&gdb_waitack_handler,
|
|
|
|
&gdb_quit_handler
|
|
|
|
};
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static int
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_state_dispatch(int curr, int input)
|
|
|
|
{
|
2004-06-01 02:49:06 +04:00
|
|
|
if (curr < INIT || curr >= GDBSTATES)
|
2002-07-09 16:24:59 +04:00
|
|
|
return QUIT;
|
|
|
|
|
|
|
|
return dispatch_table[curr](input);
|
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
|
|
|
static int
|
2002-07-09 16:24:59 +04:00
|
|
|
gdb_state_machine(void)
|
|
|
|
{
|
2004-06-01 02:49:06 +04:00
|
|
|
int state = INIT;
|
2002-07-09 16:24:59 +04:00
|
|
|
int c;
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
while (state != QUIT) {
|
2005-05-29 17:01:38 +04:00
|
|
|
c = arch_debug_serial_getchar();
|
2004-06-01 02:49:06 +04:00
|
|
|
state = gdb_state_dispatch(state, c);
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-06-01 02:49:06 +04:00
|
|
|
|
2002-07-18 02:07:37 +04:00
|
|
|
int
|
2002-07-09 16:24:59 +04:00
|
|
|
cmd_gdb(int argc, char **argv)
|
|
|
|
{
|
|
|
|
(void)(argc);
|
|
|
|
(void)(argv);
|
|
|
|
|
2002-07-18 02:07:37 +04:00
|
|
|
return gdb_state_machine();
|
2002-07-09 16:24:59 +04:00
|
|
|
}
|