Add an optional "alias" attribute to syscall entries.
[deliverable/binutils-gdb.git] / gdb / dbxread.c
index 5409a727467756048aa4580dd6212698578fb873..e004e8cb93e517aec1457e2286d6c4e09dbc6594 100644 (file)
@@ -902,9 +902,9 @@ set_namestring (struct objfile *objfile, const struct internal_nlist *nlist)
   return namestring;
 }
 
-static CORE_ADDR
-find_stab_function_addr (const char *namestring, const char *filename,
-                        struct objfile *objfile)
+static struct bound_minimal_symbol
+find_stab_function (const char *namestring, const char *filename,
+                   struct objfile *objfile)
 {
   struct bound_minimal_symbol msym;
   int n;
@@ -944,7 +944,7 @@ find_stab_function_addr (const char *namestring, const char *filename,
       msym = lookup_minimal_symbol (p, NULL, objfile);
     }
 
-  return msym.minsym == NULL ? 0 : BMSYMBOL_VALUE_ADDRESS (msym);
+  return msym;
 }
 
 static void
@@ -1137,18 +1137,15 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
              || (namestring[(nsl = strlen (namestring)) - 1] == 'o'
                  && namestring[nsl - 2] == '.'))
            {
-             nlist.n_value += ANOFFSET (objfile->section_offsets,
-                                        SECT_OFF_TEXT (objfile));
-
              if (past_first_source_file && pst
                  /* The gould NP1 uses low values for .o and -l symbols
                     which are not the address.  */
-                 && nlist.n_value >= pst->text_low ())
+                 && nlist.n_value >= pst->raw_text_low ())
                {
                  dbx_end_psymtab (objfile, pst, psymtab_include_list,
                                   includes_used, symnum * symbol_size,
-                                  nlist.n_value > pst->text_high ()
-                                  ? nlist.n_value : pst->text_high (),
+                                  nlist.n_value > pst->raw_text_high ()
+                                  ? nlist.n_value : pst->raw_text_high (),
                                   dependency_list, dependencies_used,
                                   textlow_not_set);
                  pst = (struct partial_symtab *) 0;
@@ -1235,8 +1232,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
            static const char *dirname_nso;
            int prev_textlow_not_set;
 
-           valu = nlist.n_value + ANOFFSET (objfile->section_offsets,
-                                            SECT_OFF_TEXT (objfile));
+           valu = nlist.n_value;
 
            prev_textlow_not_set = textlow_not_set;
 
@@ -1263,8 +1259,8 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
                  {
                    dbx_end_psymtab (objfile, pst, psymtab_include_list,
                                     includes_used, symnum * symbol_size,
-                                    (valu > pst->text_high ()
-                                     ? valu : pst->text_high ()),
+                                    (valu > pst->raw_text_high ()
+                                     ? valu : pst->raw_text_high ()),
                                     dependency_list, dependencies_used,
                                     prev_textlow_not_set);
                    pst = (struct partial_symtab *) 0;
@@ -1438,7 +1434,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
                 function relative stabs, or the address of the function's
                 end for old style stabs.  */
              valu = nlist.n_value + last_function_start;
-             if (pst->text_high () == 0 || valu > pst->text_high ())
+             if (pst->raw_text_high () == 0 || valu > pst->raw_text_high ())
                pst->set_text_high (valu);
              break;
            }
@@ -1478,25 +1474,22 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
          switch (p[1])
            {
            case 'S':
-             nlist.n_value += ANOFFSET (objfile->section_offsets,
-                                        data_sect_index);
-
              if (gdbarch_static_transform_name_p (gdbarch))
                gdbarch_static_transform_name (gdbarch, namestring);
 
              add_psymbol_to_list (sym_name, sym_len, 1,
                                   VAR_DOMAIN, LOC_STATIC,
+                                  data_sect_index,
                                   &objfile->static_psymbols,
                                   nlist.n_value, psymtab_language, objfile);
              continue;
 
            case 'G':
-             nlist.n_value += ANOFFSET (objfile->section_offsets,
-                                        data_sect_index);
              /* The addresses in these entries are reported to be
                 wrong.  See the code that reads 'G's for symtabs.  */
              add_psymbol_to_list (sym_name, sym_len, 1,
                                   VAR_DOMAIN, LOC_STATIC,
+                                  data_sect_index,
                                   &objfile->global_psymbols,
                                   nlist.n_value, psymtab_language, objfile);
              continue;
@@ -1513,14 +1506,14 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
                      && namestring[0] != ' '))
                {
                  add_psymbol_to_list (sym_name, sym_len, 1,
-                                      STRUCT_DOMAIN, LOC_TYPEDEF,
+                                      STRUCT_DOMAIN, LOC_TYPEDEF, -1,
                                       &objfile->static_psymbols,
                                       0, psymtab_language, objfile);
                  if (p[2] == 't')
                    {
                      /* Also a typedef with the same name.  */
                      add_psymbol_to_list (sym_name, sym_len, 1,
-                                          VAR_DOMAIN, LOC_TYPEDEF,
+                                          VAR_DOMAIN, LOC_TYPEDEF, -1,
                                           &objfile->static_psymbols,
                                           0, psymtab_language, objfile);
                      p += 1;
@@ -1532,7 +1525,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
              if (p != namestring)      /* a name is there, not just :T...  */
                {
                  add_psymbol_to_list (sym_name, sym_len, 1,
-                                      VAR_DOMAIN, LOC_TYPEDEF,
+                                      VAR_DOMAIN, LOC_TYPEDEF, -1,
                                       &objfile->static_psymbols,
                                       0, psymtab_language, objfile);
                }
@@ -1593,7 +1586,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
                      /* Note that the value doesn't matter for
                         enum constants in psymtabs, just in symtabs.  */
                      add_psymbol_to_list (p, q - p, 1,
-                                          VAR_DOMAIN, LOC_CONST,
+                                          VAR_DOMAIN, LOC_CONST, -1,
                                           &objfile->static_psymbols, 0,
                                           psymtab_language, objfile);
                      /* Point past the name.  */
@@ -1611,7 +1604,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
            case 'c':
              /* Constant, e.g. from "const" in Pascal.  */
              add_psymbol_to_list (sym_name, sym_len, 1,
-                                  VAR_DOMAIN, LOC_CONST,
+                                  VAR_DOMAIN, LOC_CONST, -1,
                                   &objfile->static_psymbols, 0,
                                   psymtab_language, objfile);
              continue;
@@ -1627,28 +1620,19 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
                  function_outside_compilation_unit_complaint (name);
                  xfree (name);
                }
-             nlist.n_value += ANOFFSET (objfile->section_offsets, 
-                                        SECT_OFF_TEXT (objfile));
              /* Kludges for ELF/STABS with Sun ACC.  */
              last_function_name = namestring;
              /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
                 value for the bottom of the text seg in those cases.  */
-             if (nlist.n_value == ANOFFSET (objfile->section_offsets, 
-                                            SECT_OFF_TEXT (objfile))
+             if (nlist.n_value == 0
                  && gdbarch_sofun_address_maybe_missing (gdbarch))
                {
-                 CORE_ADDR minsym_valu = 
-                   find_stab_function_addr (namestring, 
-                                            pst ? pst->filename : NULL, 
-                                            objfile);
-
-                 /* find_stab_function_addr will return 0 if the minimal
-                    symbol wasn't found.  (Unfortunately, this might also
-                    be a valid address.)  Anyway, if it *does* return 0,
-                    it is likely that the value was set correctly to begin
-                    with...  */
-                 if (minsym_valu != 0)
-                   nlist.n_value = minsym_valu;
+                 struct bound_minimal_symbol minsym
+                   = find_stab_function (namestring,
+                                         pst ? pst->filename : NULL,
+                                         objfile);
+                 if (minsym.minsym != NULL)
+                   nlist.n_value = MSYMBOL_VALUE_RAW_ADDRESS (minsym.minsym);
                }
              if (pst && textlow_not_set
                  && gdbarch_sofun_address_maybe_missing (gdbarch))
@@ -1668,16 +1652,15 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
                 the partial symbol table.  */
              if (pst
                  && (textlow_not_set
-                     || (nlist.n_value < pst->text_low ()
-                         && (nlist.n_value
-                             != ANOFFSET (objfile->section_offsets,
-                                          SECT_OFF_TEXT (objfile))))))
+                     || (nlist.n_value < pst->raw_text_low ()
+                         && (nlist.n_value != 0))))
                {
                  pst->set_text_low (nlist.n_value);
                  textlow_not_set = 0;
                }
              add_psymbol_to_list (sym_name, sym_len, 1,
                                   VAR_DOMAIN, LOC_BLOCK,
+                                  SECT_OFF_TEXT (objfile),
                                   &objfile->static_psymbols,
                                   nlist.n_value, psymtab_language, objfile);
              continue;
@@ -1696,28 +1679,19 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
                  function_outside_compilation_unit_complaint (name);
                  xfree (name);
                }
-             nlist.n_value += ANOFFSET (objfile->section_offsets, 
-                                        SECT_OFF_TEXT (objfile));
              /* Kludges for ELF/STABS with Sun ACC.  */
              last_function_name = namestring;
              /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
                 value for the bottom of the text seg in those cases.  */
-             if (nlist.n_value == ANOFFSET (objfile->section_offsets, 
-                                            SECT_OFF_TEXT (objfile))
+             if (nlist.n_value == 0
                  && gdbarch_sofun_address_maybe_missing (gdbarch))
                {
-                 CORE_ADDR minsym_valu = 
-                   find_stab_function_addr (namestring, 
-                                            pst ? pst->filename : NULL, 
-                                            objfile);
-
-                 /* find_stab_function_addr will return 0 if the minimal
-                    symbol wasn't found.  (Unfortunately, this might also
-                    be a valid address.)  Anyway, if it *does* return 0,
-                    it is likely that the value was set correctly to begin
-                    with...  */
-                 if (minsym_valu != 0)
-                   nlist.n_value = minsym_valu;
+                 struct bound_minimal_symbol minsym
+                   = find_stab_function (namestring,
+                                         pst ? pst->filename : NULL,
+                                         objfile);
+                 if (minsym.minsym != NULL)
+                   nlist.n_value = MSYMBOL_VALUE_RAW_ADDRESS (minsym.minsym);
                }
              if (pst && textlow_not_set
                  && gdbarch_sofun_address_maybe_missing (gdbarch))
@@ -1737,16 +1711,15 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
                 the partial symbol table.  */
              if (pst
                  && (textlow_not_set
-                     || (nlist.n_value < pst->text_low ()
-                         && (nlist.n_value
-                             != ANOFFSET (objfile->section_offsets,
-                                          SECT_OFF_TEXT (objfile))))))
+                     || (nlist.n_value < pst->raw_text_low ()
+                         && (nlist.n_value != 0))))
                {
                  pst->set_text_low (nlist.n_value);
                  textlow_not_set = 0;
                }
              add_psymbol_to_list (sym_name, sym_len, 1,
                                   VAR_DOMAIN, LOC_BLOCK,
+                                  SECT_OFF_TEXT (objfile),
                                   &objfile->global_psymbols,
                                   nlist.n_value, psymtab_language, objfile);
              continue;
@@ -1922,15 +1895,14 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
         is.  */
       CORE_ADDR text_end =
        (lowest_text_address == (CORE_ADDR) -1
-        ? (text_addr + ANOFFSET (objfile->section_offsets,
-                                 SECT_OFF_TEXT (objfile)))
+        ? text_addr
         : lowest_text_address)
        + text_size;
 
       dbx_end_psymtab (objfile, pst, psymtab_include_list, includes_used,
                       symnum * symbol_size,
-                      (text_end > pst->text_high ()
-                       ? text_end : pst->text_high ()),
+                      (text_end > pst->raw_text_high ()
+                       ? text_end : pst->raw_text_high ()),
                       dependency_list, dependencies_used, textlow_not_set);
     }
 }
@@ -2029,7 +2001,7 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
        }
 
       if (minsym.minsym)
-       pst->set_text_high (BMSYMBOL_VALUE_ADDRESS (minsym)
+       pst->set_text_high (MSYMBOL_VALUE_RAW_ADDRESS (minsym.minsym)
                            + MSYMBOL_SIZE (minsym.minsym));
 
       last_function_name = NULL;
@@ -2039,7 +2011,7 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
     ;
   /* This test will be true if the last .o file is only data.  */
   else if (textlow_not_set)
-    pst->set_text_low (pst->text_high ());
+    pst->set_text_low (pst->raw_text_high ());
   else
     {
       struct partial_symtab *p1;
@@ -2052,7 +2024,7 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
       ALL_OBJFILE_PSYMTABS (objfile, p1)
       {
        if (!p1->text_high_valid && p1->text_low_valid && p1 != pst)
-         p1->set_text_high (pst->text_low ());
+         p1->set_text_high (pst->raw_text_low ());
       }
     }
 
@@ -2238,8 +2210,8 @@ read_ofile_symtab (struct objfile *objfile, struct partial_symtab *pst)
 
   sym_offset = LDSYMOFF (pst);
   sym_size = LDSYMLEN (pst);
-  text_offset = pst->text_low ();
-  text_size = pst->text_high () - pst->text_low ();
+  text_offset = pst->text_low (objfile);
+  text_size = pst->text_high (objfile) - pst->text_low (objfile);
   section_offsets = objfile->section_offsets;
 
   dbxread_objfile = objfile;
@@ -2849,18 +2821,11 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
                                       SECT_OFF_TEXT (objfile))
                  && gdbarch_sofun_address_maybe_missing (gdbarch))
                {
-                 CORE_ADDR minsym_valu = 
-                   find_stab_function_addr (name, get_last_source_file (),
-                                            objfile);
-
-                 /* The function find_stab_function_addr will return
-                    0 if the minimal symbol wasn't found.
-                    (Unfortunately, this might also be a valid
-                    address.)  Anyway, if it *does* return 0, it is
-                    likely that the value was set correctly to begin
-                    with...  */
-                 if (minsym_valu != 0)
-                   valu = minsym_valu;
+                 struct bound_minimal_symbol minsym
+                   = find_stab_function (name, get_last_source_file (),
+                                         objfile);
+                 if (minsym.minsym != NULL)
+                   valu = BMSYMBOL_VALUE_ADDRESS (minsym);
                }
 
              /* These addresses are absolute.  */
This page took 0.029737 seconds and 4 git commands to generate.