* psymtab.c (find_pc_sect_symtab_from_partial): Return the symtab
[deliverable/binutils-gdb.git] / gdb / dwarf2read.c
index f06dea68e690f8092f07b7566a9d6a9f30c49d24..1514e1393c00f4c941a05c971ce54ddb1139e8a8 100644 (file)
@@ -1582,7 +1582,7 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *vnames)
     }
   else if (section_is_p (sectp->name, &names->eh_frame))
     {
-      flagword aflag = bfd_get_section_flags (ignore_abfd, sectp);
+      flagword aflag = bfd_get_section_flags (abfd, sectp);
 
       if (aflag & SEC_HAS_CONTENTS)
         {
@@ -2992,6 +2992,30 @@ dw2_expand_symtabs_matching
     }
 }
 
+/* A helper for dw2_find_pc_sect_symtab which finds the most specific
+   symtab.  */
+
+static struct symtab *
+recursively_find_pc_sect_symtab (struct symtab *symtab, CORE_ADDR pc)
+{
+  int i;
+
+  if (BLOCKVECTOR (symtab) != NULL
+      && blockvector_contains_pc (BLOCKVECTOR (symtab), pc))
+    return symtab;
+
+  for (i = 0; symtab->includes[i]; ++i)
+    {
+      struct symtab *s;
+
+      s = recursively_find_pc_sect_symtab (s, pc);
+      if (s != NULL)
+       return s;
+    }
+
+  return NULL;
+}
+
 static struct symtab *
 dw2_find_pc_sect_symtab (struct objfile *objfile,
                         struct minimal_symbol *msymbol,
@@ -3000,6 +3024,7 @@ dw2_find_pc_sect_symtab (struct objfile *objfile,
                         int warn_if_readin)
 {
   struct dwarf2_per_cu_data *data;
+  struct symtab *result;
 
   dw2_setup (objfile);
 
@@ -3014,7 +3039,9 @@ dw2_find_pc_sect_symtab (struct objfile *objfile,
     warning (_("(Internal error: pc %s in read in CU, but not in symtab.)"),
             paddress (get_objfile_arch (objfile), pc));
 
-  return dw2_instantiate_symtab (data);
+  result = recursively_find_pc_sect_symtab (dw2_instantiate_symtab (data), pc);
+  gdb_assert (result != NULL);
+  return result;
 }
 
 static void
@@ -15572,9 +15599,12 @@ macro_start_file (int file, int line,
                                       objfile->macro_cache);
 
   if (! current_file)
-    /* If we have no current file, then this must be the start_file
-       directive for the compilation unit's main source file.  */
-    current_file = macro_set_main (pending_macros, full_name);
+    {
+      /* If we have no current file, then this must be the start_file
+        directive for the compilation unit's main source file.  */
+      current_file = macro_set_main (pending_macros, full_name);
+      macro_define_special (pending_macros);
+    }
   else
     current_file = macro_include (current_file, line, full_name);
 
This page took 0.06744 seconds and 4 git commands to generate.