print_percentage: Use floating point to avoid incorrect results when
[deliverable/binutils-gdb.git] / gdb / mdebugread.c
index 453b983c66d300ba61b4208ab55b45fd8e85d095..89d0282ecfd94e61ab687bb6b303a763be96fde5 100644 (file)
@@ -1,7 +1,9 @@
 /* Read a symbol table in ECOFF format (Third-Eye).
-   Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
-   1997, 1998, 1999, 2000, 2001, 2002, 2003
-   Free Software Foundation, Inc.
+
+   Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+   1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+   Foundation, Inc.
+
    Original version contributed by Alessandro Forin (af@cs.cmu.edu) at
    CMU.  Major work by Per Bothner, John Gilmore and Ian Lance Taylor
    at Cygnus Support.
@@ -45,7 +47,6 @@
 #include "symtab.h"
 #include "gdbtypes.h"
 #include "gdbcore.h"
-#include "symfile.h"
 #include "objfiles.h"
 #include "gdb_obstack.h"
 #include "buildsym.h"
@@ -373,7 +374,7 @@ static FDR *
 get_rfd (int cf, int rf)
 {
   FDR *fdrs;
-  register FDR *f;
+  FDR *f;
   RFDT rfd;
 
   fdrs = debug_info->fdr;
@@ -426,7 +427,7 @@ mdebug_build_psymtabs (struct objfile *objfile,
       char *fdr_end;
       FDR *fdr_ptr;
 
-      info->fdr = (FDR *) obstack_alloc (&objfile->psymbol_obstack,
+      info->fdr = (FDR *) obstack_alloc (&objfile->objfile_obstack,
                                         (info->symbolic_header.ifdMax
                                          * sizeof (FDR)));
       fdr_src = info->external_fdr;
@@ -508,7 +509,7 @@ push_parse_stack (void)
   /* Initialize new frame with previous content */
   if (top_stack)
     {
-      register struct parse_stack *prev = new->prev;
+      struct parse_stack *prev = new->prev;
 
       *new = *top_stack;
       top_stack->prev = new;
@@ -558,7 +559,7 @@ static struct mdebug_pending *
 is_pending_symbol (FDR *fh, char *sh)
 {
   int f_idx = fh - debug_info->fdr;
-  register struct mdebug_pending *p;
+  struct mdebug_pending *p;
 
   /* Linear search is ok, list is typically no more than 10 deep */
   for (p = pending_list[f_idx]; p; p = p->next)
@@ -579,7 +580,7 @@ add_pending (FDR *fh, char *sh, struct type *t)
   if (!p)
     {
       p = ((struct mdebug_pending *)
-          obstack_alloc (&current_objfile->psymbol_obstack,
+          obstack_alloc (&current_objfile->objfile_obstack,
                          sizeof (struct mdebug_pending)));
       p->s = sh;
       p->t = t;
@@ -793,7 +794,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
       else
        {
          t = parse_type (cur_fd, ax, sh->index + 1, 0, bigend, name);
-         if (STREQ (name, "malloc") && TYPE_CODE (t) == TYPE_CODE_VOID)
+         if (strcmp (name, "malloc") == 0
+             && TYPE_CODE (t) == TYPE_CODE_VOID)
            {
              /* I don't know why, but, at least under Alpha GNU/Linux,
                 when linking against a malloc without debugging
@@ -1057,7 +1059,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
        if (sh->iss == 0 || name[0] == '.' || name[0] == '\0')
          TYPE_TAG_NAME (t) = NULL;
        else
-         TYPE_TAG_NAME (t) = obconcat (&current_objfile->symbol_obstack,
+         TYPE_TAG_NAME (t) = obconcat (&current_objfile->objfile_obstack,
                                        "", "", name);
 
        TYPE_CODE (t) = type_code;
@@ -1103,12 +1105,12 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
                FIELD_STATIC_KIND (*f) = 0;
 
                enum_sym = ((struct symbol *)
-                           obstack_alloc (&current_objfile->symbol_obstack,
+                           obstack_alloc (&current_objfile->objfile_obstack,
                                           sizeof (struct symbol)));
                memset (enum_sym, 0, sizeof (struct symbol));
                DEPRECATED_SYMBOL_NAME (enum_sym) =
                  obsavestring (f->name, strlen (f->name),
-                               &current_objfile->symbol_obstack);
+                               &current_objfile->objfile_obstack);
                SYMBOL_CLASS (enum_sym) = LOC_CONST;
                SYMBOL_TYPE (enum_sym) = t;
                SYMBOL_DOMAIN (enum_sym) = VAR_DOMAIN;
@@ -1201,7 +1203,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
          SYMBOL_CLASS (s) = LOC_CONST;
          SYMBOL_TYPE (s) = mdebug_type_void;
          e = ((struct mips_extra_func_info *)
-              obstack_alloc (&current_objfile->symbol_obstack,
+              obstack_alloc (&current_objfile->objfile_obstack,
                              sizeof (struct mips_extra_func_info)));
          memset (e, 0, sizeof (struct mips_extra_func_info));
          SYMBOL_VALUE (s) = (long) e;
@@ -1522,10 +1524,6 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
   if (t->fBitfield)
     {
       int width = AUX_GET_WIDTH (bigend, ax);
-#if 0 /* OBSOLETE CFront */
-// OBSOLETE      /* Inhibit core dumps with some cfront generated objects that
-// OBSOLETE         corrupt the TIR.  */
-#endif /* OBSOLETE CFront */
       /* Inhibit core dumps if TIR is corrupted.  */
       if (bs == (int *) NULL)
        {
@@ -1636,9 +1634,9 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
          if (name[0] == '.' || name[0] == '\0')
            TYPE_TAG_NAME (tp) = NULL;
          else if (TYPE_TAG_NAME (tp) == NULL
-                  || !STREQ (TYPE_TAG_NAME (tp), name))
+                  || strcmp (TYPE_TAG_NAME (tp), name) != 0)
            TYPE_TAG_NAME (tp) = obsavestring (name, strlen (name),
-                                           &current_objfile->type_obstack);
+                                           &current_objfile->objfile_obstack);
        }
     }
 
@@ -1671,9 +1669,10 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
              bad_tag_guess_complaint (sym_name);
              TYPE_CODE (tp) = type_code;
            }
-         if (TYPE_NAME (tp) == NULL || !STREQ (TYPE_NAME (tp), name))
+         if (TYPE_NAME (tp) == NULL
+             || strcmp (TYPE_NAME (tp), name) != 0)
            TYPE_NAME (tp) = obsavestring (name, strlen (name),
-                                          &current_objfile->type_obstack);
+                                          &current_objfile->objfile_obstack);
        }
     }
   if (t->bt == btTypedef)
@@ -1697,11 +1696,11 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
       TYPE_FIELDS (tp) = ((struct field *)
                          TYPE_ALLOC (tp, 2 * sizeof (struct field)));
       TYPE_FIELD_NAME (tp, 0) = obsavestring ("Low", strlen ("Low"),
-                                           &current_objfile->type_obstack);
+                                           &current_objfile->objfile_obstack);
       TYPE_FIELD_BITPOS (tp, 0) = AUX_GET_DNLOW (bigend, ax);
       ax++;
       TYPE_FIELD_NAME (tp, 1) = obsavestring ("High", strlen ("High"),
-                                           &current_objfile->type_obstack);
+                                           &current_objfile->objfile_obstack);
       TYPE_FIELD_BITPOS (tp, 1) = AUX_GET_DNHIGH (bigend, ax);
       ax++;
     }
@@ -1991,7 +1990,8 @@ parse_procedure (PDR *pr, struct symtab *search_symtab,
 
       /* Correct incorrect setjmp procedure descriptor from the library
          to make backtrace through setjmp work.  */
-      if (e->pdr.pcreg == 0 && STREQ (sh_name, "setjmp"))
+      if (e->pdr.pcreg == 0
+         && strcmp (sh_name, "setjmp") == 0)
        {
          complaint (&symfile_complaints, "fixing bad setjmp PDR from libc");
          e->pdr.pcreg = RA_REGNUM;
@@ -2228,7 +2228,7 @@ parse_partial_symbols (struct objfile *objfile)
   char *ext_out;
   char *ext_out_end;
   EXTR *ext_block;
-  register EXTR *ext_in;
+  EXTR *ext_in;
   EXTR *ext_in_end;
   SYMR sh;
   struct partial_symtab *pst;
@@ -2261,7 +2261,7 @@ parse_partial_symbols (struct objfile *objfile)
       && (bfd_get_section_flags (cur_bfd, text_sect) & SEC_RELOC))
     relocatable = 1;
 
-  extern_tab = (EXTR *) obstack_alloc (&objfile->psymbol_obstack,
+  extern_tab = (EXTR *) obstack_alloc (&objfile->objfile_obstack,
                                       sizeof (EXTR) * hdr->iextMax);
 
   includes_allocated = 30;
@@ -2305,7 +2305,7 @@ parse_partial_symbols (struct objfile *objfile)
   /* Allocate the global pending list.  */
   pending_list =
     ((struct mdebug_pending **)
-     obstack_alloc (&objfile->psymbol_obstack,
+     obstack_alloc (&objfile->objfile_obstack,
                    hdr->ifdMax * sizeof (struct mdebug_pending *)));
   memset (pending_list, 0,
          hdr->ifdMax * sizeof (struct mdebug_pending *));
@@ -2557,7 +2557,7 @@ parse_partial_symbols (struct objfile *objfile)
                                  objfile->global_psymbols.next,
                                  objfile->static_psymbols.next);
       pst->read_symtab_private = ((char *)
-                                 obstack_alloc (&objfile->psymbol_obstack,
+                                 obstack_alloc (&objfile->objfile_obstack,
                                                 sizeof (struct symloc)));
       memset (pst->read_symtab_private, 0, sizeof (struct symloc));
 
@@ -2612,7 +2612,8 @@ parse_partial_symbols (struct objfile *objfile)
                          ((char *) debug_info->external_sym
                           + (fh->isymBase + 1) * external_sym_size),
                          &sh);
-         if (STREQ (debug_info->ss + fh->issBase + sh.iss, stabs_symbol))
+         if (strcmp (debug_info->ss + fh->issBase + sh.iss,
+                     stabs_symbol) == 0)
            processing_gcc_compilation = 2;
        }
 
@@ -2933,12 +2934,13 @@ parse_partial_symbols (struct objfile *objfile)
                         things like "break c-exp.y:435" need to work (I
                         suppose the psymtab_include_list could be hashed or put
                         in a binary tree, if profiling shows this is a major hog).  */
-                     if (pst && STREQ (namestring, pst->filename))
+                     if (pst && strcmp (namestring, pst->filename) == 0)
                        continue;
                      {
-                       register int i;
+                       int i;
                        for (i = 0; i < includes_used; i++)
-                         if (STREQ (namestring, psymtab_include_list[i]))
+                         if (strcmp (namestring,
+                                     psymtab_include_list[i]) == 0)
                            {
                              i = -1;
                              break;
@@ -3043,22 +3045,6 @@ parse_partial_symbols (struct objfile *objfile)
                                                     psymtab_language, objfile);
                                p += 1;
                              }
-#if 0 /* OBSOLETE CFront */
-// OBSOLETE                        /* The semantics of C++ state that "struct foo { ... }"
-// OBSOLETE                           also defines a typedef for "foo".  Unfortuantely, cfront
-// OBSOLETE                           never makes the typedef when translating from C++ to C.
-// OBSOLETE                           We make the typedef here so that "ptype foo" works as
-// OBSOLETE                           expected for cfront translated code.  */
-// OBSOLETE                        else if (psymtab_language == language_cplus)
-// OBSOLETE                          {
-// OBSOLETE                            /* Also a typedef with the same name.  */
-// OBSOLETE                            add_psymbol_to_list (namestring, p - namestring,
-// OBSOLETE                                                 VAR_DOMAIN, LOC_TYPEDEF,
-// OBSOLETE                                                 &objfile->static_psymbols,
-// OBSOLETE                                                 sh.value, 0,
-// OBSOLETE                                                 psymtab_language, objfile);
-// OBSOLETE                          }
-#endif /* OBSOLETE CFront */
                          }
                        goto check_enum;
                      case 't':
@@ -3205,11 +3191,6 @@ parse_partial_symbols (struct objfile *objfile)
                      case '9':
                      case '-':
                      case '#':         /* for symbol identification (used in live ranges) */
-#if 0 /* OBSOLETE CFront */
-// OBSOLETE                    /* added to support cfront stabs strings */
-// OBSOLETE                  case 'Z':         /* for definition continuations */
-// OBSOLETE                  case 'P':         /* for prototypes */
-#endif /* OBSOLETE CFront */
                        continue;
 
                      case ':':
@@ -3627,8 +3608,8 @@ parse_partial_symbols (struct objfile *objfile)
       if (objfile->ei.entry_point >= save_pst->textlow &&
          objfile->ei.entry_point < save_pst->texthigh)
        {
-         objfile->ei.entry_file_lowpc = save_pst->textlow;
-         objfile->ei.entry_file_highpc = save_pst->texthigh;
+         objfile->ei.deprecated_entry_file_lowpc = save_pst->textlow;
+         objfile->ei.deprecated_entry_file_highpc = save_pst->texthigh;
        }
 
       /* The objfile has its functions reordered if this partial symbol
@@ -3679,7 +3660,7 @@ parse_partial_symbols (struct objfile *objfile)
       pst->number_of_dependencies = 0;
       pst->dependencies =
        ((struct partial_symtab **)
-        obstack_alloc (&objfile->psymbol_obstack,
+        obstack_alloc (&objfile->objfile_obstack,
                        ((fh->crfd - 1)
                         * sizeof (struct partial_symtab *))));
       for (s_idx = 1; s_idx < fh->crfd; s_idx++)
@@ -3886,8 +3867,8 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename)
                      ((char *) debug_info->external_sym
                       + (fh->isymBase + 1) * external_sym_size),
                      &sh);
-      if (STREQ (debug_info->ss + fh->issBase + sh.iss,
-                stabs_symbol))
+      if (strcmp (debug_info->ss + fh->issBase + sh.iss,
+                 stabs_symbol) == 0)
        {
          /* We indicate that this is a GCC compilation so that certain
             features will be enabled in stabsread/dbxread.  */
@@ -3966,7 +3947,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename)
                     procedure specific info */
                  struct mips_extra_func_info *e =
                  ((struct mips_extra_func_info *)
-                  obstack_alloc (&current_objfile->symbol_obstack,
+                  obstack_alloc (&current_objfile->objfile_obstack,
                                  sizeof (struct mips_extra_func_info)));
                  struct symbol *s = new_symbol (MIPS_EFI_SYMBOL_NAME);
 
@@ -4438,7 +4419,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp, enum type_code type_cod
    keeping the symtab sorted */
 
 static struct symbol *
-mylookup_symbol (char *name, register struct block *block,
+mylookup_symbol (char *name, struct block *block,
                 domain_enum domain, enum address_class class)
 {
   struct dict_iterator iter;
@@ -4527,7 +4508,7 @@ add_line (struct linetable *lt, int lineno, CORE_ADDR adr, int last)
 static int
 compare_blocks (const void *arg1, const void *arg2)
 {
-  register int addr_diff;
+  LONGEST addr_diff;
   struct block **b1 = (struct block **) arg1;
   struct block **b2 = (struct block **) arg2;
 
@@ -4568,8 +4549,8 @@ sort_blocks (struct symtab *s)
           compare_blocks);
 
   {
-    register CORE_ADDR high = 0;
-    register int i, j = BLOCKVECTOR_NBLOCKS (bv);
+    CORE_ADDR high = 0;
+    int i, j = BLOCKVECTOR_NBLOCKS (bv);
 
     for (i = FIRST_LOCAL_BLOCK; i < j; i++)
       if (high < BLOCK_END (BLOCKVECTOR_BLOCK (bv, i)))
@@ -4610,7 +4591,7 @@ new_symtab (char *name, int maxlines, struct objfile *objfile)
 
   s->free_code = free_linetable;
   s->debugformat = obsavestring ("ECOFF", 5,
-                                &objfile->symbol_obstack);
+                                &objfile->objfile_obstack);
   return (s);
 }
 
@@ -4627,7 +4608,7 @@ new_psymtab (char *name, struct objfile *objfile)
   /* Keep a backpointer to the file's symbols */
 
   psymtab->read_symtab_private = ((char *)
-                                 obstack_alloc (&objfile->psymbol_obstack,
+                                 obstack_alloc (&objfile->objfile_obstack,
                                                 sizeof (struct symloc)));
   memset (psymtab->read_symtab_private, 0, sizeof (struct symloc));
   CUR_BFD (psymtab) = cur_bfd;
@@ -4715,7 +4696,7 @@ static struct symbol *
 new_symbol (char *name)
 {
   struct symbol *s = ((struct symbol *)
-                     obstack_alloc (&current_objfile->symbol_obstack,
+                     obstack_alloc (&current_objfile->objfile_obstack,
                                     sizeof (struct symbol)));
 
   memset (s, 0, sizeof (*s));
@@ -4758,7 +4739,7 @@ elfmdebug_build_psymtabs (struct objfile *objfile,
   back_to = make_cleanup_discard_minimal_symbols ();
 
   info = ((struct ecoff_debug_info *)
-         obstack_alloc (&objfile->psymbol_obstack,
+         obstack_alloc (&objfile->objfile_obstack,
                         sizeof (struct ecoff_debug_info)));
 
   if (!(*swap->read_debug_info) (abfd, sec, info))
This page took 0.031052 seconds and 4 git commands to generate.