* config/tc-h8300.c (get_operand): Fix typos in ldm/stm support.
[deliverable/binutils-gdb.git] / gdb / gdbtypes.c
index de15b5ad367df514adf27f84750954124fbab162..d55a87a0bc72ef849f71d61fcf6df54026fe1960 100644 (file)
@@ -1,5 +1,5 @@
 /* Support routines for manipulating internal types for GDB.
-   Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
    Contributed by Cygnus Support, using pieces from other GDB modules.
 
 This file is part of GDB.
@@ -53,6 +53,30 @@ struct type *builtin_type_long_double;
 struct type *builtin_type_complex;
 struct type *builtin_type_double_complex;
 struct type *builtin_type_string;
+struct type *builtin_type_int8;
+struct type *builtin_type_uint8;
+struct type *builtin_type_int16;
+struct type *builtin_type_uint16;
+struct type *builtin_type_int32;
+struct type *builtin_type_uint32;
+struct type *builtin_type_int64;
+struct type *builtin_type_uint64;
+/* start-sanitize-r5900 */
+struct type *builtin_type_int128;
+struct type *builtin_type_uint128;
+/* end-sanitize-r5900 */
+
+struct extra { char str[128]; int len; }; /* maximum extention is 128! FIXME */
+
+static void add_name PARAMS ((struct extra *, char *));
+static void add_mangled_type PARAMS ((struct extra *, struct type *));
+#if 0
+static void cfront_mangle_name PARAMS ((struct type *, int, int));
+#endif
+static void print_bit_vector PARAMS ((B_TYPE *, int));
+static void print_arg_types PARAMS ((struct type **, int));
+static void dump_fn_fieldlists PARAMS ((struct type *, int));
+static void print_cplus_stuff PARAMS ((struct type *, int));
 
 /* Alloc a new type structure and fill it with some defaults.  If
    OBJFILE is non-NULL, then allocate the space for the type structure
@@ -334,6 +358,9 @@ create_range_type (result_type, index_type, low_bound, high_bound)
   TYPE_FIELD_TYPE (result_type, 0) = builtin_type_int;         /* FIXME */
   TYPE_FIELD_TYPE (result_type, 1) = builtin_type_int;         /* FIXME */
 
+  if(low_bound >= 0)
+    TYPE_FLAGS (result_type) |= TYPE_FLAG_UNSIGNED;
+
   return (result_type);
 }
 
@@ -368,6 +395,12 @@ get_discrete_bounds (type, lowp, highp)
              if (TYPE_FIELD_BITPOS (type, i) > *highp)
                *highp = TYPE_FIELD_BITPOS (type, i);
            }
+
+         /* Set unsigned indicator if warranted. */
+         if(*lowp >= 0)
+           {
+             TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED;
+           }
        }
       else
        {
@@ -492,6 +525,10 @@ create_set_type (result_type, domain_type)
        = (bit_length + TARGET_CHAR_BIT - 1) / TARGET_CHAR_BIT;
     }
   TYPE_FIELD_TYPE (result_type, 0) = domain_type;
+
+  if(low_bound >= 0)
+    TYPE_FLAGS (result_type) |= TYPE_FLAG_UNSIGNED;
+
   return (result_type);
 }
 
@@ -867,6 +904,35 @@ fill_in_vptr_fieldno (type)
     }
 }
 
+/* Find the method and field indices for the destructor in class type T.
+   Return 1 if the destructor was found, otherwise, return 0.  */
+
+int
+get_destructor_fn_field (t, method_indexp, field_indexp)
+     struct type *t;
+     int *method_indexp;
+     int *field_indexp;
+{
+  int i;
+
+  for (i = 0; i < TYPE_NFN_FIELDS (t); i++)
+    {
+      int j;
+      struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i);
+
+      for (j = 0; j < TYPE_FN_FIELDLIST_LENGTH (t, i); j++)
+       {
+         if (DESTRUCTOR_PREFIX_P (TYPE_FN_FIELD_PHYSNAME (f, j)))
+           {
+             *method_indexp = i;
+             *field_indexp = j;
+             return 1;
+           }
+       }
+    }
+  return 0;
+}
+
 /* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989.
 
    If this is a stubbed struct (i.e. declared as struct foo *), see if
@@ -948,7 +1014,7 @@ check_typedef (type)
       struct type *range_type;
       struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type));
 
-      if (TYPE_FLAGS (target_type) & TYPE_FLAG_STUB)
+      if (TYPE_FLAGS (target_type) & (TYPE_FLAG_STUB | TYPE_FLAG_TARGET_STUB))
        { }
       else if (TYPE_CODE (type) == TYPE_CODE_ARRAY
               && TYPE_NFIELDS (type) == 1
@@ -979,21 +1045,21 @@ check_typedef (type)
 #include <ctype.h>
 #define INIT_EXTRA { pextras->len=0; pextras->str[0]='\0'; }
 #define ADD_EXTRA(c) { pextras->str[pextras->len++]=c; }
-struct extra { char str[128]; int len; }; /* maximum extention is 128! FIXME */
-void 
+
+static void 
 add_name(pextras,n) 
   struct extra * pextras;
   char * n; 
 {
-  char lenstr[512];    /* FIXME!  hardcoded :-( */
-  int nlen, lenstrlen;
+  int nlen;
+
   if ((nlen = (n ? strlen(n) : 0))==0) 
     return;
   sprintf(pextras->str+pextras->len,"%d%s",nlen,n);
   pextras->len=strlen(pextras->str);
 }
 
-void 
+static void 
 add_mangled_type(pextras,t) 
   struct extra * pextras;
   struct type * t;
@@ -1116,7 +1182,8 @@ add_mangled_type(pextras,t)
     add_mangled_type(pextras,t->target_type);
 }
 
-char * 
+#if 0
+void
 cfront_mangle_name(type, i, j)
      struct type *type;
      int i;
@@ -1165,6 +1232,8 @@ cfront_mangle_name(type, i, j)
        mangled_name = arm_mangled_name;
      }
 }
+#endif /* 0 */
+
 #undef ADD_EXTRA
 /* End of new code added to support parsing of Cfront stabs strings */
 
@@ -1179,13 +1248,13 @@ cfront_mangle_name(type, i, j)
    the space required for them.  */
 
 void
-check_stub_method (type, i, j)
+check_stub_method (type, method_id, signature_id)
      struct type *type;
-     int i;
-     int j;
+     int method_id;
+     int signature_id;
 {
   struct fn_field *f;
-  char *mangled_name = gdb_mangle_name (type, i, j);
+  char *mangled_name = gdb_mangle_name (type, method_id, signature_id);
   char *demangled_name = cplus_demangle (mangled_name,
                                         DMGL_PARAMS | DMGL_ANSI);
   char *argtypetext, *p;
@@ -1272,16 +1341,16 @@ check_stub_method (type, i, j)
 
   free (demangled_name);
 
-  f = TYPE_FN_FIELDLIST1 (type, i);    
+  f = TYPE_FN_FIELDLIST1 (type, method_id);    
 
-  TYPE_FN_FIELD_PHYSNAME (f, j) = mangled_name;
+  TYPE_FN_FIELD_PHYSNAME (f, signature_id) = mangled_name;
 
   /* Now update the old "stub" type into a real type.  */
-  mtype = TYPE_FN_FIELD_TYPE (f, j);
+  mtype = TYPE_FN_FIELD_TYPE (f, signature_id);
   TYPE_DOMAIN_TYPE (mtype) = type;
   TYPE_ARG_TYPES (mtype) = argtypes;
   TYPE_FLAGS (mtype) &= ~TYPE_FLAG_STUB;
-  TYPE_FN_FIELD_STUB (f, j) = 0;
+  TYPE_FN_FIELD_STUB (f, signature_id) = 0;
 }
 
 const struct cplus_struct_type cplus_struct_default;
@@ -1878,4 +1947,46 @@ _initialize_gdbtypes ()
     init_type (TYPE_CODE_STRING, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
               0,
               "string", (struct objfile *) NULL);
+  builtin_type_int8 =
+    init_type (TYPE_CODE_INT, 8 / 8,
+              0,
+              "int8_t", (struct objfile *) NULL);
+  builtin_type_uint8 =
+    init_type (TYPE_CODE_INT, 8 / 8,
+              TYPE_FLAG_UNSIGNED,
+              "uint8_t", (struct objfile *) NULL);
+  builtin_type_int16 =
+    init_type (TYPE_CODE_INT, 16 / 8,
+              0,
+              "int16_t", (struct objfile *) NULL);
+  builtin_type_uint16 =
+    init_type (TYPE_CODE_INT, 16 / 8,
+              TYPE_FLAG_UNSIGNED,
+              "uint16_t", (struct objfile *) NULL);
+  builtin_type_int32 =
+    init_type (TYPE_CODE_INT, 32 / 8,
+              0,
+              "int32_t", (struct objfile *) NULL);
+  builtin_type_uint32 =
+    init_type (TYPE_CODE_INT, 32 / 8,
+              TYPE_FLAG_UNSIGNED,
+              "uint32_t", (struct objfile *) NULL);
+  builtin_type_int64 =
+    init_type (TYPE_CODE_INT, 64 / 8,
+              0,
+              "int64_t", (struct objfile *) NULL);
+  builtin_type_uint64 =
+    init_type (TYPE_CODE_INT, 64 / 8,
+              TYPE_FLAG_UNSIGNED,
+              "uint64_t", (struct objfile *) NULL);
+  /* start-sanitize-r5900 */
+  builtin_type_int128 =
+    init_type (TYPE_CODE_INT, 128 / 8,
+              0,
+              "int128_t", (struct objfile *) NULL);
+  builtin_type_uint128 =
+    init_type (TYPE_CODE_INT, 128 / 8,
+              TYPE_FLAG_UNSIGNED,
+              "uint128_t", (struct objfile *) NULL);
+  /* end-sanitize-r5900 */
 }
This page took 0.02776 seconds and 4 git commands to generate.