Fix warnings resulting from fact that GET_LWP() now returns a long rather
[deliverable/binutils-gdb.git] / gdb / hp-psymtab-read.c
index 5926ada3f3e7b5320345e0591a5deebf108aab8b..ad001d300d65b19c4a5f300a1889d8e389d5dd49 100644 (file)
@@ -1,5 +1,5 @@
 /* Read hp debug symbols and convert to internal format, for GDB.
-   Copyright 1993, 1996, 1998, 1999 Free Software Foundation, Inc.
+   Copyright 1993, 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -15,7 +15,8 @@
 
    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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
 
    Written by the Center for Software Science at the University of Utah
    and by Cygnus Support.  */
 
 /* Forward procedure declarations */
 
-void hpread_symfile_init
-  PARAMS ((struct objfile *));
+void hpread_symfile_init (struct objfile *);
 
-void
-do_pxdb PARAMS ((bfd *));
+void do_pxdb (bfd *);
 
-void hpread_build_psymtabs
-  PARAMS ((struct objfile *, struct section_offsets *, int));
+void hpread_build_psymtabs (struct objfile *, int);
 
-void hpread_symfile_finish
-  PARAMS ((struct objfile *));
+void hpread_symfile_finish (struct objfile *);
 
-static union dnttentry *hpread_get_gntt
-  PARAMS ((int, struct objfile *));
+static union dnttentry *hpread_get_gntt (int, struct objfile *);
 
-static unsigned long hpread_get_textlow
-  PARAMS ((int, int, struct objfile *, int));
+static unsigned long hpread_get_textlow (int, int, struct objfile *, int);
 
 static struct partial_symtab *hpread_start_psymtab
-  PARAMS ((struct objfile *, struct section_offsets *, char *, CORE_ADDR, int,
-          struct partial_symbol **, struct partial_symbol **));
+  (struct objfile *, char *, CORE_ADDR, int,
+   struct partial_symbol **, struct partial_symbol **);
 
 static struct partial_symtab *hpread_end_psymtab
-  PARAMS ((struct partial_symtab *, char **, int, int, CORE_ADDR,
-          struct partial_symtab **, int));
+  (struct partial_symtab *, char **, int, int, CORE_ADDR,
+   struct partial_symtab **, int);
 
 /* End of forward routine declarations */
 
@@ -74,12 +69,10 @@ static struct partial_symtab *hpread_end_psymtab
 
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 
-/* check for the existance of a file, given its full pathname */
+/* check for the existence of a file, given its full pathname */
 int
-file_exists (filename)
-     char *filename;
+file_exists (char *filename)
 {
   if (filename)
     return (access (filename, F_OK) == 0);
@@ -90,8 +83,7 @@ file_exists (filename)
 /* Translate from the "hp_language" enumeration in hp-symtab.h
    used in the debug info to gdb's generic enumeration in defs.h. */
 static enum language
-trans_lang (in_lang)
-     enum hp_language in_lang;
+trans_lang (enum hp_language in_lang)
 {
   if (in_lang == HP_LANGUAGE_C)
     return language_c;
@@ -99,7 +91,7 @@ trans_lang (in_lang)
   else if (in_lang == HP_LANGUAGE_CPLUSPLUS)
     return language_cplus;
 
-  else if (in_lang == HP_LANGUAGE_F77)
+  else if (in_lang == HP_LANGUAGE_FORTRAN)
     return language_fortran;
 
   else
@@ -111,15 +103,14 @@ static char main_string[] = "main";
 /* Call PXDB to process our file.
 
    Approach copied from DDE's "dbgk_run_pxdb".  Note: we
-   don't check for BSD location of pxdb, nor for existance
+   don't check for BSD location of pxdb, nor for existence
    of pxdb itself, etc.
 
    NOTE: uses system function and string functions directly.
 
    Return value: 1 if ok, 0 if not */
 int
-hpread_call_pxdb (file_name)
-     char *file_name;
+hpread_call_pxdb (char *file_name)
 {
   char *p;
   int status;
@@ -127,7 +118,7 @@ hpread_call_pxdb (file_name)
 
   if (file_exists (PXDB_SVR4))
     {
-      p = malloc (strlen (PXDB_SVR4) + strlen (file_name) + 2);
+      p = xmalloc (strlen (PXDB_SVR4) + strlen (file_name) + 2);
       strcpy (p, PXDB_SVR4);
       strcat (p, " ");
       strcat (p, file_name);
@@ -152,8 +143,7 @@ hpread_call_pxdb (file_name)
    and the file therefore needs to be re-loaded.  Otherwise
    return 0. */
 int
-hpread_pxdb_needed (sym_bfd)
-     bfd *sym_bfd;
+hpread_pxdb_needed (bfd *sym_bfd)
 {
   asection *pinfo_section, *debug_section, *header_section;
   unsigned int do_pxdb;
@@ -282,9 +272,8 @@ hpread_pxdb_needed (sym_bfd)
 /* Check whether the file needs to be preprocessed by pxdb. 
    If so, call pxdb. */
 
-void 
-do_pxdb (sym_bfd)
-     bfd *sym_bfd;
+void
+do_pxdb (bfd *sym_bfd)
 {
   /* The following code is HP-specific.  The "right" way of
      doing this is unknown, but we bet would involve a target-
@@ -292,22 +281,22 @@ do_pxdb (sym_bfd)
 
   /* This code will not be executed if the file is not in SOM
      format (i.e. if compiled with gcc) */
-    if (hpread_pxdb_needed (sym_bfd)) 
-      {
-       /*This file has not been pre-processed. Preprocess now */
-         
-       if (hpread_call_pxdb (sym_bfd->filename))
-         {
-           /* The call above has changed the on-disk file, 
-               we can close the file anyway, because the
-              symbols will be reread in when the target is run */
-           bfd_close (sym_bfd); 
-         }
-      }
-}
+  if (hpread_pxdb_needed (sym_bfd))
+    {
+      /*This file has not been pre-processed. Preprocess now */
 
+      if (hpread_call_pxdb (sym_bfd->filename))
+       {
+         /* The call above has changed the on-disk file, 
+            we can close the file anyway, because the
+            symbols will be reread in when the target is run */
+         bfd_close (sym_bfd);
+       }
+    }
+}
 \f
 
+
 #ifdef QUICK_LOOK_UP
 
 /* Code to handle quick lookup-tables follows. */
@@ -363,10 +352,10 @@ do_pxdb (sym_bfd)
    psymtabs created so far */
 
 typedef struct
-  {
-    int start;
-    int end;
-  }
+{
+  int start;
+  int end;
+}
 pst_syms_struct;
 
 static pst_syms_struct *pst_syms_array = 0;
@@ -379,7 +368,7 @@ static boolean told_objfile = 0;
 
 /* Set up psymtab symbol index stuff */
 static void
-init_pst_syms ()
+init_pst_syms (void)
 {
   pst_syms_count = 0;
   pst_syms_size = 20;
@@ -388,19 +377,17 @@ init_pst_syms ()
 
 /* Clean up psymtab symbol index stuff */
 static void
-clear_pst_syms ()
+clear_pst_syms (void)
 {
   pst_syms_count = 0;
   pst_syms_size = 0;
-  free (pst_syms_array);
+  xfree (pst_syms_array);
   pst_syms_array = 0;
 }
 
 /* Add information about latest psymtab to symbol index table */
 static void
-record_pst_syms (start_sym, end_sym)
-     int start_sym;
-     int end_sym;
+record_pst_syms (int start_sym, int end_sym)
 {
   if (++pst_syms_count > pst_syms_size)
     {
@@ -422,8 +409,7 @@ record_pst_syms (start_sym, end_sym)
 
    Return 0 => not found */
 static int
-find_next_pst_start (index)
-     int index;
+find_next_pst_start (int index)
 {
   int i;
 
@@ -448,11 +434,8 @@ find_next_pst_start (index)
 
    Return 0 => not found */
 static int
-find_next_file_isym (index, qFD, curr_fd, pxdb_header_p)
-     int index;
-     quick_file_entry *qFD;
-     int curr_fd;
-     PXDB_header_ptr pxdb_header_p;
+find_next_file_isym (int index, quick_file_entry *qFD, int curr_fd,
+                    PXDB_header_ptr pxdb_header_p)
 {
   while (VALID_CURR_FILE)
     {
@@ -470,11 +453,8 @@ find_next_file_isym (index, qFD, curr_fd, pxdb_header_p)
 
    Return 0 => not found */
 static int
-find_next_proc_isym (index, qPD, curr_pd, pxdb_header_p)
-     int index;
-     quick_procedure_entry *qPD;
-     int curr_pd;
-     PXDB_header_ptr pxdb_header_p;
+find_next_proc_isym (int index, quick_procedure_entry *qPD, int curr_pd,
+                    PXDB_header_ptr pxdb_header_p)
 {
   while (VALID_CURR_PROC)
     {
@@ -492,11 +472,8 @@ find_next_proc_isym (index, qPD, curr_pd, pxdb_header_p)
 
    Return 0 => not found */
 static int
-find_next_module_isym (index, qMD, curr_md, pxdb_header_p)
-     int index;
-     quick_module_entry *qMD;
-     int curr_md;
-     PXDB_header_ptr pxdb_header_p;
+find_next_module_isym (int index, quick_module_entry *qMD, int curr_md,
+                      PXDB_header_ptr pxdb_header_p)
 {
   while (VALID_CURR_MODULE)
     {
@@ -511,21 +488,23 @@ find_next_module_isym (index, qMD, curr_md, pxdb_header_p)
    pointed to by CURR_PD_P, and between code addresses START_ADR and END_ADR.
    Other parameters are explained in comments below. */
 
-/* This used to be inline in hpread_quick_traverse, but now that we do essentially the
-   same thing for two different cases (modules and module-less files), it's better
-   organized in a separate routine, although it does take lots of arguments. pai/1997-10-08 */
+/* This used to be inline in hpread_quick_traverse, but now that we do
+   essentially the same thing for two different cases (modules and
+   module-less files), it's better organized in a separate routine,
+   although it does take lots of arguments.  pai/1997-10-08
+   
+   CURR_PD_P is the pointer to the current proc index. QPD is the
+   procedure quick lookup table.  MAX_PROCS is the number of entries
+   in the proc. table.  START_ADR is the beginning of the code range
+   for the current psymtab.  end_adr is the end of the code range for
+   the current psymtab.  PST is the current psymtab.  VT_bits is
+   a pointer to the strings table of SOM debug space.  OBJFILE is
+   the current object file. */
 
 static int
-scan_procs (curr_pd_p, qPD, max_procs, start_adr, end_adr, pst, vt_bits, objfile, section_offsets)
-     int *curr_pd_p;           /* pointer to current proc index */
-     quick_procedure_entry *qPD;       /* the procedure quick lookup table */
-     int max_procs;            /* number of entries in proc. table */
-     CORE_ADDR start_adr;      /* beginning of code range for current psymtab */
-     CORE_ADDR end_adr;                /* end of code range for current psymtab */
-     struct partial_symtab *pst;       /* current psymtab */
-     char *vt_bits;            /* strings table of SOM debug space */
-     struct objfile *objfile;  /* current object file */
-     struct section_offsets *section_offsets;  /* not really used for HP-UX currently */
+scan_procs (int *curr_pd_p, quick_procedure_entry *qPD, int max_procs,
+           CORE_ADDR start_adr, CORE_ADDR end_adr, struct partial_symtab *pst,
+           char *vt_bits, struct objfile *objfile)
 {
   union dnttentry *dn_bufp;
   int symbol_count = 0;                /* Total number of symbols in this psymtab */
@@ -601,10 +580,10 @@ scan_procs (curr_pd_p, qPD, max_procs, start_adr, end_adr, pst, vt_bits, objfile
                                           VAR_NAMESPACE,
                                           LOC_BLOCK,   /* "I am a routine"        */
                                           &objfile->global_psymbols,
-                                          (qPD[curr_pd].adrStart + /* Starting address of rtn */
-                                           ANOFFSET (section_offsets, SECT_OFF_TEXT)),
+                                          (qPD[curr_pd].adrStart +     /* Starting address of rtn */
+                                ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))),
                                           0,   /* core addr?? */
-                                          trans_lang ((enum hp_language) qPD[curr_pd].language),
+                     trans_lang ((enum hp_language) qPD[curr_pd].language),
                                           objfile);
       else
        add_psymbol_with_dem_name_to_list (rtn_name,
@@ -614,10 +593,10 @@ scan_procs (curr_pd_p, qPD, max_procs, start_adr, end_adr, pst, vt_bits, objfile
                                           VAR_NAMESPACE,
                                           LOC_BLOCK,   /* "I am a routine"        */
                                           &objfile->static_psymbols,
-                                          (qPD[curr_pd].adrStart +  /* Starting address of rtn */
-                                           ANOFFSET (section_offsets, SECT_OFF_TEXT)),
+                                          (qPD[curr_pd].adrStart +     /* Starting address of rtn */
+                                ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))),
                                           0,   /* core addr?? */
-                                          trans_lang ((enum hp_language) qPD[curr_pd].language),
+                     trans_lang ((enum hp_language) qPD[curr_pd].language),
                                           objfile);
 
       symbol_count++;
@@ -647,12 +626,8 @@ scan_procs (curr_pd_p, qPD, max_procs, start_adr, end_adr, pst, vt_bits, objfile
    entry for it, so in such cases we create a psymtab for the file.  */
 
 int
-hpread_quick_traverse (objfile,        section_offsets, gntt_bits, vt_bits, pxdb_header_p)     
-     struct objfile *objfile;        /* The object file descriptor */
-     struct section_offsets *section_offsets; /* ?? Null for HP */
-     char *gntt_bits;                /* GNTT entries, loaded in from the file */
-     char *vt_bits;                  /* VT (string) entries ditto. */
-     PXDB_header_ptr pxdb_header_p;  /* Pointer to pxdb header ditto */
+hpread_quick_traverse (struct objfile *objfile, char *gntt_bits,
+                      char *vt_bits, PXDB_header_ptr pxdb_header_p)
 {
   struct partial_symtab *pst;
 
@@ -679,8 +654,8 @@ hpread_quick_traverse (objfile,     section_offsets, gntt_bits, vt_bits, pxdb_header
 
   struct partial_symbol **global_syms; /* We'll be filling in the "global"   */
   struct partial_symbol **static_syms; /* and "static" tables in the objfile
-                                           as we go, so we need a pair of     
-                                           current pointers. */
+                                          as we go, so we need a pair of     
+                                          current pointers. */
 
 #ifdef DUMPING
   /* Turn this on for lots of debugging information in this routine.
@@ -862,24 +837,23 @@ hpread_quick_traverse (objfile,   section_offsets, gntt_bits, vt_bits, pxdb_header
             might help.  */
 
          pst = hpread_start_psymtab (objfile,
-                                     section_offsets,          /* ?? */
                                      mod_name_string,
                                      CURR_MODULE_START,        /* Low text address: bogus! */
-                                     (CURR_MODULE_ISYM * sizeof (struct dntt_type_block)),
-                                                               /* ldsymoff */
+                      (CURR_MODULE_ISYM * sizeof (struct dntt_type_block)),
+         /* ldsymoff */
                                      global_syms,
                                      static_syms);
 
          pst = hpread_end_psymtab (pst,
                                    NULL,       /* psymtab_include_list */
-                                   0,          /* includes_used        */
-                                   end_sym * sizeof (struct dntt_type_block),
-                                               /* byte index in LNTT of end 
-                                                  = capping symbol offset  
-                                                  = LDSYMOFF of nextfile */
-                                   0,          /* text high            */
+                                   0,  /* includes_used        */
+                                 end_sym * sizeof (struct dntt_type_block),
+         /* byte index in LNTT of end 
+            = capping symbol offset  
+            = LDSYMOFF of nextfile */
+                                   0,  /* text high            */
                                    NULL,       /* dependency_list      */
-                                   0);         /* dependencies_used    */
+                                   0);         /* dependencies_used    */
 
          global_syms = objfile->global_psymbols.next;
          static_syms = objfile->static_psymbols.next;
@@ -964,24 +938,22 @@ hpread_quick_traverse (objfile,   section_offsets, gntt_bits, vt_bits, pxdb_header
                 And it's not even the right byte offset, as we're using
                 the size of a union! FIXME!  */
              pst = hpread_start_psymtab (objfile,
-                                         section_offsets,      /* ?? */
                                          full_name_string,
-                                         start_adr,            /* Low text address */
-                                         (start_sym * sizeof (struct dntt_type_block)),
-                                                               /* ldsymoff */
+                                         start_adr,    /* Low text address */
+                             (start_sym * sizeof (struct dntt_type_block)),
+             /* ldsymoff */
                                          global_syms,
                                          static_syms);
 
              /* Set up to only enter each class referenced in this module once.  */
-             class_entered = malloc (B_BYTES (pxdb_header_p->cd_entries));
+             class_entered = xmalloc (B_BYTES (pxdb_header_p->cd_entries));
              B_CLRALL (class_entered, pxdb_header_p->cd_entries);
 
              /* Scan the procedure descriptors for procedures in the current
                 file, based on the starting addresses. */
 
              syms_in_pst = scan_procs (&curr_pd, qPD, pxdb_header_p->pd_entries,
-                                       start_adr, end_adr,
-                                       pst, vt_bits, objfile, section_offsets);
+                                       start_adr, end_adr, pst, vt_bits, objfile);
 
              /* Get ending symbol offset */
 
@@ -1030,10 +1002,10 @@ hpread_quick_traverse (objfile, section_offsets, gntt_bits, vt_bits, pxdb_header
              pst = hpread_end_psymtab (pst,
                                        NULL,   /* psymtab_include_list */
                                        0,      /* includes_used        */
-                                       end_sym * sizeof (struct dntt_type_block),
-                                               /* byte index in LNTT of end 
-                                                  = capping symbol offset   
-                                                  = LDSYMOFF of nextfile */
+                                 end_sym * sizeof (struct dntt_type_block),
+             /* byte index in LNTT of end 
+                = capping symbol offset   
+                = LDSYMOFF of nextfile */
                                        end_adr,        /* text high */
                                        NULL,   /* dependency_list */
                                        0);     /* dependencies_used */
@@ -1053,7 +1025,7 @@ hpread_quick_traverse (objfile,   section_offsets, gntt_bits, vt_bits, pxdb_header
              /* Prepare for the next psymtab. */
              global_syms = objfile->global_psymbols.next;
              static_syms = objfile->static_psymbols.next;
-             free (class_entered);
+             xfree (class_entered);
 
              curr_fd++;
            }                   /* Psymtab for file */
@@ -1194,24 +1166,22 @@ hpread_quick_traverse (objfile, section_offsets, gntt_bits, vt_bits, pxdb_header
                 And it's not even the right byte offset, as we're using
                 the size of a union! FIXME!  */
              pst = hpread_start_psymtab (objfile,
-                                         section_offsets,      /* ?? */
                                          full_name_string,
                                          start_adr,    /* Low text address */
-                                         (start_sym * sizeof (struct dntt_type_block)),
-                                                       /* ldsymoff */
+                             (start_sym * sizeof (struct dntt_type_block)),
+             /* ldsymoff */
                                          global_syms,
                                          static_syms);
 
              /* Set up to only enter each class referenced in this module once.  */
-             class_entered = malloc (B_BYTES (pxdb_header_p->cd_entries));
+             class_entered = xmalloc (B_BYTES (pxdb_header_p->cd_entries));
              B_CLRALL (class_entered, pxdb_header_p->cd_entries);
 
              /* Scan the procedure descriptors for procedures in the current
                 module, based on the starting addresses. */
 
              syms_in_pst = scan_procs (&curr_pd, qPD, pxdb_header_p->pd_entries,
-                                       start_adr, end_adr,
-                                       pst, vt_bits, objfile, section_offsets);
+                                       start_adr, end_adr, pst, vt_bits, objfile);
 
              /* Get ending symbol offset */
 
@@ -1260,10 +1230,10 @@ hpread_quick_traverse (objfile, section_offsets, gntt_bits, vt_bits, pxdb_header
              pst = hpread_end_psymtab (pst,
                                        NULL,   /* psymtab_include_list */
                                        0,      /* includes_used        */
-                                       end_sym * sizeof (struct dntt_type_block),
-                                               /* byte index in LNTT of end 
-                                                  = capping symbol offset   
-                                                  = LDSYMOFF of nextfile */
+                                 end_sym * sizeof (struct dntt_type_block),
+             /* byte index in LNTT of end 
+                = capping symbol offset   
+                = LDSYMOFF of nextfile */
                                        end_adr,        /* text high */
                                        NULL,   /* dependency_list      */
                                        0);     /* dependencies_used    */
@@ -1284,7 +1254,7 @@ hpread_quick_traverse (objfile,   section_offsets, gntt_bits, vt_bits, pxdb_header
              /* Prepare for the next psymtab. */
              global_syms = objfile->global_psymbols.next;
              static_syms = objfile->static_psymbols.next;
-             free (class_entered);
+             xfree (class_entered);
 
              curr_md++;
              curr_fd++;
@@ -1308,25 +1278,23 @@ hpread_quick_traverse (objfile, section_offsets, gntt_bits, vt_bits, pxdb_header
        }
 #endif
       pst = hpread_start_psymtab (objfile,
-                                 section_offsets,      /* ?? */
                                  "orphans",
                                  start_adr,    /* Low text address */
-                                 (CURR_PROC_ISYM * sizeof (struct dntt_type_block)),
-                                               /* ldsymoff */
+                        (CURR_PROC_ISYM * sizeof (struct dntt_type_block)),
+      /* ldsymoff */
                                  global_syms,
                                  static_syms);
 
       scan_procs (&curr_pd, qPD, pxdb_header_p->pd_entries,
-                 start_adr, end_adr,
-                 pst, vt_bits, objfile, section_offsets);
+                 start_adr, end_adr, pst, vt_bits, objfile);
 
       pst = hpread_end_psymtab (pst,
                                NULL,   /* psymtab_include_list */
                                0,      /* includes_used */
-                               pxdb_header_p->globals * sizeof (struct dntt_type_block),
-                                       /* byte index in LNTT of end 
-                                          = capping symbol offset   
-                                          = LDSYMOFF of nextfile */
+                  pxdb_header_p->globals * sizeof (struct dntt_type_block),
+      /* byte index in LNTT of end 
+         = capping symbol offset   
+         = LDSYMOFF of nextfile */
                                end_adr,        /* text high  */
                                NULL,   /* dependency_list */
                                0);     /* dependencies_used */
@@ -1340,7 +1308,6 @@ hpread_quick_traverse (objfile,   section_offsets, gntt_bits, vt_bits, pxdb_header
      If null psts were kept on the chain, this would be
      a solution.  FIXME */
   pst = hpread_start_psymtab (objfile,
-                             section_offsets,
                              "globals",
                              0,
                              (pxdb_header_p->globals
@@ -1364,9 +1331,7 @@ hpread_quick_traverse (objfile,   section_offsets, gntt_bits, vt_bits, pxdb_header
 /* Get appropriate header, based on pxdb type. 
    Return value: 1 if ok, 0 if not */
 int
-hpread_get_header (objfile, pxdb_header_p)
-     struct objfile *objfile;
-     PXDB_header_ptr pxdb_header_p;
+hpread_get_header (struct objfile *objfile, PXDB_header_ptr pxdb_header_p)
 {
   asection *pinfo_section, *debug_section, *header_section;
 
@@ -1484,8 +1449,7 @@ hpread_get_header (objfile, pxdb_header_p)
    FIXME, there should be a cleaner peephole into the BFD environment
    here. */
 void
-hpread_symfile_init (objfile)
-     struct objfile *objfile;
+hpread_symfile_init (struct objfile *objfile)
 {
   asection *vt_section, *slt_section, *lntt_section, *gntt_section;
 
@@ -1507,7 +1471,7 @@ hpread_symfile_init (objfile)
                     bfd_section_size (objfile->obfd, gntt_section));
 
   bfd_get_section_contents (objfile->obfd, gntt_section, GNTT (objfile),
-                           0, bfd_section_size (objfile->obfd, gntt_section));
+                        0, bfd_section_size (objfile->obfd, gntt_section));
 
   GNTT_SYMCOUNT (objfile)
     = bfd_section_size (objfile->obfd, gntt_section)
@@ -1529,7 +1493,7 @@ hpread_symfile_init (objfile)
                     bfd_section_size (objfile->obfd, lntt_section));
 
   bfd_get_section_contents (objfile->obfd, lntt_section, LNTT (objfile),
-                           0, bfd_section_size (objfile->obfd, lntt_section));
+                        0, bfd_section_size (objfile->obfd, lntt_section));
 
   LNTT_SYMCOUNT (objfile)
     = bfd_section_size (objfile->obfd, lntt_section)
@@ -1546,7 +1510,7 @@ hpread_symfile_init (objfile)
                   bfd_section_size (objfile->obfd, slt_section));
 
   bfd_get_section_contents (objfile->obfd, slt_section, SLT (objfile),
-                           0, bfd_section_size (objfile->obfd, slt_section));
+                         0, bfd_section_size (objfile->obfd, slt_section));
 
   /* Read in data from the $VT$ subspace.  $VT$ contains things like
      names and constants.  Keep track of the number of symbols in the VT.  */
@@ -1578,15 +1542,11 @@ hpread_symfile_init (objfile)
    We assume hpread_symfile_init has been called to initialize the
    symbol reader's private data structures.
 
-   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). */
+
 void
-hpread_build_psymtabs (objfile, section_offsets, mainline)
-     struct objfile *objfile;
-     struct section_offsets *section_offsets;
-     int mainline;
+hpread_build_psymtabs (struct objfile *objfile, int mainline)
 {
 
 #ifdef DUMPING
@@ -1621,7 +1581,7 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
 
   /* Just in case the stabs reader left turds lying around.  */
   free_pending_blocks ();
-  make_cleanup ((make_cleanup_func) really_free_pendings, 0);
+  make_cleanup (really_free_pendings, 0);
 
   pst = (struct partial_symtab *) 0;
 
@@ -1640,7 +1600,7 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
     (struct partial_symtab **) alloca (dependencies_allocated *
                                       sizeof (struct partial_symtab *));
 
-  old_chain = make_cleanup ((make_cleanup_func) free_objfile, objfile);
+  old_chain = make_cleanup_free_objfile (objfile);
 
   last_source_file = 0;
 
@@ -1679,23 +1639,22 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
           not found we give up on the quick table stuff, 
           and fall back on the slower method  */
        found_modules_in_program = hpread_quick_traverse (objfile,
-                                                         section_offsets,
                                                          GNTT (objfile),
                                                          VT (objfile),
                                                          &pxdb_header);
 
        discard_cleanups (old_chain);
 
-               /* Set up to scan the global section of the LNTT.
+       /* Set up to scan the global section of the LNTT.
 
-                  This field is not always correct: if there are
-                  no globals, it will point to the last record in
-                  the regular LNTT, which is usually an END MODULE.
+          This field is not always correct: if there are
+          no globals, it will point to the last record in
+          the regular LNTT, which is usually an END MODULE.
 
-                  Since it might happen that there could be a file
-                  with just one global record, there's no way to
-                  tell other than by looking at the record, so that's
-                  done below. */
+          Since it might happen that there could be a file
+          with just one global record, there's no way to
+          tell other than by looking at the record, so that's
+          done below. */
        if (found_modules_in_program)
          scan_start = pxdb_header.globals;
       }
@@ -1709,8 +1668,8 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
   }
 #endif /* QUICK_LOOK_UP */
 
-    /* Make two passes, one over the GNTT symbols, the other for the
-       LNTT symbols.
+  /* Make two passes, one over the GNTT symbols, the other for the
+     LNTT symbols.
 
      JB comment: above isn't true--they only make one pass, over
      the LNTT.  */
@@ -1829,11 +1788,11 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
                  past_first_source_file = 1;
 
                valu = hpread_get_textlow (i, hp_symnum, objfile, symcount);
-               valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
-               pst = hpread_start_psymtab (objfile, section_offsets,
+               valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
+               pst = hpread_start_psymtab (objfile,
                                            namestring, valu,
                                            (hp_symnum
-                                            * sizeof (struct dntt_type_block)),
+                                        * sizeof (struct dntt_type_block)),
                                            objfile->global_psymbols.next,
                                            objfile->static_psymbols.next);
                texthigh = valu;
@@ -1863,13 +1822,13 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
              /* Now begin a new module and a new psymtab for it */
              SET_NAMESTRING (dn_bufp, &namestring, objfile);
              valu = hpread_get_textlow (i, hp_symnum, objfile, symcount);
-             valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+             valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
              if (!pst)
                {
-                 pst = hpread_start_psymtab (objfile, section_offsets,
+                 pst = hpread_start_psymtab (objfile,
                                              namestring, valu,
                                              (hp_symnum
-                                              * sizeof (struct dntt_type_block)),
+                                        * sizeof (struct dntt_type_block)),
                                              objfile->global_psymbols.next,
                                              objfile->static_psymbols.next);
                  texthigh = valu;
@@ -1881,12 +1840,12 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
            case DNTT_TYPE_ENTRY:
              /* The beginning of a function.  DNTT_TYPE_ENTRY may also denote
                 a secondary entry point.  */
-             valu = dn_bufp->dfunc.hiaddr + ANOFFSET (section_offsets,
-                                                      SECT_OFF_TEXT);
+             valu = dn_bufp->dfunc.hiaddr + ANOFFSET (objfile->section_offsets,
+                                                      SECT_OFF_TEXT (objfile));
              if (valu > texthigh)
                texthigh = valu;
              valu = dn_bufp->dfunc.lowaddr +
-               ANOFFSET (section_offsets, SECT_OFF_TEXT);
+               ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
              SET_NAMESTRING (dn_bufp, &namestring, objfile);
              if (dn_bufp->dfunc.global)
                add_psymbol_to_list (namestring, strlen (namestring),
@@ -1902,12 +1861,12 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
              continue;
 
            case DNTT_TYPE_DOC_FUNCTION:
-             valu = dn_bufp->ddocfunc.hiaddr + ANOFFSET (section_offsets,
-                                                         SECT_OFF_TEXT);
+             valu = dn_bufp->ddocfunc.hiaddr + ANOFFSET (objfile->section_offsets,
+                                                         SECT_OFF_TEXT (objfile));
              if (valu > texthigh)
                texthigh = valu;
              valu = dn_bufp->ddocfunc.lowaddr +
-               ANOFFSET (section_offsets, SECT_OFF_TEXT);
+               ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
              SET_NAMESTRING (dn_bufp, &namestring, objfile);
              if (dn_bufp->ddocfunc.global)
                add_psymbol_to_list (namestring, strlen (namestring),
@@ -1985,19 +1944,19 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
                SET_NAMESTRING (dn_bufp, &namestring, objfile);
                if (!pst)
                  {
-                   pst = hpread_start_psymtab (objfile, section_offsets,
+                   pst = hpread_start_psymtab (objfile,
                                                "globals", 0,
                                                (hp_symnum
-                                                * sizeof (struct dntt_type_block)),
-                                               objfile->global_psymbols.next,
-                                               objfile->static_psymbols.next);
+                                        * sizeof (struct dntt_type_block)),
+                                             objfile->global_psymbols.next,
+                                            objfile->static_psymbols.next);
                  }
 
                /* Compute address of the data symbol */
                valu = dn_bufp->dsvar.location;
                /* Relocate in case it's in a shared library */
                if (storage == LOC_STATIC)
-                 valu += ANOFFSET (section_offsets, SECT_OFF_DATA);
+                 valu += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
 
                /* Luckily, dvar, svar, typedef, and tagdef all
                   have their "global" bit in the same place, so it works
@@ -2048,7 +2007,7 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
                                                 VAR_NAMESPACE, storage,
                                                 &objfile->global_psymbols,
                                                 dn_bufp->dsvar.location,
-                                                0, language_unknown, objfile);
+                                             0, language_unknown, objfile);
                          }
                        else
                          {
@@ -2056,7 +2015,7 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
                                                 VAR_NAMESPACE, storage,
                                                 &objfile->static_psymbols,
                                                 dn_bufp->dsvar.location,
-                                                0, language_unknown, objfile);
+                                             0, language_unknown, objfile);
                          }
                      }
                  }
@@ -2069,10 +2028,10 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
              SET_NAMESTRING (dn_bufp, &namestring, objfile);
              if (!pst)
                {
-                 pst = hpread_start_psymtab (objfile, section_offsets,
+                 pst = hpread_start_psymtab (objfile,
                                              "globals", 0,
                                              (hp_symnum
-                                              * sizeof (struct dntt_type_block)),
+                                        * sizeof (struct dntt_type_block)),
                                              objfile->global_psymbols.next,
                                              objfile->static_psymbols.next);
                }
@@ -2110,8 +2069,7 @@ hpread_build_psymtabs (objfile, section_offsets, mainline)
    objfile struct from the global list of known objfiles. */
 
 void
-hpread_symfile_finish (objfile)
-     struct objfile *objfile;
+hpread_symfile_finish (struct objfile *objfile)
 {
   if (objfile->sym_private != NULL)
     {
@@ -2125,42 +2083,33 @@ hpread_symfile_finish (objfile)
 /* Various small functions to get entries in the debug symbol sections.  */
 
 union dnttentry *
-hpread_get_lntt (index, objfile)
-     int index;
-     struct objfile *objfile;
+hpread_get_lntt (int index, struct objfile *objfile)
 {
   return (union dnttentry *)
     &(LNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
 }
 
 static union dnttentry *
-hpread_get_gntt (index, objfile)
-     int index;
-     struct objfile *objfile;
+hpread_get_gntt (int index, struct objfile *objfile)
 {
   return (union dnttentry *)
     &(GNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
 }
 
 union sltentry *
-hpread_get_slt (index, objfile)
-     int index;
-     struct objfile *objfile;
+hpread_get_slt (int index, struct objfile *objfile)
 {
   return (union sltentry *) &(SLT (objfile)[index * sizeof (union sltentry)]);
 }
 
 /* Get the low address associated with some symbol (typically the start
    of a particular source file or module).  Since that information is not
-   stored as part of the DNTT_TYPE_MODULE or DNTT_TYPE_SRCFILE symbol we must infer it from
-   the existance of DNTT_TYPE_FUNCTION symbols.  */
+   stored as part of the DNTT_TYPE_MODULE or DNTT_TYPE_SRCFILE symbol we
+   must infer it from the existence of DNTT_TYPE_FUNCTION symbols.  */
 
 static unsigned long
-hpread_get_textlow (global, index, objfile, symcount)
-     int global;
-     int index;
-     struct objfile *objfile;
-     int symcount;
+hpread_get_textlow (int global, int index, struct objfile *objfile,
+                   int symcount)
 {
   union dnttentry *dn_bufp;
   struct minimal_symbol *msymbol;
@@ -2212,20 +2161,15 @@ hpread_get_textlow (global, index, objfile, symcount)
    (normal). */
 
 static struct partial_symtab *
-hpread_start_psymtab (objfile, section_offsets,
-                     filename, textlow, ldsymoff, global_syms, static_syms)
-     struct objfile *objfile;
-     struct section_offsets *section_offsets;
-     char *filename;
-     CORE_ADDR textlow;
-     int ldsymoff;
-     struct partial_symbol **global_syms;
-     struct partial_symbol **static_syms;
+hpread_start_psymtab (struct objfile *objfile, char *filename,
+                     CORE_ADDR textlow, int ldsymoff,
+                     struct partial_symbol **global_syms,
+                     struct partial_symbol **static_syms)
 {
-  int offset = ANOFFSET (section_offsets, SECT_OFF_TEXT);
+  int offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
   extern void hpread_psymtab_to_symtab ();
   struct partial_symtab *result =
-  start_psymtab_common (objfile, section_offsets,
+  start_psymtab_common (objfile, objfile->section_offsets,
                        filename, textlow, global_syms, static_syms);
 
   result->textlow += offset;
@@ -2248,19 +2192,15 @@ hpread_start_psymtab (objfile, section_offsets,
    FIXME:  List variables and peculiarities of same.  */
 
 static struct partial_symtab *
-hpread_end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
-                   capping_text, dependency_list, number_dependencies)
-     struct partial_symtab *pst;
-     char **include_list;
-     int num_includes;
-     int capping_symbol_offset;
-     CORE_ADDR capping_text;
-     struct partial_symtab **dependency_list;
-     int number_dependencies;
+hpread_end_psymtab (struct partial_symtab *pst, char **include_list,
+                   int num_includes, int capping_symbol_offset,
+                   CORE_ADDR capping_text,
+                   struct partial_symtab **dependency_list,
+                   int number_dependencies)
 {
   int i;
   struct objfile *objfile = pst->objfile;
-  int offset = ANOFFSET (pst->section_offsets, SECT_OFF_TEXT);
+  int offset = ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (objfile));
 
 #ifdef DUMPING
   /* Turn on to see what kind of a psymtab we've built. */
@@ -2296,7 +2236,7 @@ hpread_end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
     {
       pst->dependencies = (struct partial_symtab **)
        obstack_alloc (&objfile->psymbol_obstack,
-                      number_dependencies * sizeof (struct partial_symtab *));
+                   number_dependencies * sizeof (struct partial_symtab *));
       memcpy (pst->dependencies, dependency_list,
              number_dependencies * sizeof (struct partial_symtab *));
     }
@@ -2377,5 +2317,3 @@ hpread_end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
 ***c - basic - offset:4
 *** End:
 #endif
-
-
This page took 0.037259 seconds and 4 git commands to generate.