This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] fix reggroup_next foobar
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 05 Aug 2003 14:11:12 -0400
- Subject: [commit] fix reggroup_next foobar
Hello,
This fixes a breakage in my rewritten reggroup_next. It can be
triggered using "maint print register-groups".
testcase to follow ...
Andrew
2003-08-05 Andrew Cagney <cagney@redhat.com>
* reggroups.c (reggroup_next): Check for the final entry.
Index: reggroups.c
===================================================================
RCS file: /cvs/src/src/gdb/reggroups.c,v
retrieving revision 1.6
diff -u -r1.6 reggroups.c
--- reggroups.c 4 Aug 2003 22:24:44 -0000 1.6
+++ reggroups.c 5 Aug 2003 18:08:00 -0000
@@ -132,13 +132,18 @@
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;
}