summaryrefslogtreecommitdiff
path: root/gdb/avr-tdep.c
diff options
context:
space:
mode:
authorTheodore A. Roth <troth@openavr.org>2003-03-05 00:19:56 +0000
committerTheodore A. Roth <troth@openavr.org>2003-03-05 00:19:56 +0000
commit3f88fe22b8a2abc59c8294c0f85c356fb34b5af2 (patch)
tree6a1ea8edfd15d58105c64181a207720d38419fd9 /gdb/avr-tdep.c
parent9b39d5a893ea8b80709c60c4a9fbf4320d13d1b2 (diff)
downloadgdb-3f88fe22b8a2abc59c8294c0f85c356fb34b5af2.tar.gz
* 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.
Diffstat (limited to 'gdb/avr-tdep.c')
-rw-r--r--gdb/avr-tdep.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 952b4e4c7b7..975132abd98 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -1279,7 +1279,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);