diff options
author | Sandra Loosemore <sandra@codesourcery.com> | 2008-08-12 15:18:31 +0000 |
---|---|---|
committer | Sandra Loosemore <sandra@codesourcery.com> | 2008-08-12 15:18:31 +0000 |
commit | a6f3e723d387ad5292f1a7519e5204d53510d081 (patch) | |
tree | 990e72f8cdb78dab49f48a6c5e8eb0f4382a96f9 /gdb/gdbserver | |
parent | b099ab9fcd00257ccf077d30a327a719edd940e6 (diff) | |
download | gdb-a6f3e723d387ad5292f1a7519e5204d53510d081.zip gdb-a6f3e723d387ad5292f1a7519e5204d53510d081.tar.gz gdb-a6f3e723d387ad5292f1a7519e5204d53510d081.tar.bz2 |
gdb/doc/
2008-08-12 Sandra Loosemore <sandra@codesourcery.com>
* gdb.texinfo (Remote Configuration): Document set remote noack-packet.
(Remote Protocol): Add Packet Acknowledgment to menu.
(Overview): Mention +/- can be disabled, and point to new section
where this is discussed in detail.
(General Query Packets): Document QStartNoAckMode packet, and
corresponding qSupported reply.
(Packet Acknowledgment): New section.
gdb/
2008-08-12 Pedro Alves <pedro@codesourcery.com>
Add no-ack mode to the remote protocol --- optionally stop ACKing
packets and responses when we have a reliable communication
medium.
Based on Apple's GDB, by Jason Molenda <jmolenda@apple.com>
* remote.c (struct remote_state): Add noack_mode field.
(PACKET_QStartNoAckMode): New.
(remote_start_remote): Don't any outstanding packet here.
(remote_open_1): Clear noack_mode. Ack any outstanding packet
here. Activate noack mode if requested.
(remote_protocol_features): Add QStartNoAckMode.
(remote_open_1):
(putpkt_binary): Don't send ack in noack mode.
(read_frame): Don't recompute the checksum in noack mode.
(getpkt_sane): Skip sending ack if in noack mode.
(_initialize_remote): Add set/show remote noack mode.
* NEWS: Note the new features.
gdb/gdbserver/
2008-08-12 Pedro Alves <pedro@codesourcery.com>
* remote-utils.c (noack_mode, transport_is_reliable): New globals.
(remote_open): Set or clear transport_is_reliable.
(putpkt_binary): Don't expect acks in noack mode.
(getpkt): Don't send ack/nac in noack mode.
* server.c (handle_general_set): Handle QStartNoAckMode.
(handle_query): If connected by tcp pass QStartNoAckMode+ in
qSupported.
(main): Reset noack_mode on every connection.
* server.h (noack_mode): Declare.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 12 | ||||
-rw-r--r-- | gdb/gdbserver/remote-utils.c | 49 | ||||
-rw-r--r-- | gdb/gdbserver/server.c | 16 | ||||
-rw-r--r-- | gdb/gdbserver/server.h | 2 |
4 files changed, 70 insertions, 9 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 8e61981..a4ea4be 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,15 @@ +2008-08-12 Pedro Alves <pedro@codesourcery.com> + + * remote-utils.c (noack_mode, transport_is_reliable): New globals. + (remote_open): Set or clear transport_is_reliable. + (putpkt_binary): Don't expect acks in noack mode. + (getpkt): Don't send ack/nac in noack mode. + * server.c (handle_general_set): Handle QStartNoAckMode. + (handle_query): If connected by tcp pass QStartNoAckMode+ in + qSupported. + (main): Reset noack_mode on every connection. + * server.h (noack_mode): Declare. + 2008-08-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> * Makefile.in (GDBREPLAY_OBS): New variable. diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index e062be8..b5665f5 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -99,6 +99,11 @@ static int remote_desc = INVALID_DESCRIPTOR; extern int using_threads; extern int debug_threads; +/* If true, then GDB has requested noack mode. */ +int noack_mode = 0; +/* If true, then we tell GDB to use noack mode by default. */ +int transport_is_reliable = 0; + #ifdef USE_WIN32API # define read(fd, buf, len) recv (fd, (char *) buf, len, 0) # define write(fd, buf, len) send (fd, (char *) buf, len, 0) @@ -181,6 +186,8 @@ remote_open (char *name) fprintf (stderr, "Remote debugging using %s\n", name); #endif /* USE_WIN32API */ + + transport_is_reliable = 0; } else { @@ -267,6 +274,8 @@ remote_open (char *name) /* Convert IP address to string. */ fprintf (stderr, "Remote debugging from host %s\n", inet_ntoa (sockaddr.sin_addr)); + + transport_is_reliable = 1; } #if defined(F_SETFL) && defined (FASYNC) @@ -551,6 +560,17 @@ putpkt_binary (char *buf, int cnt) return -1; } + if (noack_mode) + { + /* Don't expect an ack then. */ + if (remote_debug) + { + fprintf (stderr, "putpkt (\"%s\"); [noack mode]\n", buf2); + fflush (stderr); + } + break; + } + if (remote_debug) { fprintf (stderr, "putpkt (\"%s\"); [looking for ack]\n", buf2); @@ -774,23 +794,34 @@ getpkt (char *buf) if (csum == (c1 << 4) + c2) break; + if (noack_mode) + { + fprintf (stderr, "Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s [no-ack-mode, Bad medium?]\n", + (c1 << 4) + c2, csum, buf); + /* Not much we can do, GDB wasn't expecting an ack/nac. */ + break; + } + fprintf (stderr, "Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s\n", (c1 << 4) + c2, csum, buf); write (remote_desc, "-", 1); } - if (remote_debug) + if (!noack_mode) { - fprintf (stderr, "getpkt (\"%s\"); [sending ack] \n", buf); - fflush (stderr); - } + if (remote_debug) + { + fprintf (stderr, "getpkt (\"%s\"); [sending ack] \n", buf); + fflush (stderr); + } - write (remote_desc, "+", 1); + write (remote_desc, "+", 1); - if (remote_debug) - { - fprintf (stderr, "[sent ack]\n"); - fflush (stderr); + if (remote_debug) + { + fprintf (stderr, "[sent ack]\n"); + fflush (stderr); + } } return bp - buf; diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 1fa1694..60df3d8 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -270,6 +270,19 @@ handle_general_set (char *own_buf) return; } + if (strcmp (own_buf, "QStartNoAckMode") == 0) + { + if (remote_debug) + { + fprintf (stderr, "[noack mode enabled]\n"); + fflush (stderr); + } + + noack_mode = 1; + write_ok (own_buf); + return; + } + /* Otherwise we didn't know what packet it was. Say we didn't understand it. */ own_buf[0] = 0; @@ -777,6 +790,8 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) qXfer:feature:read at all, we will never be re-queried. */ strcat (own_buf, ";qXfer:features:read+"); + if (transport_is_reliable) + strcat (own_buf, ";QStartNoAckMode+"); return; } @@ -1447,6 +1462,7 @@ main (int argc, char *argv[]) while (1) { + noack_mode = 0; remote_open (port); restart: diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h index b519696..817b5c4 100644 --- a/gdb/gdbserver/server.h +++ b/gdb/gdbserver/server.h @@ -175,6 +175,8 @@ extern void hostio_last_error_from_errno (char *own_buf); extern int remote_debug; extern int all_symbols_looked_up; +extern int noack_mode; +extern int transport_is_reliable; int putpkt (char *buf); int putpkt_binary (char *buf, int len); |