summaryrefslogtreecommitdiff
path: root/src/debug/remgdb/stream.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-07-29 00:02:49 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-07-29 00:02:49 (GMT)
commit73af1bd66e5d1a2e30d56151532710f2b28d12df (patch)
tree88f98194359accd8349193f4cbe3c4cabee24d23 /src/debug/remgdb/stream.c
parentf150f36ee0297b4499a41bbbfc06699cd2f72db5 (diff)
Improved the GDB client.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@175 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/debug/remgdb/stream.c')
-rw-r--r--src/debug/remgdb/stream.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/src/debug/remgdb/stream.c b/src/debug/remgdb/stream.c
index 2b487ad..0f17930 100644
--- a/src/debug/remgdb/stream.c
+++ b/src/debug/remgdb/stream.c
@@ -41,6 +41,9 @@ static void g_gdb_stream_class_init(GGdbStreamClass *);
/* Initialise une instance de flux de communication avec GDB. */
static void g_gdb_stream_init(GGdbStream *);
+/* Envoie un acquittement pour la dernière réception. */
+static bool gdb_stream_ack(GGdbStream *);
+
/* Ecoute une connexion à un serveur GDB. */
static void *gdb_stream_thread(GGdbStream *);
@@ -124,6 +127,37 @@ bool g_gdb_stream_listen(GGdbStream *stream)
* *
* Paramètres : stream = encadrement associée à l'opération. *
* *
+* Description : Envoie un acquittement pour la dernière réception. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool gdb_stream_ack(GGdbStream *stream)
+{
+ bool result; /* Bilan à retourner */
+ GGdbPacket *packet; /* Paquet à envoyer */
+
+ packet = g_gdb_stream_get_free_packet(stream);
+
+ g_gdb_packet_start_new_command(packet);
+ g_gdb_packet_append(packet, "+");
+
+ result = g_gdb_stream_send_packet(stream, packet);
+
+ g_gdb_stream_mark_packet_as_free(stream, packet);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : stream = encadrement associée à l'opération. *
+* *
* Description : Ecoute une connexion à un serveur GDB. *
* *
* Retour : ??? *
@@ -145,6 +179,8 @@ static void *gdb_stream_thread(GGdbStream *stream)
ret = select(stream->fd + 1, &rfds, NULL, NULL, NULL);
+ printf("ret :: %d\n", ret);
+
switch (ret)
{
case -1:
@@ -162,6 +198,11 @@ static void *gdb_stream_thread(GGdbStream *stream)
if (g_gdb_stream_read_packet(stream, packet))
{
+ /* Acquittement */
+ if (!gdb_stream_ack(stream)) goto bad_recv;
+
+ /* On conserve le résultat */
+
g_mutex_lock(stream->recv_mutex);
g_gdb_packet_push(&stream->recv_packets, packet);
g_mutex_unlock(stream->recv_mutex);
@@ -169,7 +210,12 @@ static void *gdb_stream_thread(GGdbStream *stream)
g_cond_signal(stream->recv_cond);
}
- else g_gdb_stream_mark_packet_as_free(stream, packet);
+
+ bad_recv:
+
+ printf("bad things happend...\n");
+
+ g_gdb_stream_mark_packet_as_free(stream, packet);
break;