]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/os9kread.c
Protoization.
[thirdparty/binutils-gdb.git] / gdb / os9kread.c
index 8f439c4d4762753b8b6345cba980e3b557b0d44e..d9fafe553a7d19f1e56d8cd1499dfea9c422270b 100644 (file)
@@ -61,7 +61,7 @@
 #include "os9k.h"
 #include "stabsread.h"
 
-extern void _initialize_os9kread PARAMS ((void));
+extern void _initialize_os9kread (void);
 
 /* Each partial symbol table entry contains a pointer to private data for the
    read_symtab() function to use when expanding a partial symbol table entry
@@ -126,53 +126,41 @@ static struct complaint lbrac_mismatch_complaint =
 \f
 /* Local function prototypes */
 
-static void
-read_minimal_symbols PARAMS ((struct objfile *, struct section_offsets *));
+static void read_minimal_symbols (struct objfile *);
 
-static void
-os9k_read_ofile_symtab PARAMS ((struct partial_symtab *));
+static void os9k_read_ofile_symtab (struct partial_symtab *);
 
-static void
-os9k_psymtab_to_symtab PARAMS ((struct partial_symtab *));
+static void os9k_psymtab_to_symtab (struct partial_symtab *);
 
-static void
-os9k_psymtab_to_symtab_1 PARAMS ((struct partial_symtab *));
+static void os9k_psymtab_to_symtab_1 (struct partial_symtab *);
 
-static void
-read_os9k_psymtab PARAMS ((struct section_offsets *, struct objfile *,
-                          CORE_ADDR, int));
+static void read_os9k_psymtab (struct objfile *, CORE_ADDR, int);
 
-static int
-fill_sym PARAMS ((FILE *, bfd *));
+static int fill_sym (FILE *, bfd *);
 
-static void
-os9k_symfile_init PARAMS ((struct objfile *));
+static void os9k_symfile_init (struct objfile *);
 
-static void
-os9k_new_init PARAMS ((struct objfile *));
+static void os9k_new_init (struct objfile *);
 
-static void
-os9k_symfile_read PARAMS ((struct objfile *, struct section_offsets *, int));
+static void os9k_symfile_read (struct objfile *, int);
 
-static void
-os9k_symfile_finish PARAMS ((struct objfile *));
+static void os9k_symfile_finish (struct objfile *);
 
 static void
-os9k_process_one_symbol PARAMS ((int, int, CORE_ADDR, char *,
-                              struct section_offsets *, struct objfile *));
+os9k_process_one_symbol (int, int, CORE_ADDR, char *,
+                        struct section_offsets *, struct objfile *);
 
-static struct partial_symtab *
-  os9k_start_psymtab PARAMS ((struct objfile *, struct section_offsets *, char *,
-                             CORE_ADDR, int, int, struct partial_symbol **,
-                             struct partial_symbol **));
+static struct partial_symtab *os9k_start_psymtab (struct objfile *, char *,
+                                                 CORE_ADDR, int, int,
+                                                 struct partial_symbol **,
+                                                 struct partial_symbol **);
 
-static struct partial_symtab *
-  os9k_end_psymtab PARAMS ((struct partial_symtab *, char **, int, int, CORE_ADDR,
-                           struct partial_symtab **, int));
+static struct partial_symtab *os9k_end_psymtab (struct partial_symtab *,
+                                               char **, int, int, CORE_ADDR,
+                                               struct partial_symtab **,
+                                               int);
 
-static void
-record_minimal_symbol PARAMS ((char *, CORE_ADDR, int, struct objfile *,
-                              struct section_offsets *));
+static void record_minimal_symbol (char *, CORE_ADDR, int, struct objfile *);
 \f
 #define HANDLE_RBRAC(val) \
   if ((val) > pst->texthigh) pst->texthigh = (val);
@@ -198,12 +186,8 @@ record_minimal_symbol PARAMS ((char *, CORE_ADDR, int, struct objfile *,
 #define N_ABS 6
 
 static void
-record_minimal_symbol (name, address, type, objfile, section_offsets)
-     char *name;
-     CORE_ADDR address;
-     int type;
-     struct objfile *objfile;
-     struct section_offsets *section_offsets;
+record_minimal_symbol (char *name, CORE_ADDR address, int type,
+                      struct objfile *objfile)
 {
   enum minimal_symbol_type ms_type;
 
@@ -211,7 +195,7 @@ record_minimal_symbol (name, address, type, objfile, section_offsets)
     {
     case N_TEXT:
       ms_type = mst_text;
-      address += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+      address += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
       break;
     case N_DATA:
       ms_type = mst_data;
@@ -257,9 +241,7 @@ struct stbsymbol
 #define STBSYMSIZE 10
 
 static void
-read_minimal_symbols (objfile, section_offsets)
-     struct objfile *objfile;
-     struct section_offsets *section_offsets;
+read_minimal_symbols (struct objfile *objfile)
 {
   FILE *fp;
   bfd *abfd;
@@ -314,7 +296,7 @@ read_minimal_symbols (objfile, section_offsets)
            break;
          ch = getc (fp);
        };
-      record_minimal_symbol (buf1, sym.value, sym.type & 7, objfile, section_offsets);
+      record_minimal_symbol (buf1, sym.value, sym.type & 7, objfile);
       off += STBSYMSIZE;
     };
   install_minimal_symbols (objfile);
@@ -326,15 +308,12 @@ read_minimal_symbols (objfile, section_offsets)
    put all the relevant info into a "struct os9k_symfile_info",
    hung off the objfile structure.
 
-   SECTION_OFFSETS contains offsets relative to which the symbols in the
-   various sections are (depending where the sections were actually loaded).
    MAINLINE is true if we are reading the main symbol
    table (as opposed to a shared lib or dynamically loaded file).  */
 
 static void
-os9k_symfile_read (objfile, section_offsets, mainline)
+os9k_symfile_read (objfile, mainline)
      struct objfile *objfile;
-     struct section_offsets *section_offsets;
      int mainline;             /* FIXME comments above */
 {
   bfd *sym_bfd;
@@ -349,12 +328,12 @@ os9k_symfile_read (objfile, section_offsets, mainline)
   free_pending_blocks ();
   back_to = make_cleanup (really_free_pendings, 0);
 
-  make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
-  read_minimal_symbols (objfile, section_offsets);
+  make_cleanup_discard_minimal_symbols ();
+  read_minimal_symbols (objfile);
 
   /* Now that the symbol table data of the executable file are all in core,
      process them and define symbols accordingly.  */
-  read_os9k_psymtab (section_offsets, objfile,
+  read_os9k_psymtab (objfile,
                     DBX_TEXT_ADDR (objfile),
                     DBX_TEXT_SIZE (objfile));
 
@@ -366,8 +345,7 @@ os9k_symfile_read (objfile, section_offsets, mainline)
    file, e.g. a shared library).  */
 
 static void
-os9k_new_init (ignore)
-     struct objfile *ignore;
+os9k_new_init (struct objfile *ignore)
 {
   stabsread_new_init ();
   buildsym_new_init ();
@@ -388,8 +366,7 @@ os9k_new_init (ignore)
    FIXME, there should be a cleaner peephole into the BFD environment here.  */
 
 static void
-os9k_symfile_init (objfile)
-     struct objfile *objfile;
+os9k_symfile_init (struct objfile *objfile)
 {
   bfd *sym_bfd = objfile->obfd;
   char *name = bfd_get_filename (sym_bfd);
@@ -437,8 +414,7 @@ os9k_symfile_init (objfile)
    objfile struct from the global list of known objfiles. */
 
 static void
-os9k_symfile_finish (objfile)
-     struct objfile *objfile;
+os9k_symfile_finish (struct objfile *objfile)
 {
   if (objfile->sym_stab_info != NULL)
     {
@@ -493,9 +469,7 @@ static short cmplrid;
 #define VER_ULTRAC     ((short)5)
 
 static int
-fill_sym (dbg_file, abfd)
-     FILE *dbg_file;
-     bfd *abfd;
+fill_sym (FILE *dbg_file, bfd *abfd)
 {
   short si, nmask;
   long li;
@@ -566,16 +540,10 @@ fill_sym (dbg_file, abfd)
 /* Given pointers to an a.out symbol table in core containing dbx
    style data, setup partial_symtab's describing each source file for
    which debugging information is available.
-   SYMFILE_NAME is the name of the file we are reading from
-   and SECTION_OFFSETS is the set of offsets for the various sections
-   of the file (a set of zeros if the mainline program).  */
+   SYMFILE_NAME is the name of the file we are reading from. */
 
 static void
-read_os9k_psymtab (section_offsets, objfile, text_addr, text_size)
-     struct section_offsets *section_offsets;
-     struct objfile *objfile;
-     CORE_ADDR text_addr;
-     int text_size;
+read_os9k_psymtab (struct objfile *objfile, CORE_ADDR text_addr, int text_size)
 {
   register struct internal_symstruct *bufp = 0;                /* =0 avoids gcc -Wall glitch */
   register char *namestring;
@@ -618,7 +586,7 @@ read_os9k_psymtab (section_offsets, objfile, text_addr, text_size)
 #ifdef END_OF_TEXT_DEFAULT
   end_of_text_addr = END_OF_TEXT_DEFAULT;
 #else
-  end_of_text_addr = text_addr + section_offsets->offsets[SECT_OFF_TEXT]
+  end_of_text_addr = text_addr + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))
     + text_size;               /* Relocate */
 #endif
 
@@ -665,7 +633,7 @@ read_os9k_psymtab (section_offsets, objfile, text_addr, text_size)
          continue;
 
        case N_SYM_SE:
-         CUR_SYMBOL_VALUE += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+         CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
          if (psymfile_depth == 1 && pst)
            {
              os9k_end_psymtab (pst, psymtab_include_list, includes_used,
@@ -702,7 +670,7 @@ read_os9k_psymtab (section_offsets, objfile, text_addr, text_size)
 
                valu = CUR_SYMBOL_VALUE;
                if (valu)
-                 valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+                 valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
                past_first_source_file = 1;
 
                p = strchr (namestring, ':');
@@ -717,7 +685,7 @@ read_os9k_psymtab (section_offsets, objfile, text_addr, text_size)
                if (psymfile_depth == 0)
                  {
                    if (!pst)
-                     pst = os9k_start_psymtab (objfile, section_offsets,
+                     pst = os9k_start_psymtab (objfile,
                                                str, valu,
                                                cursymoffset,
                                                symnum - 1,
@@ -894,7 +862,7 @@ read_os9k_psymtab (section_offsets, objfile, text_addr, text_size)
              continue;
 
            case 'f':
-             CUR_SYMBOL_VALUE += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+             CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
              if (pst && pst->textlow == 0)
                pst->textlow = CUR_SYMBOL_VALUE;
 
@@ -905,7 +873,7 @@ read_os9k_psymtab (section_offsets, objfile, text_addr, text_size)
              continue;
 
            case 'F':
-             CUR_SYMBOL_VALUE += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+             CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
              if (pst && pst->textlow == 0)
                pst->textlow = CUR_SYMBOL_VALUE;
 
@@ -943,7 +911,7 @@ read_os9k_psymtab (section_offsets, objfile, text_addr, text_size)
            }
 
        case N_SYM_RBRAC:
-         CUR_SYMBOL_VALUE += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+         CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 #ifdef HANDLE_RBRAC
          HANDLE_RBRAC (CUR_SYMBOL_VALUE);
          continue;
@@ -993,19 +961,13 @@ read_os9k_psymtab (section_offsets, objfile, text_addr, text_size)
 
 
 static struct partial_symtab *
-os9k_start_psymtab (objfile, section_offsets,
-           filename, textlow, ldsymoff, ldsymcnt, global_syms, static_syms)
-     struct objfile *objfile;
-     struct section_offsets *section_offsets;
-     char *filename;
-     CORE_ADDR textlow;
-     int ldsymoff;
-     int ldsymcnt;
-     struct partial_symbol **global_syms;
-     struct partial_symbol **static_syms;
+os9k_start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow,
+                   int ldsymoff, int ldsymcnt,
+                   struct partial_symbol **global_syms,
+                   struct partial_symbol **static_syms)
 {
   struct partial_symtab *result =
-  start_psymtab_common (objfile, section_offsets,
+  start_psymtab_common (objfile, objfile->section_offsets,
                        filename, textlow, global_syms, static_syms);
 
   result->read_symtab_private = (char *)
@@ -1209,8 +1171,7 @@ os9k_end_psymtab (pst, include_list, num_includes, capping_symbol_cnt,
 }
 \f
 static void
-os9k_psymtab_to_symtab_1 (pst)
-     struct partial_symtab *pst;
+os9k_psymtab_to_symtab_1 (struct partial_symtab *pst)
 {
   struct cleanup *old_chain;
   int i;
@@ -1263,8 +1224,7 @@ os9k_psymtab_to_symtab_1 (pst)
    Be verbose about it if the user wants that.  */
 
 static void
-os9k_psymtab_to_symtab (pst)
-     struct partial_symtab *pst;
+os9k_psymtab_to_symtab (struct partial_symtab *pst)
 {
   bfd *sym_bfd;
 
@@ -1303,8 +1263,7 @@ os9k_psymtab_to_symtab (pst)
 
 /* Read in a defined section of a specific object file's symbols. */
 static void
-os9k_read_ofile_symtab (pst)
-     struct partial_symtab *pst;
+os9k_read_ofile_symtab (struct partial_symtab *pst)
 {
   register struct internal_symstruct *bufp;
   unsigned char type;
@@ -1314,7 +1273,6 @@ os9k_read_ofile_symtab (pst)
   int sym_offset;              /* Offset to start of symbols to read */
   CORE_ADDR text_offset;       /* Start of text segment for symbols */
   int text_size;               /* Size of text segment for symbols */
-  struct section_offsets *section_offsets;
   FILE *dbg_file;
 
   objfile = pst->objfile;
@@ -1322,7 +1280,6 @@ os9k_read_ofile_symtab (pst)
   max_symnum = LDSYMCNT (pst);
   text_offset = pst->textlow;
   text_size = pst->texthigh - pst->textlow;
-  section_offsets = pst->section_offsets;
 
   current_objfile = objfile;
   subfile_stack = NULL;
@@ -1387,7 +1344,7 @@ os9k_read_ofile_symtab (pst)
       type = bufp->n_type;
 
       os9k_process_one_symbol ((int) type, (int) bufp->n_desc,
-        (CORE_ADDR) bufp->n_value, bufp->n_strx, section_offsets, objfile);
+        (CORE_ADDR) bufp->n_value, bufp->n_strx, pst->section_offsets, objfile);
 
       /* We skip checking for a new .o or -l file; that should never
          happen in this routine. */
@@ -1436,7 +1393,7 @@ os9k_read_ofile_symtab (pst)
      which comes from pst->textlow is correct. */
   if (last_source_start_addr == 0)
     last_source_start_addr = text_offset;
-  pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT);
+  pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile));
   end_stabs ();
 }
 \f
@@ -1456,12 +1413,9 @@ os9k_read_ofile_symtab (pst)
    It is used in end_symtab.  */
 
 static void
-os9k_process_one_symbol (type, desc, valu, name, section_offsets, objfile)
-     int type, desc;
-     CORE_ADDR valu;
-     char *name;
-     struct section_offsets *section_offsets;
-     struct objfile *objfile;
+os9k_process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
+                        struct section_offsets *section_offsets,
+                        struct objfile *objfile)
 {
   register struct context_stack *new;
   /* The stab type used for the definition of the last function.
@@ -1486,12 +1440,12 @@ os9k_process_one_symbol (type, desc, valu, name, section_offsets, objfile)
     case N_SYM_LBRAC:
       /* On most machines, the block addresses are relative to the
          N_SO, the linker did not relocate them (sigh).  */
-      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
       new = push_context (desc, valu);
       break;
 
     case N_SYM_RBRAC:
-      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
       new = pop_context ();
 
 #if !defined (OS9K_VARIABLES_INSIDE_BLOCK)
@@ -1560,7 +1514,7 @@ os9k_process_one_symbol (type, desc, valu, name, section_offsets, objfile)
          one line-number -- core-address correspondence.
          Enter it in the line list for this symbol table. */
       /* Relocate for dynamic loading and for ELF acc fn-relative syms.  */
-      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
       /* FIXME: loses if sizeof (char *) > sizeof (int) */
       record_line (current_subfile, (int) name, valu);
       break;
@@ -1583,7 +1537,7 @@ os9k_process_one_symbol (type, desc, valu, name, section_offsets, objfile)
          switch (deftype)
            {
            case 'S':
-             valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+             valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
              n = strrchr (name, '/');
              if (n != NULL)
                {
@@ -1601,7 +1555,7 @@ os9k_process_one_symbol (type, desc, valu, name, section_offsets, objfile)
                {
                  if (last_source_file)
                    {
-                     end_symtab (valu, objfile, SECT_OFF_TEXT);
+                     end_symtab (valu, objfile, SECT_OFF_TEXT (objfile));
                      end_stabs ();
                    }
                  start_stabs ();
@@ -1618,7 +1572,7 @@ os9k_process_one_symbol (type, desc, valu, name, section_offsets, objfile)
 
            case 'f':
            case 'F':
-             valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+             valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
              function_stab_type = type;
 
              within_function = 1;
@@ -1628,7 +1582,7 @@ os9k_process_one_symbol (type, desc, valu, name, section_offsets, objfile)
 
            case 'V':
            case 'v':
-             valu += ANOFFSET (section_offsets, SECT_OFF_DATA);
+             valu += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
              define_symbol (valu, name, desc, type, objfile);
              break;
 
@@ -1663,13 +1617,12 @@ static struct sym_fns os9k_sym_fns =
   os9k_symfile_init,           /* sym_init: read initial info, setup for sym_read() */
   os9k_symfile_read,           /* sym_read: read a symbol file into symtab */
   os9k_symfile_finish,         /* sym_finish: finished with file, cleanup */
-  default_symfile_offsets,
-                       /* sym_offsets: parse user's offsets to internal form */
+  default_symfile_offsets,     /* sym_offsets: parse user's offsets to internal form */
   NULL                         /* next: pointer to next struct sym_fns */
 };
 
 void
-_initialize_os9kread ()
+_initialize_os9kread (void)
 {
   add_symtab_fns (&os9k_sym_fns);
 }