2007-07-02 Markus Deuling <deuling@de.ibm.com>
[deliverable/binutils-gdb.git] / gdb / stabsread.c
index feda42fddd8f6634c434d5117d36a177962aa919..e1550878ee137ebf53453103c3c06f121a784320 100644 (file)
@@ -162,15 +162,6 @@ void stabsread_clear_cache (void);
 static const char vptr_name[] = "_vptr$";
 static const char vb_name[] = "_vb$";
 
-/* Define this as 1 if a pcc declaration of a char or short argument
-   gives the correct address.  Otherwise assume pcc gives the
-   address of the corresponding int, which is not the same on a
-   big-endian machine.  */
-
-#if !defined (BELIEVE_PCC_PROMOTION)
-#define BELIEVE_PCC_PROMOTION 0
-#endif
-
 static void
 invalid_cpp_abbrev_complaint (const char *arg1)
 {
@@ -971,10 +962,11 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
        }
 
       /* If it's gcc-compiled, if it says `short', believe it.  */
-      if (processing_gcc_compilation || BELIEVE_PCC_PROMOTION)
+      if (processing_gcc_compilation
+         || gdbarch_believe_pcc_promotion (current_gdbarch))
        break;
 
-      if (!BELIEVE_PCC_PROMOTION)
+      if (!gdbarch_believe_pcc_promotion (current_gdbarch))
        {
          /* This is the signed type which arguments get promoted to.  */
          static struct type *pcc_promotion_type;
@@ -984,12 +976,14 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
          /* Call it "int" because this is mainly C lossage.  */
          if (pcc_promotion_type == NULL)
            pcc_promotion_type =
-             init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+             init_type (TYPE_CODE_INT, 
+                        gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
                         0, "int", NULL);
 
          if (pcc_unsigned_promotion_type == NULL)
            pcc_unsigned_promotion_type =
-             init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+             init_type (TYPE_CODE_INT, 
+                        gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
                         TYPE_FLAG_UNSIGNED, "unsigned int", NULL);
 
          /* If PCC says a parameter is a short or a char, it is
@@ -1020,13 +1014,16 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
       /* Parameter which is in a register.  */
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
       SYMBOL_CLASS (sym) = LOC_REGPARM;
-      SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
-      if (SYMBOL_VALUE (sym) >= NUM_REGS + NUM_PSEUDO_REGS)
+      SYMBOL_VALUE (sym) = gdbarch_stab_reg_to_regnum (current_gdbarch, valu);
+      if (SYMBOL_VALUE (sym) >= gdbarch_num_regs (current_gdbarch)
+                                 + gdbarch_num_pseudo_regs (current_gdbarch))
        {
          reg_value_complaint (SYMBOL_VALUE (sym),
-                              NUM_REGS + NUM_PSEUDO_REGS,
+                              gdbarch_num_regs (current_gdbarch)
+                                + gdbarch_num_pseudo_regs (current_gdbarch),
                               SYMBOL_PRINT_NAME (sym));
-         SYMBOL_VALUE (sym) = SP_REGNUM;       /* Known safe, though useless */
+         SYMBOL_VALUE (sym) = gdbarch_sp_regnum (current_gdbarch);
+         /* Known safe, though useless */
        }
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
       add_symbol_to_list (sym, &local_symbols);
@@ -1036,13 +1033,16 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
       /* Register variable (either global or local).  */
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
       SYMBOL_CLASS (sym) = LOC_REGISTER;
-      SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
-      if (SYMBOL_VALUE (sym) >= NUM_REGS + NUM_PSEUDO_REGS)
+      SYMBOL_VALUE (sym) = gdbarch_stab_reg_to_regnum (current_gdbarch, valu);
+      if (SYMBOL_VALUE (sym) >= gdbarch_num_regs (current_gdbarch)
+                               + gdbarch_num_pseudo_regs (current_gdbarch))
        {
          reg_value_complaint (SYMBOL_VALUE (sym),
-                              NUM_REGS + NUM_PSEUDO_REGS,
+                              gdbarch_num_regs (current_gdbarch)
+                                + gdbarch_num_pseudo_regs (current_gdbarch),
                               SYMBOL_PRINT_NAME (sym));
-         SYMBOL_VALUE (sym) = SP_REGNUM;       /* Known safe, though useless */
+         SYMBOL_VALUE (sym) = gdbarch_sp_regnum (current_gdbarch);
+         /* Known safe, though useless */
        }
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
       if (within_function)
@@ -1308,13 +1308,16 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
       /* Reference parameter which is in a register.  */
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
       SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR;
-      SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
-      if (SYMBOL_VALUE (sym) >= NUM_REGS + NUM_PSEUDO_REGS)
+      SYMBOL_VALUE (sym) = gdbarch_stab_reg_to_regnum (current_gdbarch, valu);
+      if (SYMBOL_VALUE (sym) >= gdbarch_num_regs (current_gdbarch)
+                               + gdbarch_num_pseudo_regs (current_gdbarch))
        {
          reg_value_complaint (SYMBOL_VALUE (sym),
-                              NUM_REGS + NUM_PSEUDO_REGS,
+                              gdbarch_num_regs (current_gdbarch)
+                                + gdbarch_num_pseudo_regs (current_gdbarch),
                               SYMBOL_PRINT_NAME (sym));
-         SYMBOL_VALUE (sym) = SP_REGNUM;       /* Known safe, though useless */
+         SYMBOL_VALUE (sym) = gdbarch_sp_regnum (current_gdbarch);
+         /* Known safe, though useless */
        }
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
       add_symbol_to_list (sym, &local_symbols);
@@ -2834,7 +2837,8 @@ read_one_struct_field (struct field_info *fip, char **pp, char *p,
       if ((FIELD_BITSIZE (fip->list->field)
           == TARGET_CHAR_BIT * TYPE_LENGTH (field_type)
           || (TYPE_CODE (field_type) == TYPE_CODE_ENUM
-              && FIELD_BITSIZE (fip->list->field) == TARGET_INT_BIT)
+              && FIELD_BITSIZE (fip->list->field)
+                 == gdbarch_int_bit (current_gdbarch))
          )
          &&
          FIELD_BITPOS (fip->list->field) % 8 == 0)
@@ -3527,7 +3531,7 @@ read_enum_type (char **pp, struct type *type,
 
   /* Now fill in the fields of the type-structure.  */
 
-  TYPE_LENGTH (type) = TARGET_INT_BIT / HOST_CHAR_BIT;
+  TYPE_LENGTH (type) = gdbarch_int_bit (current_gdbarch) / HOST_CHAR_BIT;
   TYPE_CODE (type) = TYPE_CODE_ENUM;
   TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB;
   if (unsigned_enum)
@@ -3952,7 +3956,8 @@ read_range_type (char **pp, int typenums[2], int type_size,
       /* It is unsigned int or unsigned long.  */
       /* GCC 2.3.3 uses this for long long too, but that is just a GDB 3.5
          compatibility hack.  */
-      return init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+      return init_type (TYPE_CODE_INT, 
+                       gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
                        TYPE_FLAG_UNSIGNED, NULL, objfile);
     }
 
@@ -3994,7 +3999,8 @@ read_range_type (char **pp, int typenums[2], int type_size,
      of self_subrange.  */
   else if (n3 == 0 && n2 < 0
           && (self_subrange
-              || n2 == -TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT))
+              || n2 == -gdbarch_long_long_bit
+                         (current_gdbarch) / TARGET_CHAR_BIT))
     return init_type (TYPE_CODE_INT, -n2, 0, NULL, objfile);
   else if (n2 == -n3 - 1)
     {
@@ -4025,7 +4031,8 @@ handle_true_range:
                 _("base type %d of range type is not defined"), rangenums[1]);
       if (range_type_index == NULL)
        range_type_index =
-         init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+         init_type (TYPE_CODE_INT, 
+                    gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
                     0, "range type index type", NULL);
       index_type = range_type_index;
     }
This page took 0.025123 seconds and 4 git commands to generate.