This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Fix a zero-sized registers bug


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;
     }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]