This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]