2003-08-05 Andrew Cagney <cagney@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Tue, 5 Aug 2003 18:08:59 +0000 (18:08 +0000)
committerAndrew Cagney <cagney@redhat.com>
Tue, 5 Aug 2003 18:08:59 +0000 (18:08 +0000)
* reggroups.c (reggroup_next): Check for the final entry.

gdb/ChangeLog
gdb/reggroups.c

index 83ae7c429cdc98d0c40ba8eb35cd289a16ede942..cee2edf3bc29de7113df954aecc2b749ca32b157 100644 (file)
@@ -1,3 +1,7 @@
+2003-08-05  Andrew Cagney  <cagney@redhat.com>
+
+       * reggroups.c (reggroup_next): Check for the final entry.
+
 2003-08-04  Andrew Cagney  <cagney@redhat.com>
 
        * monitor.h (monitor_dump_reg_block): Remove ATTR_FORMAT.
index 791ec0abd521f426295bcbd83bb1509736b519db..70009577818e636fa99db76554d7a3bfe02a0304 100644 (file)
@@ -132,13 +132,18 @@ reggroup_next (struct gdbarch *gdbarch, struct reggroup *last)
   if (groups->first == NULL)
     groups = &default_groups;
 
-  /* Retun the first/next reggroup.  */
+  /* Return the first/next reggroup.  */
   if (last == NULL)
     return groups->first->group;
   for (el = groups->first; el != NULL; el = el->next)
     {
       if (el->group == last)
-       return el->next->group;
+       {
+         if (el->next != NULL)
+           return el->next->group;
+         else
+           return NULL;
+       }
     }
   return NULL;
 }