2002-02-10 Daniel Jacobowitz <drow@mvista.com>
[deliverable/binutils-gdb.git] / gdb / dstread.c
index 1561586bf215fc1b67d9480223b5646306d4d59d..c3a73f064cdd4e0bd50220d329d80c46153b6158 100644 (file)
@@ -1,6 +1,7 @@
 /* Read apollo DST symbol tables and convert to internal format, for GDB.
    Contributed by Troy Rollo, University of NSW (troy@cbme.unsw.edu.au).
-   Copyright 1993 Free Software Foundation, Inc.
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -52,46 +53,33 @@ static int prev_line_number;
 
 static int line_vector_length;
 
-static int
-init_dst_sections PARAMS ((int));
+static int init_dst_sections (int);
 
-static void
-read_dst_symtab PARAMS ((struct objfile *));
+static void read_dst_symtab (struct objfile *);
 
-static void
-find_dst_sections PARAMS ((bfd *, sec_ptr, PTR));
+static void find_dst_sections (bfd *, sec_ptr, PTR);
 
-static void
-dst_symfile_init PARAMS ((struct objfile *));
+static void dst_symfile_init (struct objfile *);
 
-static void
-dst_new_init PARAMS ((struct objfile *));
+static void dst_new_init (struct objfile *);
 
-static void
-dst_symfile_read PARAMS ((struct objfile *, struct section_offsets *, int));
+static void dst_symfile_read (struct objfile *, int);
 
-static void
-dst_symfile_finish PARAMS ((struct objfile *));
+static void dst_symfile_finish (struct objfile *);
 
-static void
-dst_end_symtab PARAMS ((struct objfile *));
+static void dst_end_symtab (struct objfile *);
 
-static void
-complete_symtab PARAMS ((char *, CORE_ADDR, unsigned int));
+static void complete_symtab (char *, CORE_ADDR, unsigned int);
 
-static void
-dst_start_symtab PARAMS ((void));
+static void dst_start_symtab (void);
 
-static void
-dst_record_line PARAMS ((int, CORE_ADDR));
+static void dst_record_line (int, CORE_ADDR);
 
 /* Manage the vector of line numbers.  */
 /* FIXME: Use record_line instead.  */
 
 static void
-dst_record_line (line, pc)
-     int line;
-     CORE_ADDR pc;
+dst_record_line (int line, CORE_ADDR pc)
 {
   struct linetable_entry *e;
   /* Make sure line vector is big enough.  */
@@ -115,12 +103,12 @@ dst_record_line (line, pc)
 /* FIXME: use start_symtab, like coffread.c now does.  */
 
 static void
-dst_start_symtab ()
+dst_start_symtab (void)
 {
   /* Initialize the source file line number information for this file.  */
 
   if (line_vector)             /* Unlikely, but maybe possible? */
-    free ((PTR) line_vector);
+    xfree (line_vector);
   line_vector_index = 0;
   line_vector_length = 1000;
   prev_line_number = -2;       /* Force first line number to be explicit */
@@ -135,10 +123,7 @@ dst_start_symtab ()
    text address for the file, and SIZE is the number of bytes of text.  */
 
 static void
-complete_symtab (name, start_addr, size)
-     char *name;
-     CORE_ADDR start_addr;
-     unsigned int size;
+complete_symtab (char *name, CORE_ADDR start_addr, unsigned int size)
 {
   last_source_file = savestring (name, strlen (name));
   cur_src_start_addr = start_addr;
@@ -159,8 +144,7 @@ complete_symtab (name, start_addr, size)
 /* FIXME: Use end_symtab, like coffread.c now does.  */
 
 static void
-dst_end_symtab (objfile)
-     struct objfile *objfile;
+dst_end_symtab (struct objfile *objfile)
 {
   register struct symtab *symtab;
   register struct blockvector *blockvector;
@@ -205,8 +189,7 @@ dst_end_symtab (objfile)
    The ultimate result is a new symtab (or, FIXME, eventually a psymtab).  */
 
 static void
-dst_symfile_init (objfile)
-     struct objfile *objfile;
+dst_symfile_init (struct objfile *objfile)
 {
   asection *section;
   bfd *abfd = objfile->obfd;
@@ -221,10 +204,7 @@ dst_symfile_init (objfile)
 
 /* ARGSUSED */
 static void
-find_dst_sections (abfd, asect, vpinfo)
-     bfd *abfd;
-     sec_ptr asect;
-     PTR vpinfo;
+find_dst_sections (bfd *abfd, sec_ptr asect, PTR vpinfo)
 {
   int size, count;
   long base;
@@ -263,10 +243,7 @@ static bfd *symfile_bfd;
 
 /* ARGSUSED */
 static void
-dst_symfile_read (objfile, section_offsets, mainline)
-     struct objfile *objfile;
-     struct section_offsets *section_offsets;
-     int mainline;
+dst_symfile_read (struct objfile *objfile, int mainline)
 {
   bfd *abfd = objfile->obfd;
   char *name = bfd_get_filename (abfd);
@@ -289,7 +266,7 @@ dst_symfile_read (objfile, section_offsets, mainline)
     error ("\"%s\": error reading debugging symbol tables\n", name);
 
   init_minimal_symbol_collection ();
-  make_cleanup (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.  */
@@ -313,8 +290,7 @@ dst_symfile_read (objfile, section_offsets, mainline)
 }
 
 static void
-dst_new_init (ignore)
-     struct objfile *ignore;
+dst_new_init (struct objfile *ignore)
 {
   /* Nothin' to do */
 }
@@ -325,8 +301,7 @@ dst_new_init (ignore)
    objfile struct from the global list of known objfiles. */
 
 static void
-dst_symfile_finish (objfile)
-     struct objfile *objfile;
+dst_symfile_finish (struct objfile *objfile)
 {
   /* Nothing to do */
 }
@@ -339,9 +314,7 @@ dst_symfile_finish (objfile)
  * this is what was really intended.
  */
 static int
-get_dst_line (buffer, pc)
-     signed char **buffer;
-     long *pc;
+get_dst_line (signed char **buffer, long *pc)
 {
   static last_pc = 0;
   static long last_line = 0;
@@ -445,18 +418,14 @@ get_dst_line (buffer, pc)
 }
 
 static void
-enter_all_lines (buffer, address)
-     char *buffer;
-     long address;
+enter_all_lines (char *buffer, long address)
 {
   if (buffer)
     while (get_dst_line (&buffer, &address));
 }
 
 static int
-get_dst_entry (buffer, ret_entry)
-     char *buffer;
-     dst_rec_ptr_t *ret_entry;
+get_dst_entry (char *buffer, dst_rec_ptr_t *ret_entry)
 {
   int size;
   dst_rec_ptr_t entry;
@@ -678,10 +647,7 @@ get_dst_entry (buffer, ret_entry)
 }
 
 static int
-next_dst_entry (buffer, entry, table)
-     char **buffer;
-     dst_rec_ptr_t *entry;
-     dst_sec *table;
+next_dst_entry (char **buffer, dst_rec_ptr_t *entry, dst_sec *table)
 {
   if (*buffer - table->buffer >= table->size)
     {
@@ -699,8 +665,7 @@ next_dst_entry (buffer, entry, table)
 static dst_rec_ptr_t section_table = NULL;
 
 char *
-get_sec_ref (ref)
-     dst_sect_ref_t *ref;
+get_sec_ref (dst_sect_ref_t *ref)
 {
   dst_sec *section = NULL;
   long offset;
@@ -732,8 +697,7 @@ dst_get_addr (int section, long offset)
 }
 
 CORE_ADDR
-dst_sym_addr (ref)
-     dst_sect_ref_t *ref;
+dst_sym_addr (dst_sect_ref_t *ref)
 {
   if (!section_table || !ref->sect_index)
     return 0;
@@ -742,8 +706,7 @@ dst_sym_addr (ref)
 }
 
 static struct type *
-create_new_type (objfile)
-     struct objfile *objfile;
+create_new_type (struct objfile *objfile)
 {
   struct type *type;
 
@@ -754,9 +717,7 @@ create_new_type (objfile)
 }
 
 static struct symbol *
-create_new_symbol (objfile, name)
-     struct objfile *objfile;
-     char *name;
+create_new_symbol (struct objfile *objfile, char *name)
 {
   struct symbol *sym = (struct symbol *)
   obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
@@ -770,14 +731,11 @@ create_new_symbol (objfile, name)
   return sym;
 };
 
-static struct type *
-  decode_dst_type PARAMS ((struct objfile *, dst_rec_ptr_t));
+static struct type *decode_dst_type (struct objfile *, dst_rec_ptr_t);
 
 static struct type *
-decode_type_desc (objfile, type_desc, base)
-     struct objfile *objfile;
-     dst_type_t *type_desc;
-     dst_rec_ptr_t base;
+decode_type_desc (struct objfile *objfile, dst_type_t *type_desc,
+                 dst_rec_ptr_t base)
 {
   struct type *type;
   dst_rec_ptr_t entry;
@@ -875,8 +833,7 @@ struct structure_list
 static struct structure_list *struct_list = NULL;
 
 static struct type *
-find_dst_structure (name)
-     char *name;
+find_dst_structure (char *name)
 {
   struct structure_list *element;
 
@@ -888,11 +845,8 @@ find_dst_structure (name)
 
 
 static struct type *
-decode_dst_structure (objfile, entry, code, version)
-     struct objfile *objfile;
-     dst_rec_ptr_t entry;
-     int code;
-     int version;
+decode_dst_structure (struct objfile *objfile, dst_rec_ptr_t entry, int code,
+                     int version)
 {
   struct type *type, *child_type;
   char *struct_name;
@@ -908,13 +862,13 @@ decode_dst_structure (objfile, entry, code, version)
   type = find_dst_structure (name);
   if (type)
     {
-      free ((PTR) name);
+      xfree (name);
       return type;
     }
   type = create_new_type (objfile);
   TYPE_NAME (type) = obstack_copy0 (&objfile->symbol_obstack,
                                    name, strlen (name));
-  free ((PTR) name);
+  xfree (name);
   TYPE_CODE (type) = code;
   TYPE_LENGTH (type) = DST_record (entry).size;
   TYPE_NFIELDS (type) = DST_record (entry).nfields;
@@ -994,9 +948,7 @@ decode_dst_structure (objfile, entry, code, version)
 }
 
 static struct type *
-decode_dst_type (objfile, entry)
-     struct objfile *objfile;
-     dst_rec_ptr_t entry;
+decode_dst_type (struct objfile *objfile, dst_rec_ptr_t entry)
 {
   struct type *child_type, *type, *range_type, *index_type;
 
@@ -1060,9 +1012,7 @@ static struct symbol_list *dst_global_symbols = NULL;
 static int total_globals = 0;
 
 static void
-decode_dst_locstring (locstr, sym)
-     char *locstr;
-     struct symbol *sym;
+decode_dst_locstring (char *locstr, struct symbol *sym)
 {
   dst_loc_entry_t *entry, *next_entry;
   CORE_ADDR temp;
@@ -1179,11 +1129,8 @@ decode_dst_locstring (locstr, sym)
 }
 
 static struct symbol_list *
-process_dst_symbols (objfile, entry, name, nsyms_ret)
-     struct objfile *objfile;
-     dst_rec_ptr_t entry;
-     char *name;
-     int *nsyms_ret;
+process_dst_symbols (struct objfile *objfile, dst_rec_ptr_t entry, char *name,
+                    int *nsyms_ret)
 {
   struct symbol_list *list = NULL, *element;
   struct symbol *sym;
@@ -1321,11 +1268,8 @@ process_dst_symbols (objfile, entry, name, nsyms_ret)
 
 
 static struct symbol *
-process_dst_function (objfile, entry, name, address)
-     struct objfile *objfile;
-     dst_rec_ptr_t entry;
-     char *name;
-     CORE_ADDR address;
+process_dst_function (struct objfile *objfile, dst_rec_ptr_t entry, char *name,
+                     CORE_ADDR address)
 {
   struct symbol *sym;
   struct type *type, *ftype;
@@ -1382,9 +1326,7 @@ process_dst_function (objfile, entry, name, address)
 }
 
 static struct block *
-process_dst_block (objfile, entry)
-     struct objfile *objfile;
-     dst_rec_ptr_t entry;
+process_dst_block (struct objfile *objfile, dst_rec_ptr_t entry)
 {
   struct block *block;
   struct symbol *function = NULL;
@@ -1460,7 +1402,7 @@ process_dst_block (objfile, entry)
 
       block->sym[symnum] = symlist->symbol;
 
-      free ((PTR) symlist);
+      xfree (symlist);
       symlist = nextsym;
       symnum++;
     }
@@ -1511,8 +1453,7 @@ process_dst_block (objfile, entry)
 
 
 static void
-read_dst_symtab (objfile)
-     struct objfile *objfile;
+read_dst_symtab (struct objfile *objfile)
 {
   char *buffer;
   dst_rec_ptr_t entry, file_table, root_block;
@@ -1557,7 +1498,7 @@ read_dst_symtab (objfile)
              global_block->sym[symnum] =
                dst_global_symbols->symbol;
 
-             free ((PTR) dst_global_symbols);
+             xfree (dst_global_symbols);
              dst_global_symbols = nextsym;
            }
          dst_global_symbols = NULL;
@@ -1594,7 +1535,7 @@ read_dst_symtab (objfile)
     {
       element = struct_list;
       struct_list = element->next;
-      free ((PTR) element);
+      xfree (element);
     }
 }
 \f
@@ -1608,9 +1549,7 @@ static unsigned long linetab_size;
    external (unswapped) format in memory; we'll swap them as we enter
    them into GDB's data structures.  */
 static int
-init_one_section (chan, secinfo)
-     int chan;
-     dst_sec *secinfo;
+init_one_section (int chan, dst_sec *secinfo)
 {
   if (secinfo->size == 0
       || lseek (chan, secinfo->position, 0) == -1
@@ -1622,8 +1561,7 @@ init_one_section (chan, secinfo)
 }
 
 static int
-init_dst_sections (chan)
-     int chan;
+init_dst_sections (int chan)
 {
 
   if (!init_one_section (chan, &blocks_info) ||
@@ -1639,13 +1577,11 @@ init_dst_sections (chan)
 struct section_offsets dst_symfile_faker =
 {0};
 
-struct section_offsets *
-dst_symfile_offsets (objfile, addr)
-     struct objfile *objfile;
-     CORE_ADDR addr;
+void
+dst_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs)
 {
   objfile->num_sections = 1;
-  return &dst_symfile_faker;
+  objfile->section_offsets = &dst_symfile_faker;
 }
 
 /* Register our ability to parse symbols for DST BFD files */
@@ -1665,7 +1601,7 @@ static struct sym_fns dst_sym_fns =
 };
 
 void
-_initialize_dstread ()
+_initialize_dstread (void)
 {
   add_symtab_fns (&dst_sym_fns);
 }
This page took 0.029973 seconds and 4 git commands to generate.