gdb: CTF support
[deliverable/binutils-gdb.git] / gdb / elfread.c
index d2a7bcf8aa6130caa89dae074ddda85bd5f92fd1..53bdd3565943da00baf921521efb6571f2b26b06 100644 (file)
@@ -47,6 +47,7 @@
 #include "location.h"
 #include "auxv.h"
 #include "mdebugread.h"
+#include "ctfread.h"
 
 /* Forward declarations.  */
 extern const struct sym_fns elf_sym_fns_gdb_index;
@@ -61,6 +62,7 @@ struct elfinfo
   {
     asection *stabsect;                /* Section pointer for .stab section */
     asection *mdebugsect;      /* Section pointer for .mdebug section */
+    asection *ctfsect;         /* Section pointer for .ctf section */
   };
 
 /* Type for per-BFD data.  */
@@ -188,6 +190,10 @@ elf_locate_sections (bfd *ignore_abfd, asection *sectp, void *eip)
     {
       ei->mdebugsect = sectp;
     }
+  else if (strcmp (sectp->name, ".ctf") == 0)
+    {
+      ei->ctfsect = sectp;
+    }
 }
 
 static struct minimal_symbol *
@@ -1059,7 +1065,8 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags,
      go away once all types of symbols are in the per-BFD object.  */
   if (objfile->per_bfd->minsyms_read
       && ei->stabsect == NULL
-      && ei->mdebugsect == NULL)
+      && ei->mdebugsect == NULL
+      && ei->ctfsect == NULL)
     {
       if (symtab_create_debug)
        fprintf_unfiltered (gdb_stdlog,
@@ -1200,6 +1207,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
 {
   bfd *abfd = objfile->obfd;
   struct elfinfo ei;
+  bool has_dwarf2 = true;
 
   memset ((char *) &ei, 0, sizeof (ei));
   if (!(objfile->flags & OBJF_READNEVER))
@@ -1302,6 +1310,14 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
          symbol_file_add_separate (debug_bfd.get (), debugfile.c_str (),
                                    symfile_flags, objfile);
        }
+       else
+         has_dwarf2 = false;
+    }
+
+  /* Read the CTF section only if there is no DWARF info.  */
+  if (!has_dwarf2 && ei.ctfsect)
+    {
+      elfctf_build_psymtabs (objfile);
     }
 }
 
This page took 0.024434 seconds and 4 git commands to generate.