This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Fix flags type initialization bug
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: gdb-patches at sourceware dot org
- Date: Tue, 22 Aug 2006 21:45:19 +0200 (CEST)
- Subject: [commit] Fix flags type initialization bug
I'm working on printing proper flags for some registers on SPARC when
I hit this. It makes gdb crash, so perhaps I should put this on the
release branch too?
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* gdbtypes.c (init_flags_type): Set all fields to zero instead of
just the first one.
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.105
diff -u -p -r1.105 gdbtypes.c
--- gdbtypes.c 1 Mar 2006 19:34:46 -0000 1.105
+++ gdbtypes.c 22 Aug 2006 19:41:50 -0000
@@ -878,7 +878,7 @@ init_flags_type (char *name, int length)
type = init_type (TYPE_CODE_FLAGS, length, TYPE_FLAG_UNSIGNED, name, NULL);
TYPE_NFIELDS (type) = nfields;
TYPE_FIELDS (type) = TYPE_ALLOC (type, nfields * sizeof (struct field));
- memset (TYPE_FIELDS (type), 0, sizeof (struct field));
+ memset (TYPE_FIELDS (type), 0, nfields * sizeof (struct field));
return type;
}