Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Ulrich Weigand <uweigand@de.ibm.com>,
	gdb-patches@sourceware.org, 	eliz@gnu.org
Subject: Re: [rfc/rfa] [3/4] SPU enhancements: gdbserver support
Date: Tue, 05 Jun 2007 18:34:00 -0000	[thread overview]
Message-ID: <20070605183409.GA4395@caradoc.them.org> (raw)
In-Reply-To: <20070604200956.GA25808@caradoc.them.org>

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


  reply	other threads:[~2007-06-05 18:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-02 19:33 Ulrich Weigand
2007-06-02 20:33 ` Eli Zaretskii
2007-06-03 13:28   ` Ulrich Weigand
2007-06-03 16:44     ` Eli Zaretskii
2007-06-04 13:58       ` Ulrich Weigand
2007-06-04 19:19         ` Eli Zaretskii
2007-06-04 20:02           ` Ulrich Weigand
2007-06-04 19:54 ` Daniel Jacobowitz
2007-06-04 20:05   ` Ulrich Weigand
2007-06-04 20:10     ` Daniel Jacobowitz
2007-06-05 18:34       ` Daniel Jacobowitz [this message]
2007-06-05 23:02         ` Ulrich Weigand
2007-06-06 17:51           ` Eli Zaretskii
2007-06-12 13:58           ` Daniel Jacobowitz
2007-06-12 14:43             ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070605183409.GA4395@caradoc.them.org \
    --to=drow@false.org \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox