+/* DWARF quick_symbols_functions support. */
+
+/* TUs can share .debug_line entries, and there can be a lot more TUs than
+ unique line tables, so we maintain a separate table of all .debug_line
+ derived entries to support the sharing.
+ All the quick functions need is the list of file names. We discard the
+ line_header when we're done and don't need to record it here. */
+struct quick_file_names
+{
+ /* The offset in .debug_line of the line table. We hash on this. */
+ unsigned int offset;
+
+ /* The number of entries in file_names, real_names. */
+ unsigned int num_file_names;
+
+ /* The file names from the line table, after being run through
+ file_full_name. */
+ const char **file_names;
+
+ /* The file names from the line table after being run through
+ gdb_realpath. These are computed lazily. */
+ const char **real_names;
+};
+
+/* When using the index (and thus not using psymtabs), each CU has an
+ object of this type. This is used to hold information needed by
+ the various "quick" methods. */
+struct dwarf2_per_cu_quick_data
+{
+ /* The file table. This can be NULL if there was no file table
+ or it's currently not read in.
+ NOTE: This points into dwarf2_per_objfile->quick_file_names_table. */
+ struct quick_file_names *file_names;
+
+ /* The corresponding symbol table. This is NULL if symbols for this
+ CU have not yet been read. */
+ struct symtab *symtab;
+
+ /* A temporary mark bit used when iterating over all CUs in
+ expand_symtabs_matching. */
+ unsigned int mark : 1;
+
+ /* True if we've tried to read the file table and found there isn't one.
+ There will be no point in trying to read it again next time. */
+ unsigned int no_file_data : 1;
+};
+
+/* Hash function for a quick_file_names. */
+
+static hashval_t
+hash_file_name_entry (const void *e)
+{
+ const struct quick_file_names *file_data = e;
+
+ return file_data->offset;
+}
+
+/* Equality function for a quick_file_names. */
+
+static int
+eq_file_name_entry (const void *a, const void *b)
+{
+ const struct quick_file_names *ea = a;
+ const struct quick_file_names *eb = b;
+
+ return ea->offset == eb->offset;
+}
+
+/* Delete function for a quick_file_names. */
+
+static void
+delete_file_name_entry (void *e)
+{
+ struct quick_file_names *file_data = e;
+ int i;
+
+ for (i = 0; i < file_data->num_file_names; ++i)
+ {
+ xfree ((void*) file_data->file_names[i]);
+ if (file_data->real_names)
+ xfree ((void*) file_data->real_names[i]);
+ }
+
+ /* The space for the struct itself lives on objfile_obstack,
+ so we don't free it here. */
+}
+
+/* Create a quick_file_names hash table. */
+
+static htab_t
+create_quick_file_names_table (unsigned int nr_initial_entries)
+{
+ return htab_create_alloc (nr_initial_entries,
+ hash_file_name_entry, eq_file_name_entry,
+ delete_file_name_entry, xcalloc, xfree);
+}