From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5804 invoked by alias); 5 Jun 2007 18:34:57 -0000 Received: (qmail 5795 invoked by uid 22791); 5 Jun 2007 18:34:57 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 05 Jun 2007 18:34:55 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id C233B982E4; Tue, 5 Jun 2007 18:34:52 +0000 (GMT) Received: from caradoc.them.org (dsl093-172-095.pit1.dsl.speakeasy.net [66.93.172.95]) by nan.false.org (Postfix) with ESMTP id 54521982CE; Tue, 5 Jun 2007 18:34:52 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.67) (envelope-from ) id 1Hvdr7-0001GH-JQ; Tue, 05 Jun 2007 14:34:09 -0400 Date: Tue, 05 Jun 2007 18:34:00 -0000 From: Daniel Jacobowitz To: Ulrich Weigand , gdb-patches@sourceware.org, eliz@gnu.org Subject: Re: [rfc/rfa] [3/4] SPU enhancements: gdbserver support Message-ID: <20070605183409.GA4395@caradoc.them.org> Mail-Followup-To: Ulrich Weigand , gdb-patches@sourceware.org, eliz@gnu.org References: <20070604195349.GC23516@caradoc.them.org> <200706042005.l54K51nH029199@d12av02.megacenter.de.ibm.com> <20070604200956.GA25808@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070604200956.GA25808@caradoc.them.org> User-Agent: Mutt/1.5.15 (2007-04-09) 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: 2007-06/txt/msg00054.txt.bz2 On Mon, Jun 04, 2007 at 04:09:56PM -0400, Daniel Jacobowitz wrote: > On Mon, Jun 04, 2007 at 10:05:01PM +0200, Ulrich Weigand wrote: > > Fine with me. I'd appreciate if you could post that code ... > > I'll try to do this tomorrow morning. There's not as much code for it as I remembered. Sending such packets from GDB is easy. In fact, it's easier than the X packet, because you do not have to patch in the exact length. I already added the remote_escape_output helper. If p is a pointer into rs->buf just after the packet header, this will add as much data as can fit from write_buf/len: p += remote_escape_output (write_buf, len, p, &out_len, get_remote_packet_size () - (p - rs->buf)); To receive them in gdbserver, I used this: static int require_data (char *p, int p_len, char **data, int *data_len) { int input_index, output_index, escaped; *data = malloc (p_len); output_index = 0; escaped = 0; for (input_index = 0; input_index < p_len; input_index++) { char b = p[input_index]; if (escaped) { (*data)[output_index++] = b ^ 0x20; escaped = 0; } else if (b == '}') escaped = 1; else (*data)[output_index++] = b; } if (escaped) return -1; *data_len = output_index; return 0; } if (require_data (p, packet_len - (p - own_buf), &data, &len)) { write_enn (own_buf); return; } p is after the header in own_buf, packet_len is the total length of the received packet; I already changed getpkt to return packet_len. -- Daniel Jacobowitz CodeSourcery