gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdb / xcoffread.c
index 5c6061077f541bf9dcbeceddf6209da046db14ab..93bdb9b6a6567827205b2a1dfa7d376b2ec40371 100644 (file)
@@ -166,6 +166,7 @@ static const struct dwarf2_debug_sections dwarf2_xcoff_names = {
   { NULL, NULL },
   { ".dwmac", NULL },
   { ".dwstr", NULL },
+  { NULL, NULL }, /* debug_str_offsets */
   { NULL, NULL }, /* debug_line_str */
   { ".dwrnges", NULL },
   { NULL, NULL }, /* debug_rnglists */
@@ -229,7 +230,7 @@ static CORE_ADDR read_symbol_nvalue (int);
 static struct symbol *process_xcoff_symbol (struct coff_symbol *,
                                            struct objfile *);
 
-static void read_xcoff_symtab (struct objfile *, struct partial_symtab *);
+static void read_xcoff_symtab (struct objfile *, legacy_psymtab *);
 
 #if 0
 static void add_stab_to_list (char *, struct pending_stabs **);
@@ -431,6 +432,9 @@ arrange_linetable (struct linetable *oldLineTb)
 
   for (function_count = 0, ii = 0; ii < oldLineTb->nitems; ++ii)
     {
+      if (oldLineTb->item[ii].is_stmt == 0)
+       continue;
+
       if (oldLineTb->item[ii].line == 0)
        {                       /* Function entry found.  */
          if (function_count >= fentry_size)
@@ -441,6 +445,7 @@ arrange_linetable (struct linetable *oldLineTb)
                          fentry_size * sizeof (struct linetable_entry));
            }
          fentry[function_count].line = ii;
+         fentry[function_count].is_stmt = 1;
          fentry[function_count].pc = oldLineTb->item[ii].pc;
          ++function_count;
 
@@ -591,7 +596,7 @@ allocate_include_entry (void)
 
 /* Global variable to pass the psymtab down to all the routines involved
    in psymtab to symtab processing.  */
-static struct partial_symtab *this_symtab_psymtab;
+static legacy_psymtab *this_symtab_psymtab;
 
 /* Objfile related to this_symtab_psymtab; set at the same time.  */
 static struct objfile *this_symtab_objfile;
@@ -824,7 +829,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
                  CORE_ADDR endaddr, unsigned *firstLine)
 {
   struct objfile *objfile = this_symtab_objfile;
-  struct gdbarch *gdbarch = get_objfile_arch (objfile);
+  struct gdbarch *gdbarch = objfile->arch ();
   unsigned int curoffset;
   CORE_ADDR addr;
   void *ext_lnno;
@@ -864,7 +869,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
       addr = (int_lnno.l_lnno
              ? int_lnno.l_addr.l_paddr
              : read_symbol_nvalue (int_lnno.l_addr.l_symndx));
-      addr += objfile->section_offsets[SECT_OFF_TEXT (objfile)];
+      addr += objfile->text_section_offset ();
 
       if (addr < startaddr || (endaddr && addr >= endaddr))
        return;
@@ -989,7 +994,7 @@ xcoff_next_symbol_text (struct objfile *objfile)
 /* Read symbols for a given partial symbol table.  */
 
 static void
-read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
+read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
 {
   bfd *abfd = objfile->obfd;
   char *raw_auxptr;            /* Pointer to first raw aux entry for sym.  */
@@ -1232,7 +1237,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
                        }
 
                      file_start_addr =
-                       cs->c_value + objfile->section_offsets[SECT_OFF_TEXT (objfile)];
+                       cs->c_value + objfile->text_section_offset ();
                      file_end_addr = file_start_addr + CSECT_LEN (&main_aux);
 
                      if (cs->c_name && (cs->c_name[0] == '.' || cs->c_name[0] == '@'))
@@ -1354,7 +1359,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
        case C_FCN:
          if (strcmp (cs->c_name, ".bf") == 0)
            {
-             CORE_ADDR off = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
+             CORE_ADDR off = objfile->text_section_offset ();
 
              bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
                                    0, cs->c_naux, &main_aux);
@@ -1398,7 +1403,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
                            NULL, cstk.start_addr,
                            (fcn_cs_saved.c_value
                             + fcn_aux_saved.x_sym.x_misc.x_fsize
-                            + objfile->section_offsets[SECT_OFF_TEXT (objfile)]));
+                            + objfile->text_section_offset ()));
              within_function = 0;
            }
          break;
@@ -1465,7 +1470,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
              depth++;
              newobj = push_context (depth,
                                  (cs->c_value
-                                  + objfile->section_offsets[SECT_OFF_TEXT (objfile)]));
+                                  + objfile->text_section_offset ()));
            }
          else if (strcmp (cs->c_name, ".eb") == 0)
            {
@@ -1487,7 +1492,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
                                cstk.old_blocks, NULL,
                                cstk.start_addr,
                                (cs->c_value
-                                + objfile->section_offsets[SECT_OFF_TEXT (objfile)]));
+                                + objfile->text_section_offset ()));
                }
              *get_local_symbols () = cstk.locals;
            }
@@ -1516,11 +1521,6 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
     }
 }
 
-#define        SYMBOL_DUP(SYMBOL1, SYMBOL2)    \
-  (SYMBOL2) = new (&objfile->objfile_obstack) symbol (); \
-  *(SYMBOL2) = *(SYMBOL1);
-
-
 #define        SYMNAME_ALLOC(NAME, ALLOCED)    \
   ((ALLOCED) ? (NAME) : obstack_strdup (&objfile->objfile_obstack, \
                                        (NAME)))
@@ -1556,8 +1556,6 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
   if (name[0] == '.')
     ++name;
 
-  initialize_objfile_symbol (sym);
-
   /* default assumptions */
   SET_SYMBOL_VALUE_ADDRESS (sym, cs->c_value + off);
   SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
@@ -1573,7 +1571,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
       SYMBOL_TYPE (sym) = objfile_type (objfile)->nodebug_text_symbol;
 
       SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
-      SYMBOL_DUP (sym, sym2);
+      sym2 = new (&objfile->objfile_obstack) symbol (*sym);
 
       if (cs->c_sclass == C_EXT || C_WEAKEXT)
        add_symbol_to_list (sym2, get_global_symbols ());
@@ -1816,38 +1814,12 @@ find_linenos (struct bfd *abfd, struct bfd_section *asect, void *vpinfo)
 }
 \f
 static void
-xcoff_psymtab_to_symtab_1 (struct objfile *objfile, struct partial_symtab *pst)
+xcoff_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
 {
-  int i;
-
-  if (!pst)
-    return;
-
-  if (pst->readin)
-    {
-      fprintf_unfiltered
-       (gdb_stderr, "Psymtab for %s already read in.  Shouldn't happen.\n",
-        pst->filename);
-      return;
-    }
+  gdb_assert (!pst->readin);
 
   /* Read in all partial symtabs on which this one is dependent.  */
-  for (i = 0; i < pst->number_of_dependencies; i++)
-    if (!pst->dependencies[i]->readin)
-      {
-       /* Inform about additional files that need to be read in.  */
-       if (info_verbose)
-         {
-           fputs_filtered (" ", gdb_stdout);
-           wrap_here ("");
-           fputs_filtered ("and ", gdb_stdout);
-           wrap_here ("");
-           printf_filtered ("%s...", pst->dependencies[i]->filename);
-           wrap_here ("");     /* Flush output */
-           gdb_flush (gdb_stdout);
-         }
-       xcoff_psymtab_to_symtab_1 (objfile, pst->dependencies[i]);
-      }
+  pst->expand_dependencies (objfile);
 
   if (((struct symloc *) pst->read_symtab_private)->numsyms != 0)
     {
@@ -1858,45 +1830,27 @@ xcoff_psymtab_to_symtab_1 (struct objfile *objfile, struct partial_symtab *pst)
       read_xcoff_symtab (objfile, pst);
     }
 
-  pst->readin = 1;
+  pst->readin = true;
 }
 
 /* Read in all of the symbols for a given psymtab for real.
    Be verbose about it if the user wants that.  SELF is not NULL.  */
 
 static void
-xcoff_read_symtab (struct partial_symtab *self, struct objfile *objfile)
+xcoff_read_symtab (legacy_psymtab *self, struct objfile *objfile)
 {
-  if (self->readin)
-    {
-      fprintf_unfiltered
-       (gdb_stderr, "Psymtab for %s already read in.  Shouldn't happen.\n",
-        self->filename);
-      return;
-    }
+  gdb_assert (!self->readin);
 
   if (((struct symloc *) self->read_symtab_private)->numsyms != 0
       || self->number_of_dependencies)
     {
-      /* Print the message now, before reading the string table,
-         to avoid disconcerting pauses.  */
-      if (info_verbose)
-       {
-         printf_filtered ("Reading in symbols for %s...", self->filename);
-         gdb_flush (gdb_stdout);
-       }
-
       next_symbol_text_func = xcoff_next_symbol_text;
 
-      xcoff_psymtab_to_symtab_1 (objfile, self);
+      self->expand_psymtab (objfile);
 
       /* Match with global symbols.  This only needs to be done once,
          after all of the symtabs and dependencies have been read in.   */
       scan_file_globals (objfile);
-
-      /* Finish up the debug error message.  */
-      if (info_verbose)
-       printf_filtered ("done.\n");
     }
 }
 \f
@@ -2002,20 +1956,18 @@ static unsigned int first_fun_line_offset;
    is the address relative to which its symbols are (incremental) or 0
    (normal).  */
 
-static struct partial_symtab *
+static legacy_psymtab *
 xcoff_start_psymtab (struct objfile *objfile,
                     const char *filename, int first_symnum)
 {
-  struct partial_symtab *result =
-    start_psymtab_common (objfile,
-                         filename,
-                         /* We fill in textlow later.  */
-                         0);
+  /* We fill in textlow later.  */
+  legacy_psymtab *result = new legacy_psymtab (filename, objfile, 0);
 
   result->read_symtab_private =
     XOBNEW (&objfile->objfile_obstack, struct symloc);
   ((struct symloc *) result->read_symtab_private)->first_symnum = first_symnum;
-  result->read_symtab = xcoff_read_symtab;
+  result->legacy_read_symtab = xcoff_read_symtab;
+  result->legacy_expand_psymtab = xcoff_expand_psymtab;
 
   /* Deduce the source language from the filename for this psymtab.  */
   psymtab_language = deduce_language_from_filename (filename);
@@ -2031,11 +1983,11 @@ xcoff_start_psymtab (struct objfile *objfile,
    INCLUDE_LIST, NUM_INCLUDES, DEPENDENCY_LIST, and NUMBER_DEPENDENCIES
    are the information for includes and dependencies.  */
 
-static struct partial_symtab *
-xcoff_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
+static legacy_psymtab *
+xcoff_end_psymtab (struct objfile *objfile, legacy_psymtab *pst,
                   const char **include_list, int num_includes,
                   int capping_symbol_number,
-                  struct partial_symtab **dependency_list,
+                  legacy_psymtab **dependency_list,
                   int number_dependencies, int textlow_not_set)
 {
   int i;
@@ -2056,15 +2008,15 @@ xcoff_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
       pst->dependencies
        = objfile->partial_symtabs->allocate_dependencies (number_dependencies);
       memcpy (pst->dependencies, dependency_list,
-             number_dependencies * sizeof (struct partial_symtab *));
+             number_dependencies * sizeof (legacy_psymtab *));
     }
   else
     pst->dependencies = 0;
 
   for (i = 0; i < num_includes; i++)
     {
-      struct partial_symtab *subpst =
-       allocate_psymtab (include_list[i], objfile);
+      legacy_psymtab *subpst =
+       new legacy_psymtab (include_list[i], objfile);
 
       subpst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, symloc);
       ((struct symloc *) subpst->read_symtab_private)->first_symnum = 0;
@@ -2077,7 +2029,8 @@ xcoff_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
       subpst->dependencies[0] = pst;
       subpst->number_of_dependencies = 1;
 
-      subpst->read_symtab = pst->read_symtab;
+      subpst->legacy_read_symtab = pst->legacy_read_symtab;
+      subpst->legacy_expand_psymtab = pst->legacy_expand_psymtab;
     }
 
   if (num_includes == 0
@@ -2090,7 +2043,7 @@ xcoff_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
       /* Empty psymtabs happen as a result of header files which don't have
          any symbols in them.  There can be a lot of them.  */
 
-      discard_psymtab (objfile, pst);
+      objfile->partial_symtabs->discard_psymtab (pst);
 
       /* Indicate that psymtab was thrown away.  */
       pst = NULL;
@@ -2161,7 +2114,7 @@ static void
 scan_xcoff_symtab (minimal_symbol_reader &reader,
                   struct objfile *objfile)
 {
-  struct gdbarch *gdbarch = get_objfile_arch (objfile);
+  struct gdbarch *gdbarch = objfile->arch ();
   CORE_ADDR toc_offset = 0;    /* toc offset value in data section.  */
   const char *filestring = NULL;
 
@@ -2171,7 +2124,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
   unsigned int nsyms;
 
   /* Current partial symtab */
-  struct partial_symtab *pst;
+  legacy_psymtab *pst;
 
   /* List of current psymtab's include files.  */
   const char **psymtab_include_list;
@@ -2179,7 +2132,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
   int includes_used;
 
   /* Index within current psymtab dependency list.  */
-  struct partial_symtab **dependency_list;
+  legacy_psymtab **dependency_list;
   int dependencies_used, dependencies_allocated;
 
   char *sraw_symbol;
@@ -2193,7 +2146,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
   int misc_func_recorded = 0;  /* true if any misc. function.  */
   int textlow_not_set = 1;
 
-  pst = (struct partial_symtab *) 0;
+  pst = (legacy_psymtab *) 0;
 
   includes_allocated = 30;
   includes_used = 0;
@@ -2203,8 +2156,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
   dependencies_allocated = 30;
   dependencies_used = 0;
   dependency_list =
-    (struct partial_symtab **) alloca (dependencies_allocated *
-                                      sizeof (struct partial_symtab *));
+    (legacy_psymtab **) alloca (dependencies_allocated *
+                                      sizeof (legacy_psymtab *));
 
   set_last_source_file (NULL);
 
This page took 0.029466 seconds and 4 git commands to generate.