Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sourceware.org
Subject: [commit] Fix a zero-sized registers bug
Date: Mon, 26 Feb 2007 19:29:00 -0000	[thread overview]
Message-ID: <20070226192929.GA3023@caradoc.them.org> (raw)

A followon to the ARM iWMMXt patches, found during basic ARM testing.
If we do not add a special case for zero-sized registers, we'll get an
internal error during 'g' packet parsing - they appear to be past the
end of the 'g' packet, even though they occupy no bytes in it.

The right answer is to neither fetch nor store registers without
contents, of course.  Anything else runs the risk of wasted 'p' / 'P'
packets going back and forth.

Tested on arm-linux and checked in.

-- 
Daniel Jacobowitz
CodeSourcery

2007-02-26  Daniel Jacobowitz  <dan@codesourcery.com>

	* remote.c (init_remote_state): Add special handling for placeholder
	registers.

---
 gdb/remote.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletion(-)

Index: gdb-6.6.50/gdb/remote.c
===================================================================
--- gdb-6.6.50.orig/gdb/remote.c	2007-02-26 05:03:30.000000000 -0800
+++ gdb-6.6.50/gdb/remote.c	2007-02-26 05:22:46.000000000 -0800
@@ -340,7 +340,13 @@ init_remote_state (struct gdbarch *gdbar
   for (regnum = 0; regnum < NUM_REGS; regnum++)
     {
       struct packet_reg *r = &rsa->regs[regnum];
-      r->pnum = gdbarch_remote_register_number (gdbarch, regnum);
+
+      if (register_size (current_gdbarch, regnum) == 0)
+	/* Do not try to fetch zero-sized (placeholder) registers.  */
+	r->pnum = -1;
+      else
+	r->pnum = gdbarch_remote_register_number (gdbarch, regnum);
+
       r->regnum = regnum;
     }
 


                 reply	other threads:[~2007-02-26 19:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20070226192929.GA3023@caradoc.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    /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