Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Robert Picco <Robert.Picco@hp.com>
To: Andrew Cagney <cagney@gnu.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: new gdb remote packet type
Date: Thu, 29 Apr 2004 15:31:00 -0000	[thread overview]
Message-ID: <40912015.7070902@hp.com> (raw)
In-Reply-To: <4087EE4B.4010805@gnu.org>

Andrew Cagney wrote:

>>  you'd prefer that I use the q-packet mechanism? 
>
>
> Yes, the qPart packet was designed for exactly the situtation you 
> encountered.  It can specify a length/offset and return a short transfer.
>
> Andrew
>
>
Hi:

Does this represent what you are expecting of the qPart packet?  I saw 
no reason to export the type because this
packet is only useful in remote.c

thanks,

Bob

--- gdb-6.1-orig/gdb/remote.c	2004-02-25 15:41:00.000000000 -0500
+++ gdb-6.1/gdb/remote.c	2004-04-29 09:16:36.000000000 -0400
@@ -2003,6 +2003,57 @@
   objfile_relocate (symfile_objfile, offs);
 }
 
+static int register_init;
+
+static void
+remote_register_size(void)
+{
+  struct remote_state *rs = get_remote_state ();
+  char *buf = alloca (rs->remote_packet_size);
+  int regnum, offset, size, i, sz = 4;
+
+  
+  register_init = 1;
+
+  for (size = 0, regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
+    {
+        struct packet_reg *r = &rs->regs[regnum];
+        snprintf (buf, rs->remote_packet_size,
+			"qPart:gpacket:read::");
+	bin2hex((char *) &regnum, &buf[20], sizeof (regnum));
+	buf[20 + sizeof(regnum) * 2] = ',';
+	bin2hex((char *) &sz, &buf[20 + sizeof(regnum) * 2 + 1], sizeof (sz));
+	buf[20 + sizeof(regnum) * 2 + 1 + sizeof(size) * 2] = 0;
+	i = putpkt (buf);
+	if (i < 0)
+		goto bad;
+	buf[0] = '\0';
+	getpkt (buf, rs->remote_packet_size, 0);
+        if (buf[0] == 'O' && buf[1] == 'K' && buf[2] == '\0')
+		goto bad;
+	else if (buf[0] == 'E')
+		goto bad;
+
+        hex2bin(&buf[0], (char *)&offset, sizeof(offset));
+	r->offset = offset;
+	if (offset != -1) {
+		r->in_g_packet = 1;
+		size += register_size (current_gdbarch, regnum);
+	}
+	else
+		r->in_g_packet = 0;
+
+    }
+    rs->sizeof_g_packet = size;
+    return;
+
+bad:
+    if (regnum)
+		fprintf_unfiltered (gdb_stdlog, 
+			"Received some valid register packets and later failed\n");
+    return;
+}
+
 /* Stub for catch_errors.  */
 
 static int
@@ -2025,6 +2076,8 @@
   /* Let the stub know that we want it to return the thread.  */
   set_thread (-1, 0);
 
+  if (!register_init)
+	remote_register_size();
   inferior_ptid = remote_current_thread (inferior_ptid);
 
   get_offsets ();		/* Get text, data & bss offsets */
@@ -3257,8 +3310,8 @@
       gdb_assert (reg != NULL);
       if (!reg->in_g_packet)
 	internal_error (__FILE__, __LINE__,
-			"Attempt to fetch a non G-packet register when this "
-			"remote.c does not support the p-packet.");
+			"Attempt to fetch a non G-packet register (%d) when this "
+			"remote.c does not support the p-packet.", regnum);
     }
 
   sprintf (buf, "g");






  reply	other threads:[~2004-04-29 15:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-16  0:45 Robert Picco
2004-04-16 18:33 ` Andrew Cagney
2004-04-22 15:45   ` Robert Picco
2004-04-22 16:09     ` Andrew Cagney
2004-04-29 15:31       ` Robert Picco [this message]
2004-04-30 17:31         ` Andrew Cagney
2004-05-04 17:56           ` Robert Picco
2004-05-05 19:10             ` Andrew Cagney
2004-05-06 19:41               ` Robert Picco
2004-05-11 17:31                 ` Robert Picco
2004-05-12 18:20                 ` Andrew Cagney
2004-05-12 18:31                   ` Daniel Jacobowitz
2004-05-12 18:59                     ` Robert Picco
2004-05-12 20:55                       ` Daniel Jacobowitz
2004-05-12 22:16                         ` Robert Picco
     [not found]                     ` <40A279AF.30603@gnu.org>
2004-05-12 20:53                       ` Daniel Jacobowitz
2004-08-02 15:51                   ` Robert Picco
2004-09-24 20:07                     ` Andrew Cagney
2004-09-25 16:33                       ` Eli Zaretskii
2004-09-27 19:21                       ` Andrew Cagney

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=40912015.7070902@hp.com \
    --to=robert.picco@hp.com \
    --cc=cagney@gnu.org \
    --cc=gdb-patches@sources.redhat.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