2007-06-28 Michael Snyder * target-descriptions.c (tdesc-_named_type): Guard against null type-id argument which may be passed by tdesc_create_reg (Coverity). Index: target-descriptions.c =================================================================== RCS file: /cvs/src/src/gdb/target-descriptions.c,v retrieving revision 1.9 diff -p -r1.9 target-descriptions.c *** target-descriptions.c 13 Jun 2007 18:26:59 -0000 1.9 --- target-descriptions.c 28 Jun 2007 20:57:07 -0000 *************** tdesc_named_type (const struct tdesc_fea *** 350,396 **** int ix; struct type *gdb_type; ! /* First try target-defined types. */ ! for (ix = 0; VEC_iterate (type_p, feature->types, ix, gdb_type); ix++) ! if (strcmp (TYPE_NAME (gdb_type), id) == 0) ! return gdb_type; ! ! /* Next try some predefined types. Note that none of these types ! depend on the current architecture; some of the builtin_type_foo ! variables are swapped based on the architecture. */ ! if (strcmp (id, "int8") == 0) ! return builtin_type_int8; ! if (strcmp (id, "int16") == 0) ! return builtin_type_int16; ! if (strcmp (id, "int32") == 0) ! return builtin_type_int32; ! if (strcmp (id, "int64") == 0) ! return builtin_type_int64; ! if (strcmp (id, "uint8") == 0) ! return builtin_type_uint8; ! if (strcmp (id, "uint16") == 0) ! return builtin_type_uint16; ! if (strcmp (id, "uint32") == 0) ! return builtin_type_uint32; ! if (strcmp (id, "uint64") == 0) ! return builtin_type_uint64; ! if (strcmp (id, "ieee_single") == 0) ! return builtin_type_ieee_single; ! if (strcmp (id, "ieee_double") == 0) ! return builtin_type_ieee_double; ! if (strcmp (id, "arm_fpa_ext") == 0) ! return builtin_type_arm_ext; return NULL; } --- 350,399 ---- int ix; struct type *gdb_type; ! if (id) ! { ! /* First try target-defined types. */ ! for (ix = 0; VEC_iterate (type_p, feature->types, ix, gdb_type); ix++) ! if (strcmp (TYPE_NAME (gdb_type), id) == 0) ! return gdb_type; ! /* Next try some predefined types. Note that none of these ! types depend on the current architecture; some of the ! builtin_type_foo variables are swapped based on the ! architecture. */ ! if (strcmp (id, "int8") == 0) ! return builtin_type_int8; ! if (strcmp (id, "int16") == 0) ! return builtin_type_int16; ! if (strcmp (id, "int32") == 0) ! return builtin_type_int32; ! if (strcmp (id, "int64") == 0) ! return builtin_type_int64; ! if (strcmp (id, "uint8") == 0) ! return builtin_type_uint8; ! if (strcmp (id, "uint16") == 0) ! return builtin_type_uint16; ! if (strcmp (id, "uint32") == 0) ! return builtin_type_uint32; ! if (strcmp (id, "uint64") == 0) ! return builtin_type_uint64; ! if (strcmp (id, "ieee_single") == 0) ! return builtin_type_ieee_single; ! if (strcmp (id, "ieee_double") == 0) ! return builtin_type_ieee_double; + if (strcmp (id, "arm_fpa_ext") == 0) + return builtin_type_arm_ext; + } return NULL; }