From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22613 invoked by alias); 6 Dec 2007 14:06:13 -0000 Received: (qmail 22595 invoked by uid 22791); 6 Dec 2007 14:06:11 -0000 X-Spam-Check-By: sourceware.org Received: from outbound.icp-qv1-irony-out3.iinet.net.au (HELO outbound.icp-qv1-irony-out3.iinet.net.au) (203.59.1.148) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 06 Dec 2007 14:06:02 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAJaQV0d8qUv7/2dsb2JhbAAI X-IronPort-AV: E=Sophos;i="4.23,261,1194188400"; d="diff'?scan'208";a="191201679" Received: from unknown (HELO [10.1.1.3]) ([124.169.75.251]) by outbound.icp-qv1-irony-out3.iinet.net.au with ESMTP; 06 Dec 2007 23:05:57 +0900 Message-ID: <475801C5.2090809@goanna.iinet.net.au> Date: Thu, 06 Dec 2007 14:22:00 -0000 From: Mick Davis Reply-To: mickd@goanna.iinet.net.au User-Agent: Thunderbird 2.0.0.6 (X11/20071022) MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: gdbserver corrupts binary data in remote protocol Content-Type: multipart/mixed; boundary="------------030100020303040005050005" 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: 2007-12/txt/msg00105.txt.bz2 This is a multi-part message in MIME format. --------------030100020303040005050005 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 561 I believe I've found a small bug when using the gdbserver to write into target memory. If the command received by the server uses a binary encoded data part, the remote protocol will clear the most significant bit of each byte. This may result in a CRC failure. The fix is to the readchar function, which applies a bit mask to the returned byte. Thanks -- Mick Davis Goanna Technologies Pty Ltd ChangeLog entry: 2007-12-06 Mick Davis * gdbserver/remote-utils.c (readchar): Allow binary data in received messages --------------030100020303040005050005 Content-Type: text/x-patch; name="remote_binary_packet_fix.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="remote_binary_packet_fix.diff" Content-length: 675 Index: src/gdb/gdbserver/remote-utils.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/remote-utils.c,v retrieving revision 1.50 diff -c -p -r1.50 remote-utils.c *** src/gdb/gdbserver/remote-utils.c 23 Aug 2007 18:08:48 -0000 1.50 --- src/gdb/gdbserver/remote-utils.c 6 Dec 2007 13:23:05 -0000 *************** readchar (void) *** 722,728 **** bufp = buf; bufcnt--; ! return *bufp++ & 0x7f; } /* Read a packet from the remote machine, with error checking, --- 722,728 ---- bufp = buf; bufcnt--; ! return *bufp++; } /* Read a packet from the remote machine, with error checking, --------------030100020303040005050005--