2000-05-10 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
[deliverable/binutils-gdb.git] / gdb / mdebugread.c
index 44f61bf29c9d3349ffc07f776cda515d70fadca5..6c7ddccf93fb184bb42ed2ab6ad4cfabe0d2f01d 100644 (file)
@@ -353,8 +353,7 @@ static int
 upgrade_type PARAMS ((int, struct type **, int, union aux_ext *, int, char *));
 
 static void
-parse_partial_symbols PARAMS ((struct objfile *,
-                              struct section_offsets *));
+parse_partial_symbols PARAMS ((struct objfile *));
 
 static FDR
 * get_rfd PARAMS ((int, int));
@@ -385,7 +384,7 @@ static struct blockvector *
   new_bvect PARAMS ((int));
 
 static int
-parse_symbol PARAMS ((SYMR *, union aux_ext *, char *, int, struct section_offsets *));
+parse_symbol PARAMS ((SYMR *, union aux_ext *, char *, int, struct section_offsets *, struct objfile *));
 
 static struct type *
   parse_type PARAMS ((int, union aux_ext *, unsigned int, int *, int, char *));
@@ -407,7 +406,7 @@ static int
 compare_blocks PARAMS ((const void *, const void *));
 
 static struct partial_symtab *
-  new_psymtab PARAMS ((char *, struct objfile *, struct section_offsets *));
+  new_psymtab PARAMS ((char *, struct objfile *));
 
 static void
 psymtab_to_symtab_1 PARAMS ((struct partial_symtab *, char *));
@@ -520,11 +519,10 @@ fdr_name (f)
    different sections are relocated via the SECTION_OFFSETS.  */
 
 void
-mdebug_build_psymtabs (objfile, swap, info, section_offsets)
+mdebug_build_psymtabs (objfile, swap, info)
      struct objfile *objfile;
      const struct ecoff_debug_swap *swap;
      struct ecoff_debug_info *info;
-     struct section_offsets *section_offsets;
 {
   cur_bfd = objfile->obfd;
   debug_swap = swap;
@@ -548,7 +546,7 @@ mdebug_build_psymtabs (objfile, swap, info, section_offsets)
        (*swap->swap_fdr_in) (objfile->obfd, fdr_src, fdr_ptr);
     }
 
-  parse_partial_symbols (objfile, section_offsets);
+  parse_partial_symbols (objfile);
 
 #if 0
   /* Check to make sure file was compiled with -g.  If not, warn the
@@ -718,12 +716,13 @@ add_pending (fh, sh, t)
    SYMR's handled (normally one).  */
 
 static int
-parse_symbol (sh, ax, ext_sh, bigend, section_offsets)
+parse_symbol (sh, ax, ext_sh, bigend, section_offsets, objfile)
      SYMR *sh;
      union aux_ext *ax;
      char *ext_sh;
      int bigend;
      struct section_offsets *section_offsets;
+     struct objfile *objfile;
 {
   const bfd_size_type external_sym_size = debug_swap->external_sym_size;
   void (*const swap_sym_in) PARAMS ((bfd *, PTR, SYMR *)) =
@@ -755,18 +754,18 @@ parse_symbol (sh, ax, ext_sh, bigend, section_offsets)
          The value of a stBlock symbol is the displacement from the
          procedure address.  */
       if (sh->st != stEnd && sh->st != stBlock)
-       sh->value += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+       sh->value += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
       break;
     case scData:
     case scSData:
     case scRData:
     case scPData:
     case scXData:
-      sh->value += ANOFFSET (section_offsets, SECT_OFF_DATA);
+      sh->value += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
       break;
     case scBss:
     case scSBss:
-      sh->value += ANOFFSET (section_offsets, SECT_OFF_BSS);
+      sh->value += ANOFFSET (section_offsets, SECT_OFF_BSS (objfile));
       break;
     }
 
@@ -2044,7 +2043,7 @@ parse_procedure (pr, search_symtab, pst)
          procedure descriptor in e->pdr.adr.
          As the address in the procedure descriptor is usually relative,
          we would have to relocate e->pdr.adr with cur_fdr->adr and
-         ANOFFSET (pst->section_offsets, SECT_OFF_TEXT).
+         ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (pst->objfile)).
          Unfortunately cur_fdr->adr and e->pdr.adr are both absolute
          in shared libraries on some systems, and on other systems
          e->pdr.adr is sometimes offset by a bogus value.
@@ -2104,13 +2103,14 @@ ecoff_relocate_efi (sym, delta)
 
    This routine clobbers top_stack->cur_block and ->cur_st. */
 
-static void parse_external PARAMS ((EXTR *, int, struct section_offsets *));
+static void parse_external PARAMS ((EXTR *, int, struct section_offsets *, struct objfile *));
 
 static void
-parse_external (es, bigend, section_offsets)
+parse_external (es, bigend, section_offsets, objfile)
      EXTR *es;
      int bigend;
      struct section_offsets *section_offsets;
+     struct objfile *objfile;
 {
   union aux_ext *ax;
 
@@ -2185,7 +2185,7 @@ parse_external (es, bigend, section_offsets)
 
       /* Note that the case of a symbol with indexNil must be handled
          anyways by parse_symbol().  */
-      parse_symbol (&es->asym, ax, (char *) NULL, bigend, section_offsets);
+      parse_symbol (&es->asym, ax, (char *) NULL, bigend, section_offsets, objfile);
       break;
     default:
       break;
@@ -2274,9 +2274,8 @@ parse_lines (fh, pr, lt, maxlines, pst, lowest_pdr_addr)
    into a partial_symtab.  */
 
 static void
-parse_partial_symbols (objfile, section_offsets)
+parse_partial_symbols (objfile)
      struct objfile *objfile;
-     struct section_offsets *section_offsets;
 {
   const bfd_size_type external_sym_size = debug_swap->external_sym_size;
   const bfd_size_type external_rfd_size = debug_swap->external_rfd_size;
@@ -2363,7 +2362,7 @@ parse_partial_symbols (objfile, section_offsets)
   old_chain = make_cleanup (free, fdr_to_pst);
   fdr_to_pst++;
   {
-    struct partial_symtab *pst = new_psymtab ("", objfile, section_offsets);
+    struct partial_symtab *pst = new_psymtab ("", objfile);
     fdr_to_pst[-1].pst = pst;
     FDR_IDX (pst) = -1;
   }
@@ -2477,12 +2476,12 @@ parse_partial_symbols (objfile, section_offsets)
        {
        case stProc:
          /* Beginnning of Procedure */
-         svalue += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+         svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
          break;
        case stStaticProc:
          /* Load time only static procs */
          ms_type = mst_file_text;
-         svalue += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+         svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
          break;
        case stGlobal:
          /* External symbol */
@@ -2495,12 +2494,12 @@ parse_partial_symbols (objfile, section_offsets)
          else if (SC_IS_DATA (ext_in->asym.sc))
            {
              ms_type = mst_data;
-             svalue += ANOFFSET (section_offsets, SECT_OFF_DATA);
+             svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
            }
          else if (SC_IS_BSS (ext_in->asym.sc))
            {
              ms_type = mst_bss;
-             svalue += ANOFFSET (section_offsets, SECT_OFF_BSS);
+             svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
            }
          else
            ms_type = mst_abs;
@@ -2510,17 +2509,17 @@ parse_partial_symbols (objfile, section_offsets)
          if (SC_IS_TEXT (ext_in->asym.sc))
            {
              ms_type = mst_file_text;
-             svalue += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+             svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
            }
          else if (SC_IS_DATA (ext_in->asym.sc))
            {
              ms_type = mst_file_data;
-             svalue += ANOFFSET (section_offsets, SECT_OFF_DATA);
+             svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
            }
          else if (SC_IS_BSS (ext_in->asym.sc))
            {
              ms_type = mst_file_bss;
-             svalue += ANOFFSET (section_offsets, SECT_OFF_BSS);
+             svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
            }
          else
            ms_type = mst_abs;
@@ -2564,11 +2563,11 @@ parse_partial_symbols (objfile, section_offsets)
        {
          textlow = fh->adr;
          if (relocatable || textlow != 0)
-           textlow += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+           textlow += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
        }
       else
        textlow = 0;
-      pst = start_psymtab_common (objfile, section_offsets,
+      pst = start_psymtab_common (objfile, objfile->section_offsets,
                                  fdr_name (fh),
                                  textlow,
                                  objfile->global_psymbols.next,
@@ -2652,7 +2651,7 @@ parse_partial_symbols (objfile, section_offsets)
                      CORE_ADDR procaddr;
                      long isym;
 
-                     sh.value += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+                     sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
                      if (sh.st == stStaticProc)
                        {
                          namestring = debug_info->ss + fh->issBase + sh.iss;
@@ -2660,7 +2659,7 @@ parse_partial_symbols (objfile, section_offsets)
                                                               sh.value,
                                                               mst_file_text,
                                                               NULL,
-                                                              SECT_OFF_TEXT,
+                                                              SECT_OFF_TEXT (objfile),
                                                               NULL,
                                                               objfile);
                        }
@@ -2703,12 +2702,12 @@ parse_partial_symbols (objfile, section_offsets)
                        case scPData:
                        case scXData:
                          namestring = debug_info->ss + fh->issBase + sh.iss;
-                         sh.value += ANOFFSET (section_offsets, SECT_OFF_DATA);
+                         sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
                          prim_record_minimal_symbol_and_info (namestring,
                                                               sh.value,
                                                               mst_file_data,
                                                               NULL,
-                                                              SECT_OFF_DATA,
+                                                              SECT_OFF_DATA (objfile),
                                                               NULL,
                                                               objfile);
                          break;
@@ -2717,12 +2716,12 @@ parse_partial_symbols (objfile, section_offsets)
                          /* FIXME!  Shouldn't this use cases for bss, 
                             then have the default be abs? */
                          namestring = debug_info->ss + fh->issBase + sh.iss;
-                         sh.value += ANOFFSET (section_offsets, SECT_OFF_BSS);
+                         sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
                          prim_record_minimal_symbol_and_info (namestring,
                                                               sh.value,
                                                               mst_file_bss,
                                                               NULL,
-                                                              SECT_OFF_BSS,
+                                                              SECT_OFF_BSS (objfile),
                                                               NULL,
                                                               objfile);
                          break;
@@ -2769,7 +2768,7 @@ parse_partial_symbols (objfile, section_offsets)
   namestring = stabstring
 #define CUR_SYMBOL_TYPE type_code
 #define CUR_SYMBOL_VALUE sh.value
-#define START_PSYMTAB(ofile,secoff,fname,low,symoff,global_syms,static_syms)\
+#define START_PSYMTAB(ofile,fname,low,symoff,global_syms,static_syms)\
   pst = save_pst
 #define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps,textlow_not_set) (void)0
 #define HANDLE_RBRAC(val) \
@@ -2821,18 +2820,18 @@ parse_partial_symbols (objfile, section_offsets)
                  /* The value of a stEnd symbol is the displacement from the
                     corresponding start symbol value, do not relocate it.  */
                  if (sh.st != stEnd)
-                   sh.value += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+                   sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
                  break;
                case scData:
                case scSData:
                case scRData:
                case scPData:
                case scXData:
-                 sh.value += ANOFFSET (section_offsets, SECT_OFF_DATA);
+                 sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
                  break;
                case scBss:
                case scSBss:
-                 sh.value += ANOFFSET (section_offsets, SECT_OFF_BSS);
+                 sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
                  break;
                }
 
@@ -2845,7 +2844,7 @@ parse_partial_symbols (objfile, section_offsets)
                case stStaticProc:
                  prim_record_minimal_symbol_and_info (name, sh.value,
                                                       mst_file_text, NULL,
-                                                      SECT_OFF_TEXT, NULL,
+                                                      SECT_OFF_TEXT (objfile), NULL,
                                                       objfile);
 
                  /* FALLTHROUGH */
@@ -2918,13 +2917,13 @@ parse_partial_symbols (objfile, section_offsets)
                  if (SC_IS_DATA (sh.sc))
                    prim_record_minimal_symbol_and_info (name, sh.value,
                                                         mst_file_data, NULL,
-                                                        SECT_OFF_DATA,
+                                                        SECT_OFF_DATA (objfile),
                                                         NULL,
                                                         objfile);
                  else
                    prim_record_minimal_symbol_and_info (name, sh.value,
                                                         mst_file_bss, NULL,
-                                                        SECT_OFF_BSS,
+                                                        SECT_OFF_BSS (objfile),
                                                         NULL,
                                                         objfile);
                  class = LOC_STATIC;
@@ -3029,18 +3028,18 @@ parse_partial_symbols (objfile, section_offsets)
                {
                case scText:
                case scRConst:
-                 svalue += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+                 svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
                  break;
                case scData:
                case scSData:
                case scRData:
                case scPData:
                case scXData:
-                 svalue += ANOFFSET (section_offsets, SECT_OFF_DATA);
+                 svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
                  break;
                case scBss:
                case scSBss:
-                 svalue += ANOFFSET (section_offsets, SECT_OFF_BSS);
+                 svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
                  break;
                }
 
@@ -3438,7 +3437,7 @@ psymtab_to_symtab_1 (pst, filename)
              else
                {
                  /* Handle encoded stab line number. */
-                 valu += ANOFFSET (pst->section_offsets, SECT_OFF_TEXT);
+                 valu += ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (pst->objfile));
                  record_line (current_subfile, sh.index, valu);
                }
            }
@@ -3449,7 +3448,7 @@ psymtab_to_symtab_1 (pst, filename)
          else
            complain (&stab_unknown_complaint, name);
        }
-      st = end_symtab (pst->texthigh, pst->objfile, SECT_OFF_TEXT);
+      st = end_symtab (pst->texthigh, pst->objfile, SECT_OFF_TEXT (pst->objfile));
       end_stabs ();
 
       /* Sort the symbol table now, we are done adding symbols to it.
@@ -3564,7 +3563,7 @@ psymtab_to_symtab_1 (pst, filename)
              (*swap_sym_in) (cur_bfd, sym_ptr, &sh);
              c = parse_symbol (&sh,
                                debug_info->external_aux + fh->iauxBase,
-                            sym_ptr, fh->fBigendian, pst->section_offsets);
+                               sym_ptr, fh->fBigendian, pst->section_offsets, pst->objfile);
              sym_ptr += c * external_sym_size;
            }
 
@@ -3632,7 +3631,7 @@ psymtab_to_symtab_1 (pst, filename)
 
       ext_ptr = PST_PRIVATE (pst)->extern_tab;
       for (i = PST_PRIVATE (pst)->extern_count; --i >= 0; ext_ptr++)
-       parse_external (ext_ptr, fh->fBigendian, pst->section_offsets);
+       parse_external (ext_ptr, fh->fBigendian, pst->section_offsets, pst->objfile);
 
       /* If there are undefined symbols, tell the user.
          The alpha has an undefined symbol for every symbol that is
@@ -4131,15 +4130,14 @@ new_symtab (name, maxsyms, maxlines, objfile)
 /* Allocate a new partial_symtab NAME */
 
 static struct partial_symtab *
-new_psymtab (name, objfile, section_offsets)
+new_psymtab (name, objfile)
      char *name;
      struct objfile *objfile;
-     struct section_offsets *section_offsets;
 {
   struct partial_symtab *psymtab;
 
   psymtab = allocate_psymtab (name, objfile);
-  psymtab->section_offsets = section_offsets;
+  psymtab->section_offsets = objfile->section_offsets;
 
   /* Keep a backpointer to the file's symbols */
 
@@ -4288,11 +4286,10 @@ new_type (name)
    it as normal.  */
 
 void
-elfmdebug_build_psymtabs (objfile, swap, sec, section_offsets)
+elfmdebug_build_psymtabs (objfile, swap, sec)
      struct objfile *objfile;
      const struct ecoff_debug_swap *swap;
      asection *sec;
-     struct section_offsets *section_offsets;
 {
   bfd *abfd = objfile->obfd;
   struct ecoff_debug_info *info;
@@ -4305,7 +4302,7 @@ elfmdebug_build_psymtabs (objfile, swap, sec, section_offsets)
     error ("Error reading ECOFF debugging information: %s",
           bfd_errmsg (bfd_get_error ()));
 
-  mdebug_build_psymtabs (objfile, swap, info, section_offsets);
+  mdebug_build_psymtabs (objfile, swap, info);
 }
 \f
 
This page took 0.031672 seconds and 4 git commands to generate.