]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* avr-tdep.c (avr_io_reg_read_command): Fix to handle case when the
authorTheodore A. Roth <troth@openavr.org>
Wed, 5 Mar 2003 19:21:41 +0000 (19:21 +0000)
committerTheodore A. Roth <troth@openavr.org>
Wed, 5 Mar 2003 19:21:41 +0000 (19:21 +0000)
number of io registers reported by remote target is not a multiple of step.

gdb/ChangeLog
gdb/avr-tdep.c

index 1ff487caab2192367be484f3e8001b80b154f511..b3d3c106e2797635dc34d39e458ecedae2291064 100644 (file)
@@ -1,3 +1,9 @@
+2003-03-04  Theodore A. Roth  <troth@openavr.org>
+
+       * avr-tdep.c (avr_io_reg_read_command): Fix to handle case when the
+       number of io registers reported by remote target is not a multiple of
+       step.
+
 2003-02-04  David Carlton  <carlton@math.stanford.edu>
 
        * objfiles.c (allocate_objfile): Always set name.  Add comment at
index f2a81b17ec56552a9835aaa6be823ae4d9260aa1..1811cbe93d3103b852979e1696adf329bfbad888 100644 (file)
@@ -1343,7 +1343,10 @@ avr_io_reg_read_command (char *args, int from_tty)
 
   for (i = 0; i < nreg; i += step)
     {
-      j = step - (nreg % step);        /* how many registers this round? */
+      /* how many registers this round? */
+      j = step;
+      if ( (i+j) >= nreg)
+        j = nreg - i;           /* last block is less than 8 registers */
 
       snprintf (query, sizeof (query) - 1, "avr.io_reg:%x,%x", i, j);
       target_query ((int) 'R', query, buf, &bufsiz);