2007-09-04 Michael Snyder <msnyder@access-company.com>
[deliverable/binutils-gdb.git] / gdb / stabsread.c
index 79d4acce0aecd5950a33155c81db4439b989314d..0e093686752026baca699673b83b71d334d546fe 100644 (file)
@@ -8,7 +8,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -17,9 +17,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Support routines for reading and decoding debugging information in
    the "stabs" format.  This format is used with many systems that use
@@ -47,6 +45,7 @@
 #include "doublest.h"
 #include "cp-abi.h"
 #include "cp-support.h"
+#include "gdb_assert.h"
 
 #include <ctype.h>
 
@@ -162,15 +161,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)
 {
@@ -292,15 +282,12 @@ dbx_lookup_type (int typenums[2])
 
       if (real_filenum >= N_HEADER_FILES (current_objfile))
        {
-         struct type *temp_type;
-         struct type **temp_type_p;
+         static struct type **temp_type_p;
 
          warning (_("GDB internal error: bad real_filenum"));
 
        error_return:
-         temp_type = init_type (TYPE_CODE_ERROR, 0, 0, NULL, NULL);
-         temp_type_p = (struct type **) xmalloc (sizeof (struct type *));
-         *temp_type_p = temp_type;
+         temp_type_p = &builtin_type_error;
          return temp_type_p;
        }
 
@@ -373,6 +360,7 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs,
        {
          name = stabs->stab[ii];
          pp = (char *) strchr (name, ':');
+         gdb_assert (pp);      /* Must find a ':' or game's over.  */
          while (pp[1] == ':')
            {
              pp += 2;
@@ -971,10 +959,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;
@@ -1030,7 +1019,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
                               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);
@@ -1048,7 +1038,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
                               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)
@@ -1322,7 +1313,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
                               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);
@@ -3719,7 +3711,7 @@ read_huge_number (char **pp, int end, int *bits, int twos_complement_bits)
   int nbits = 0;
   int c;
   long upper_limit;
-  int twos_complement_representation = radix == 8 && twos_complement_bits > 0;
+  int twos_complement_representation;
 
   if (*p == '-')
     {
@@ -3735,6 +3727,7 @@ read_huge_number (char **pp, int end, int *bits, int twos_complement_bits)
       p++;
     }
 
+  twos_complement_representation = radix == 8 && twos_complement_bits > 0;
   upper_limit = LONG_MAX / radix;
 
   while ((c = *p++) >= '0' && c < ('0' + radix))
This page took 0.026394 seconds and 4 git commands to generate.