From fbf5bec7f3ea9f4a9584099a12e71681cb55ce35 Mon Sep 17 00:00:00 2001 From: drath Date: Sun, 6 Aug 2006 11:20:42 +0000 Subject: - fixed a minor problem with the GDB server that could drop the first packet (non-fatal) - fixed some small memory leaks (thanks to Spencer Oliver) - verify chip- and buswidth of cfi flash configurations - added support for ARM966E based systems (tested only with ST micro STR9, thanks to Spencer Oliver) git-svn-id: svn://svn.berlios.de/openocd/trunk@81 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/server/gdb_server.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/server/gdb_server.c') diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 4b99922c..c0a2fe84 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -138,6 +138,23 @@ int gdb_get_char(connection_t *connection, int* next_char) return ERROR_OK; } +int gdb_putback_char(connection_t *connection, int last_char) +{ + gdb_connection_t *gdb_con = connection->priv; + + if (gdb_con->buf_p > gdb_con->buffer) + { + *(--gdb_con->buf_p) = last_char; + gdb_con->buf_cnt++; + } + else + { + ERROR("BUG: couldn't put character back"); + } + + return ERROR_OK; +} + int gdb_put_packet(connection_t *connection, char *buffer, int len) { int i; @@ -219,6 +236,8 @@ int gdb_get_packet(connection_t *connection, char *buffer, int *len) if ((retval = gdb_get_char(connection, &character)) != ERROR_OK) return retval; + DEBUG("character: '%c'", character); + switch (character) { case '$': @@ -427,6 +446,9 @@ int gdb_new_connection(connection_t *connection) if ((retval = gdb_get_char(connection, &initial_ack)) != ERROR_OK) return retval; + if (initial_ack != '+') + gdb_putback_char(connection, initial_ack); + return ERROR_OK; } -- cgit v1.2.3