DEBUG_NAMES,
};
-/* Initialize for reading DWARF for OBJFILE. Return false if this
- file will use psymtabs, or true if using an index, in which case
- *INDEX_KIND is set to the index variant in use. */
-extern bool dwarf2_initialize_objfile (struct objfile *objfile,
- dw_index_kind *index_kind);
+/* Initialize for reading DWARF for OBJFILE, and push the appropriate
+ entry on the objfile's "qf" list. */
+extern void dwarf2_initialize_objfile (struct objfile *objfile);
struct psymbol_functions;
extern void dwarf2_build_psymtabs (struct objfile *,
psymbol_functions *psf = nullptr);
extern void dwarf2_build_frame_info (struct objfile *);
-extern quick_symbol_functions_up make_dwarf_gdb_index ();
-extern quick_symbol_functions_up make_dwarf_debug_names ();
-
#endif /* DWARF2_PUBLIC_H */
unsigned int no_file_data : 1;
};
+/* A subclass of psymbol_functions that arranges to read the DWARF
+ partial symbols when needed. */
+struct lazy_dwarf_reader : public psymbol_functions
+{
+ using psymbol_functions::psymbol_functions;
+
+ bool can_lazily_read_symbols () override
+ {
+ return true;
+ }
+
+ void read_partial_symbols (struct objfile *objfile) override
+ {
+ if (dwarf2_has_info (objfile, nullptr))
+ dwarf2_build_psymtabs (objfile, this);
+ }
+};
+
+static quick_symbol_functions_up
+make_lazy_dwarf_reader ()
+{
+ return quick_symbol_functions_up (new lazy_dwarf_reader);
+}
+
struct dwarf2_base_index_functions : public quick_symbol_functions
{
bool has_symbols (struct objfile *objfile) override;
enum search_domain kind) override;
};
-quick_symbol_functions_up
+static quick_symbol_functions_up
make_dwarf_gdb_index ()
{
return quick_symbol_functions_up (new dwarf2_gdb_index);
}
-quick_symbol_functions_up
+static quick_symbol_functions_up
make_dwarf_debug_names ()
{
return quick_symbol_functions_up (new dwarf2_debug_names_index);
return global_index_cache.lookup_gdb_index (build_id, &dwz->index_cache_res);
}
-/* See symfile.h. */
+/* See dwarf2/public.h. */
-bool
-dwarf2_initialize_objfile (struct objfile *objfile, dw_index_kind *index_kind)
+void
+dwarf2_initialize_objfile (struct objfile *objfile)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
if (per_bfd->using_index)
{
dwarf_read_debug_printf ("using_index already set");
- *index_kind = dw_index_kind::GDB_INDEX;
per_objfile->resize_symtabs ();
- return true;
+ objfile->qf.push_front (make_dwarf_gdb_index ());
+ return;
}
per_bfd->using_index = 1;
struct dwarf2_per_cu_quick_data);
}
- /* Return 1 so that gdb sees the "quick" functions. However,
- these functions will be no-ops because we will have expanded
- all symtabs. */
- *index_kind = dw_index_kind::GDB_INDEX;
- return true;
+ /* Arrange for gdb to see the "quick" functions. However, these
+ functions will be no-ops because we will have expanded all
+ symtabs. */
+ objfile->qf.push_front (make_dwarf_gdb_index ());
+ return;
}
/* Was a debug names index already read when we processed an objfile sharing
if (per_bfd->debug_names_table != nullptr)
{
dwarf_read_debug_printf ("re-using shared debug names table");
- *index_kind = dw_index_kind::DEBUG_NAMES;
per_objfile->resize_symtabs ();
- return true;
+ objfile->qf.push_front (make_dwarf_debug_names ());
+ return;
}
/* Was a GDB index already read when we processed an objfile sharing
if (per_bfd->index_table != nullptr)
{
dwarf_read_debug_printf ("re-using shared index table");
- *index_kind = dw_index_kind::GDB_INDEX;
per_objfile->resize_symtabs ();
- return true;
+ objfile->qf.push_front (make_dwarf_gdb_index ());
+ return;
}
/* There might already be partial symtabs built for this BFD. This happens
if (per_bfd->partial_symtabs != nullptr)
{
dwarf_read_debug_printf ("re-using shared partial symtabs");
- return false;
+ objfile->qf.push_front (make_lazy_dwarf_reader ());
+ return;
}
if (dwarf2_read_debug_names (per_objfile))
{
dwarf_read_debug_printf ("found debug names");
- *index_kind = dw_index_kind::DEBUG_NAMES;
per_objfile->resize_symtabs ();
- return true;
+ objfile->qf.push_front (make_dwarf_debug_names ());
+ return;
}
if (dwarf2_read_gdb_index (per_objfile,
get_gdb_index_contents_from_section<dwz_file>))
{
dwarf_read_debug_printf ("found gdb index from file");
- *index_kind = dw_index_kind::GDB_INDEX;
per_objfile->resize_symtabs ();
- return true;
+ objfile->qf.push_front (make_dwarf_gdb_index ());
+ return;
}
/* ... otherwise, try to find the index in the index cache. */
{
dwarf_read_debug_printf ("found gdb index from cache");
global_index_cache.hit ();
- *index_kind = dw_index_kind::GDB_INDEX;
per_objfile->resize_symtabs ();
- return true;
+ objfile->qf.push_front (make_dwarf_gdb_index ());
+ return;
}
global_index_cache.miss ();
- return false;
+ objfile->qf.push_front (make_lazy_dwarf_reader ());
}
\f
#include "debuginfod-support.h"
#include "dwarf2/public.h"
-/* A subclass of psymbol_functions that arranges to read the DWARF
- partial symbols when needed. */
-struct lazy_dwarf_reader : public psymbol_functions
-{
- using psymbol_functions::psymbol_functions;
-
- bool can_lazily_read_symbols () override
- {
- return true;
- }
-
- void read_partial_symbols (struct objfile *objfile) override
- {
- if (dwarf2_has_info (objfile, nullptr))
- dwarf2_build_psymtabs (objfile, this);
- }
-};
-
/* The struct elfinfo is available only during ELF symbol table and
psymtab reading. It is destroyed at the completion of psymtab-reading.
It's local to elf_symfile_read. */
}
if (dwarf2_has_info (objfile, NULL, true))
- {
- dw_index_kind index_kind;
-
- if (dwarf2_initialize_objfile (objfile, &index_kind))
- {
- switch (index_kind)
- {
- case dw_index_kind::GDB_INDEX:
- objfile->qf.push_front (make_dwarf_gdb_index ());
- break;
- case dw_index_kind::DEBUG_NAMES:
- objfile->qf.push_front (make_dwarf_debug_names ());
- break;
- }
- }
- else
- objfile->qf.emplace_front (new lazy_dwarf_reader);
- }
+ dwarf2_initialize_objfile (objfile);
/* If the file has its own symbol tables it has no separate debug
info. `.dynsym'/`.symtab' go to MSYMBOLS, `.debug_info' goes to
SYMTABS/PSYMTABS. `.gnu_debuglink' may no longer be present with