summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
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;
}