summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authordrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2006-08-06 11:20:42 +0000
committerdrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2006-08-06 11:20:42 +0000
commitfbf5bec7f3ea9f4a9584099a12e71681cb55ce35 (patch)
tree576fd656bbf5ba38fc42fbc99109a5082eed6887 /src/server
parent7d244761461701e1161df32c2f1d4cd50ae2bb26 (diff)
downloadopenocd_libswd-fbf5bec7f3ea9f4a9584099a12e71681cb55ce35.tar.gz
openocd_libswd-fbf5bec7f3ea9f4a9584099a12e71681cb55ce35.tar.bz2
openocd_libswd-fbf5bec7f3ea9f4a9584099a12e71681cb55ce35.tar.xz
openocd_libswd-fbf5bec7f3ea9f4a9584099a12e71681cb55ce35.zip
- 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
Diffstat (limited to 'src/server')
-rw-r--r--src/server/gdb_server.c22
1 files changed, 22 insertions, 0 deletions
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;
}