* 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.
This commit is contained in:
Theodore A. Roth 2003-03-05 00:19:56 +00:00
parent 001f9f100c
commit 91ccbfc19e
2 changed files with 10 additions and 1 deletions

View file

@ -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);