From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27479 invoked by alias); 9 Jun 2008 18:34:00 -0000 Received: (qmail 27464 invoked by uid 22791); 9 Jun 2008 18:33:59 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 09 Jun 2008 18:33:41 +0000 Received: from spaceape7.eur.corp.google.com (spaceape7.eur.corp.google.com [172.28.16.141]) by smtp-out.google.com with ESMTP id m59IXdiC008508 for ; Mon, 9 Jun 2008 19:33:39 +0100 Received: from localhost (ruffy.corp.google.com [172.18.118.116]) by spaceape7.eur.corp.google.com with ESMTP id m59IXbqe011250 for ; Mon, 9 Jun 2008 19:33:38 +0100 Received: by localhost (Postfix, from userid 67641) id 91FDE1C7640; Mon, 9 Jun 2008 11:33:37 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [RFA] fix minor bug in malformed packet error message Message-Id: <20080609183337.91FDE1C7640@localhost> Date: Mon, 09 Jun 2008 18:46:00 -0000 From: dje@google.com (Doug Evans) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-06/txt/msg00168.txt.bz2 This patch fixes a minor bug in malformed packet error messages. The error message tries to print the start of where things go bad, but due to the `*p++ != mumble' test the ++ causes the first character character to be missed. ok to check in? 2008-06-09 Doug Evans * remote.c (remote_wait): Include beginning of malformed packet in error output. Index: remote.c =================================================================== RCS file: /cvs/src/src/gdb/remote.c,v retrieving revision 1.295 diff -u -p -u -p -r1.295 remote.c --- remote.c 5 Jun 2008 21:35:00 -0000 1.295 +++ remote.c 9 Jun 2008 18:28:16 -0000 @@ -3487,10 +3487,11 @@ Packet: '%s'\n"), struct packet_reg *reg = packet_reg_from_pnum (rsa, pnum); p = p1; - if (*p++ != ':') + if (*p != ':') error (_("Malformed packet(b) (missing colon): %s\n\ Packet: '%s'\n"), p, buf); + ++p; if (reg == NULL) error (_("Remote sent bad register number %s: %s\n\ @@ -3508,9 +3509,10 @@ Packet: '%s'\n"), reg->regnum, regs); } - if (*p++ != ';') + if (*p != ';') error (_("Remote register badly formatted: %s\nhere: %s"), buf, p); + ++p; } } /* fall through */