This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit,6.0] Call error, not warning, when a bad T packet
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 29 Jun 2003 17:22:15 -0400
- Subject: [commit,6.0] Call error, not warning, when a bad T packet
Hello,
This is a simple way fixing PR 340:
http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=340
The packet wasn't so much too long as corrupt:
T0505:000000002b0000002b0
should have been:
T0505:000000002;NN:b0000002 ...
The attached changes the warnings into errors. If the remote end can't
generate correctly formatted packets, things are pretty much sunk :-(
committed to 6.0 and mainline,
Andrew
2003-06-29 Andrew Cagney <cagney@redhat.com>
* remote.c (remote_wait): Call error, and not warning, when the
packet is corrupt.
(remote_async_wait): Ditto.
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.107
diff -u -r1.107 remote.c
--- remote.c 17 Jun 2003 20:28:13 -0000 1.107
+++ remote.c 29 Jun 2003 21:14:20 -0000
@@ -3024,14 +3024,12 @@
p = p1;
if (*p++ != ':')
- warning ("Malformed packet(b) (missing colon): %s\n\
-Packet: '%s'\n",
- p, buf);
+ error ("Malformed packet(b) (missing colon): %s\nPacket: '%s'\n",
+ p, buf);
if (reg == NULL)
- warning ("Remote sent bad register number %s: %s\n\
-Packet: '%s'\n",
- phex_nz (pnum, 0), p, buf);
+ error ("Remote sent bad register number %s: %s\nPacket: '%s'\n",
+ phex_nz (pnum, 0), p, buf);
fieldsize = hex2bin (p, regs, REGISTER_RAW_SIZE (reg->regnum));
p += 2 * fieldsize;
@@ -3041,10 +3039,7 @@
}
if (*p++ != ';')
- {
- warning ("Remote register badly formatted: %s", buf);
- warning (" here: %s", p);
- }
+ error ("Remote register badly formatted: %s\nhere: %s", buf, p);
}
}
/* fall through */
@@ -3247,9 +3242,8 @@
{
p1 = (unsigned char *) strchr (p, ':');
if (p1 == NULL)
- warning ("Malformed packet(a) (missing colon): %s\n\
-Packet: '%s'\n",
- p, buf);
+ error ("Malformed packet(a) (missing colon): %s\nPacket: '%s'\n",
+ p, buf);
if (strncmp (p, "thread", p1 - p) == 0)
{
p_temp = unpack_varlen_hex (++p1, &thread_num);
@@ -3278,14 +3272,12 @@
struct packet_reg *reg = packet_reg_from_pnum (rs, pnum);
p = p1;
if (*p++ != ':')
- warning ("Malformed packet(b) (missing colon): %s\n\
-Packet: '%s'\n",
- p, buf);
+ error ("Malformed packet(b) (missing colon): %s\nPacket: '%s'\n",
+ p, buf);
if (reg == NULL)
- warning ("Remote sent bad register number %ld: %s\n\
-Packet: '%s'\n",
- pnum, p, buf);
+ error ("Remote sent bad register number %ld: %s\nPacket: '%s'\n",
+ pnum, p, buf);
fieldsize = hex2bin (p, regs, REGISTER_RAW_SIZE (reg->regnum));
p += 2 * fieldsize;
@@ -3295,10 +3287,7 @@
}
if (*p++ != ';')
- {
- warning ("Remote register badly formatted: %s", buf);
- warning (" here: %s", p);
- }
+ error ("Remote register badly formatted: %s\nhere:", buf, p);
}
}
/* fall through */