Update texinfo.tex to version 2000-05-28.15.
[deliverable/binutils-gdb.git] / gdb / coffread.c
index 4fb426c343bd2727cc368dcd0ae7528a1a090bf0..c781a34f18fc6dab0aaeba29749f6a6fa3e08fa8 100644 (file)
@@ -43,7 +43,7 @@
 #include "complaints.h"
 #include "target.h"
 
-extern void _initialize_coffread PARAMS ((void));
+extern void _initialize_coffread (void);
 
 struct coff_symfile_info
   {
@@ -176,76 +176,78 @@ struct coff_symbol
     unsigned int c_type;
   };
 
-extern void stabsread_clear_cache PARAMS ((void));
+extern void stabsread_clear_cache (void);
 
-static struct type *coff_read_struct_type PARAMS ((int, int, int));
+static struct type *coff_read_struct_type (int, int, int);
 
-static struct type *decode_base_type PARAMS ((struct coff_symbol *,
-                                             unsigned int,
-                                             union internal_auxent *));
+static struct type *decode_base_type (struct coff_symbol *,
+                                     unsigned int, union internal_auxent *);
 
-static struct type *decode_type PARAMS ((struct coff_symbol *, unsigned int,
-                                        union internal_auxent *));
+static struct type *decode_type (struct coff_symbol *, unsigned int,
+                                union internal_auxent *);
 
-static struct type *decode_function_type PARAMS ((struct coff_symbol *,
-                                                 unsigned int,
-                                                 union internal_auxent *));
+static struct type *decode_function_type (struct coff_symbol *,
+                                         unsigned int,
+                                         union internal_auxent *);
 
-static struct type *coff_read_enum_type PARAMS ((int, int, int));
+static struct type *coff_read_enum_type (int, int, int);
 
-static struct symbol *process_coff_symbol PARAMS ((struct coff_symbol *,
-                                                  union internal_auxent *,
-                                                  struct objfile *));
+static struct symbol *process_coff_symbol (struct coff_symbol *,
+                                          union internal_auxent *,
+                                          struct objfile *);
 
-static void patch_opaque_types PARAMS ((struct symtab *));
+static void patch_opaque_types (struct symtab *);
 
-static void patch_type PARAMS ((struct type *, struct type *));
+static void patch_type (struct type *, struct type *);
 
-static void enter_linenos PARAMS ((long, int, int, struct objfile *));
+static void enter_linenos (long, int, int, struct objfile *);
 
-static void free_linetab PARAMS ((void));
+static void free_linetab (void);
 
-static int init_lineno PARAMS ((bfd *, long, int));
+static void free_linetab_cleanup (void *ignore);
 
-static char *getsymname PARAMS ((struct internal_syment *));
+static int init_lineno (bfd *, long, int);
 
-static char *coff_getfilename PARAMS ((union internal_auxent *));
+static char *getsymname (struct internal_syment *);
 
-static void free_stringtab PARAMS ((void));
+static char *coff_getfilename (union internal_auxent *);
 
-static int init_stringtab PARAMS ((bfd *, long));
+static void free_stringtab (void);
 
-static void read_one_sym PARAMS ((struct coff_symbol *,
-                                 struct internal_syment *,
-                                 union internal_auxent *));
+static void free_stringtab_cleanup (void *ignore);
 
-static void coff_symtab_read PARAMS ((long, int, struct objfile *));
+static int init_stringtab (bfd *, long);
 
-static void find_linenos PARAMS ((bfd *, sec_ptr, PTR));
+static void read_one_sym (struct coff_symbol *,
+                         struct internal_syment *, union internal_auxent *);
 
-static void coff_symfile_init PARAMS ((struct objfile *));
+static void coff_symtab_read (long, unsigned int, struct objfile *);
 
-static void coff_new_init PARAMS ((struct objfile *));
+static void find_linenos (bfd *, sec_ptr, PTR);
 
-static void coff_symfile_read PARAMS ((struct objfile *, int));
+static void coff_symfile_init (struct objfile *);
 
-static void coff_symfile_finish PARAMS ((struct objfile *));
+static void coff_new_init (struct objfile *);
 
-static void record_minimal_symbol PARAMS ((char *, CORE_ADDR,
-                                          enum minimal_symbol_type,
-                                          struct objfile *));
+static void coff_symfile_read (struct objfile *, int);
 
-static void coff_end_symtab PARAMS ((struct objfile *));
+static void coff_symfile_finish (struct objfile *);
 
-static void complete_symtab PARAMS ((char *, CORE_ADDR, unsigned int));
+static void record_minimal_symbol (char *, CORE_ADDR,
+                                  enum minimal_symbol_type,
+                                  struct objfile *);
 
-static void coff_start_symtab PARAMS ((char *));
+static void coff_end_symtab (struct objfile *);
 
-static struct type *coff_alloc_type PARAMS ((int));
+static void complete_symtab (char *, CORE_ADDR, unsigned int);
 
-static struct type **coff_lookup_type PARAMS ((int));
+static void coff_start_symtab (char *);
 
-static void coff_locate_sections PARAMS ((bfd *, asection *, PTR));
+static struct type *coff_alloc_type (int);
+
+static struct type **coff_lookup_type (int);
+
+static void coff_locate_sections (bfd *, asection *, PTR);
 \f
 /* We are called once per section from coff_symfile_read.  We
    need to examine each section we are passed, check to see
@@ -311,7 +313,7 @@ coff_locate_sections (abfd, sectp, csip)
 }
 
 /* Return the section_offsets* that CS points to.  */
-static int cs_to_section PARAMS ((struct coff_symbol *, struct objfile *));
+static int cs_to_section (struct coff_symbol *, struct objfile *);
 
 struct find_targ_sec_arg
   {
@@ -319,7 +321,7 @@ struct find_targ_sec_arg
     asection **resultp;
   };
 
-static void find_targ_sec PARAMS ((bfd *, asection *, void *));
+static void find_targ_sec (bfd *, asection *, void *);
 
 static void
 find_targ_sec (abfd, sect, obj)
@@ -340,7 +342,7 @@ cs_to_section (cs, objfile)
 {
   asection *sect = NULL;
   struct find_targ_sec_arg args;
-  int off = SECT_OFF_TEXT;
+  int off = SECT_OFF_TEXT (objfile);
 
   args.targ_index = cs->c_secnum;
   args.resultp = §
@@ -349,18 +351,18 @@ cs_to_section (cs, objfile)
     {
       /* This is the section.  Figure out what SECT_OFF_* code it is.  */
       if (bfd_get_section_flags (abfd, sect) & SEC_CODE)
-       off = SECT_OFF_TEXT;
+       off = SECT_OFF_TEXT (objfile);
       else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD)
-       off = SECT_OFF_DATA;
+       off = SECT_OFF_DATA (objfile);
       else
-       off = SECT_OFF_BSS;
+       off = SECT_OFF_BSS (objfile);
     }
   return off;
 }
 
 /* Return the address of the section of a COFF symbol.  */
 
-static CORE_ADDR cs_section_address PARAMS ((struct coff_symbol *, bfd *));
+static CORE_ADDR cs_section_address (struct coff_symbol *, bfd *);
 
 static CORE_ADDR
 cs_section_address (cs, abfd)
@@ -605,7 +607,7 @@ coff_symfile_read (objfile, mainline)
   coff_data_type *cdata = coff_data (abfd);
   char *name = bfd_get_filename (abfd);
   register int val;
-  int num_symbols;
+  unsigned int num_symbols;
   int symtab_offset;
   int stringtab_offset;
   struct cleanup *back_to;
@@ -638,7 +640,7 @@ coff_symfile_read (objfile, mainline)
   temp_sym = (char *) xmalloc
     (cdata->local_symesz + cdata->local_auxesz);
   temp_aux = temp_sym + cdata->local_symesz;
-  back_to = make_cleanup ((make_cleanup_func) free_current_contents, &temp_sym);
+  back_to = make_cleanup (free_current_contents, &temp_sym);
 
   /* We need to know whether this is a PE file, because in PE files,
      unlike standard COFF files, symbol values are stored as offsets
@@ -656,7 +658,7 @@ coff_symfile_read (objfile, mainline)
   info->max_lineno_offset = 0;
   bfd_map_over_sections (abfd, find_linenos, (PTR) info);
 
-  make_cleanup ((make_cleanup_func) free_linetab, 0);
+  make_cleanup (free_linetab_cleanup, 0 /*ignore*/);
   val = init_lineno (abfd, info->min_lineno_offset,
                     info->max_lineno_offset - info->min_lineno_offset);
   if (val < 0)
@@ -664,13 +666,13 @@ coff_symfile_read (objfile, mainline)
 
   /* Now read the string table, all at once.  */
 
-  make_cleanup ((make_cleanup_func) free_stringtab, 0);
+  make_cleanup (free_stringtab_cleanup, 0 /*ignore*/);
   val = init_stringtab (abfd, stringtab_offset);
   if (val < 0)
     error ("\"%s\": can't get string table", name);
 
   init_minimal_symbol_collection ();
-  make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
+  make_cleanup_discard_minimal_symbols ();
 
   /* Now that the executable file is positioned at symbol table,
      process it and define symbols accordingly.  */
@@ -755,7 +757,7 @@ coff_symfile_finish (objfile)
 static void
 coff_symtab_read (symtab_offset, nsyms, objfile)
      long symtab_offset;
-     int nsyms;
+     unsigned int nsyms;
      struct objfile *objfile;
 {
   register struct context_stack *new;
@@ -843,7 +845,7 @@ coff_symtab_read (symtab_offset, nsyms, objfile)
       if (ISFCN (cs->c_type) && cs->c_sclass != C_TPDEF)
        {
          /* Record all functions -- external and static -- in minsyms. */
-         tmpaddr = cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+         tmpaddr = cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
          record_minimal_symbol (cs->c_name, tmpaddr, mst_text, objfile);
 
          fcn_line_ptr = main_aux.x_sym.x_fcnary.x_fcn.x_lnnoptr;
@@ -908,7 +910,7 @@ coff_symtab_read (symtab_offset, nsyms, objfile)
                     followed by a later file with no symbols.  */
                  if (in_source_file)
                    complete_symtab (filestring,
-                   cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT),
+                   cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)),
                                     main_aux.x_scn.x_scnlen);
                  in_source_file = 0;
                }
@@ -969,10 +971,8 @@ coff_symtab_read (symtab_offset, nsyms, objfile)
                    || cs->c_sclass == C_THUMBEXT)
                  tmpaddr += ANOFFSET (objfile->section_offsets, sec);
 
-               switch (sec)
+               if (sec == SECT_OFF_TEXT (objfile))
                  {
-                 case SECT_OFF_TEXT:
-                 case SECT_OFF_RODATA:
                    ms_type =
                      cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC
                      || cs->c_sclass == C_THUMBEXT ?
@@ -981,21 +981,21 @@ coff_symtab_read (symtab_offset, nsyms, objfile)
                    if (tmpaddr & 1)    /* FIXME: delete this line */
                      SMASH_TEXT_ADDRESS (tmpaddr);
 #endif
-                   break;
-                 case SECT_OFF_DATA:
+                 }
+               else if (sec == SECT_OFF_DATA (objfile))
+                 {
                    ms_type =
                      cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
                      mst_data : mst_file_data;
-                   break;
-                 case SECT_OFF_BSS:
+                 }
+               else if (sec == SECT_OFF_BSS (objfile))
+                 {
                    ms_type =
                      cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
                      mst_data : mst_file_data;
-                   break;
-                 default:
-                   ms_type = mst_unknown;
-                   break;
                  }
+               else
+                 ms_type = mst_unknown;
              }
 
            if (cs->c_name[0] != '@' /* Skip tdesc symbols */ )
@@ -1099,11 +1099,11 @@ coff_symtab_read (symtab_offset, nsyms, objfile)
                 of the epilogue.  */
                            cs->c_value
                            + FUNCTION_EPILOGUE_SIZE
-                           + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT),
+                           + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)),
 #else
                            fcn_cs_saved.c_value
                            + fcn_aux_saved.x_sym.x_misc.x_fsize
-                           + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT),
+                           + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)),
 #endif
                            objfile
                );
@@ -1115,7 +1115,7 @@ coff_symtab_read (symtab_offset, nsyms, objfile)
          if (STREQ (cs->c_name, ".bb"))
            {
              tmpaddr = cs->c_value;
-             tmpaddr += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+             tmpaddr += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
              push_context (++depth, tmpaddr);
            }
          else if (STREQ (cs->c_name, ".eb"))
@@ -1135,7 +1135,7 @@ coff_symtab_read (symtab_offset, nsyms, objfile)
              if (local_symbols && context_stack_depth > 0)
                {
                  tmpaddr =
-                   cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+                   cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
                  /* Make a block for the local symbols within.  */
                  finish_block (0, &local_symbols, new->old_blocks,
                                new->start_addr, tmpaddr, objfile);
@@ -1287,6 +1287,12 @@ free_stringtab ()
   stringtab = NULL;
 }
 
+static void
+free_stringtab_cleanup (void *ignore)
+{
+  free_stringtab ();
+}
+
 static char *
 getsymname (symbol_entry)
      struct internal_syment *symbol_entry;
@@ -1388,6 +1394,12 @@ free_linetab ()
   linetab = NULL;
 }
 
+static void
+free_linetab_cleanup (void *ignore)
+{
+  free_linetab ();
+}
+
 #if !defined (L_LNNO32)
 #define L_LNNO32(lp) ((lp)->l_lnno)
 #endif
@@ -1427,7 +1439,7 @@ enter_linenos (file_offset, first_line, last_line, objfile)
       if (L_LNNO32 (&lptr) && L_LNNO32 (&lptr) <= last_line)
        record_line (current_subfile, first_line + L_LNNO32 (&lptr),
                     lptr.l_addr.l_paddr
-                    + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT));
+                    + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)));
       else
        break;
     }
@@ -1547,7 +1559,7 @@ process_coff_symbol (cs, aux, objfile)
 
   if (ISFCN (cs->c_type))
     {
-      SYMBOL_VALUE (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+      SYMBOL_VALUE (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
       SYMBOL_TYPE (sym) =
        lookup_function_type (decode_function_type (cs, cs->c_type, aux));
 
@@ -1577,7 +1589,7 @@ process_coff_symbol (cs, aux, objfile)
        case C_EXT:
          SYMBOL_CLASS (sym) = LOC_STATIC;
          SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
-         SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+         SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
          add_symbol_to_list (sym, &global_symbols);
          break;
 
@@ -1586,7 +1598,7 @@ process_coff_symbol (cs, aux, objfile)
        case C_STAT:
          SYMBOL_CLASS (sym) = LOC_STATIC;
          SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
-         SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+         SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
          if (within_function)
            {
              /* Static symbol of local scope */
This page took 0.032499 seconds and 4 git commands to generate.