compilation units are cached... */
struct dwarf2_per_cu_data *read_in_chain;
- /* Backchain to our per_cu entry if the tree has been built. */
+ /* Backlink to our per_cu entry. */
struct dwarf2_per_cu_data *per_cu;
/* How many compilation units ago was this CU last referenced? */
DW_TAG_imported_unit, so we just use the same mechanism: For
.gdb_index version <=7 this also records the TUs that the CU referred
to. Concurrently with this change gdb was modified to emit version 8
- indices so we only pay a price for gold generated indices. */
+ indices so we only pay a price for gold generated indices.
+ http://sourceware.org/bugzilla/show_bug.cgi?id=15021. */
VEC (dwarf2_per_cu_ptr) *imported_symtabs;
};
static void queue_comp_unit (struct dwarf2_per_cu_data *per_cu,
enum language pretend_language);
-static int maybe_queue_comp_unit (struct dwarf2_cu *this_cu,
- struct dwarf2_per_cu_data *per_cu,
- enum language pretend_language);
-
static void process_queue (void);
static void find_file_and_directory (struct die_info *die,
printf_filtered (_(" Number of unread CUs: %d\n"), count);
}
+/* This dumps minimal information about the index.
+ It is called via "mt print objfiles".
+ One use is to verify .gdb_index has been loaded by the
+ gdb.dwarf2/gdb-index.exp testcase. */
+
static void
dw2_dump (struct objfile *objfile)
{
- /* Nothing worth printing. */
+ dw2_setup (objfile);
+ gdb_assert (dwarf2_per_objfile->using_index);
+ printf_filtered (".gdb_index:");
+ if (dwarf2_per_objfile->index_table != NULL)
+ {
+ printf_filtered (" version %d\n",
+ dwarf2_per_objfile->index_table->version);
+ }
+ else
+ printf_filtered (" faked for \"readnow\"\n");
+ printf_filtered ("\n");
}
static void
/* THIS_CU has a reference to PER_CU. If necessary, load the new compilation
unit and add it to our queue.
The result is non-zero if PER_CU was queued, otherwise the result is zero
- meaning either PER_CU is already queued or it is already loaded. */
+ meaning either PER_CU is already queued or it is already loaded.
+
+ N.B. There is an invariant here that if a CU is queued then it is loaded.
+ The caller is required to load PER_CU if we return non-zero. */
static int
maybe_queue_comp_unit (struct dwarf2_cu *this_cu,
is_dwz = (attr->form == DW_FORM_GNU_ref_alt || cu->per_cu->is_dwz);
per_cu = dwarf2_find_containing_comp_unit (offset, is_dwz, cu->objfile);
- /* Queue the unit, if needed. */
+ /* If necessary, add it to the queue and load its DIEs. */
if (maybe_queue_comp_unit (cu, per_cu, cu->language))
load_full_comp_unit (per_cu, cu->language);
if (maybe_queue_comp_unit (*ref_cu, &sig_type->per_cu, language_minimal))
read_signatured_type (sig_type);
- gdb_assert (sig_type->per_cu.cu != NULL);
-
sig_cu = sig_type->per_cu.cu;
+ gdb_assert (sig_cu != NULL);
gdb_assert (sig_type->type_offset_in_section.sect_off != 0);
temp_die.offset = sig_type->type_offset_in_section;
die = htab_find_with_hash (sig_cu->die_hash, &temp_die,
htab_t cu_index_htab;
struct psymtab_cu_index_map *psymtab_cu_index_map;
- if (!objfile->psymtabs || !objfile->psymtabs_addrmap)
- return;
-
if (dwarf2_per_objfile->using_index)
error (_("Cannot use an index to create the index"));
if (VEC_length (dwarf2_section_info_def, dwarf2_per_objfile->types) > 1)
error (_("Cannot make an index when the file has multiple .debug_types sections"));
+ if (!objfile->psymtabs || !objfile->psymtabs_addrmap)
+ return;
+
if (stat (objfile->name, &st) < 0)
perror_with_name (objfile->name);