@@ -781,7 +781,6 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
struct coff_symbol fcn_cs_saved;
static struct internal_syment fcn_sym_saved;
static union internal_auxent fcn_aux_saved;
- struct symtab *s;
/* A .file is open. */
int in_source_file = 0;
int next_file_symnum = -1;
@@ -1200,8 +1199,13 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
/* Patch up any opaque types (references to types that are not defined
in the file where they are referenced, e.g. "struct foo *bar"). */
- ALL_OBJFILE_SYMTABS (objfile, s)
- patch_opaque_types (s);
+ {
+ struct compunit_symtab *cu;
+ struct symtab *s;
+
+ ALL_OBJFILE_FILETABS (objfile, cu, s)
+ patch_opaque_types (s);
+ }
coffread_objfile = NULL;
}
@@ -2344,7 +2344,7 @@ end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
subpst->n_static_syms = 0;
subpst->readin = 0;
- subpst->symtab = 0;
+ subpst->compunit_symtab = 0;
subpst->read_symtab = pst->read_symtab;
}
@@ -2644,8 +2644,8 @@ read_ofile_symtab (struct objfile *objfile, struct partial_symtab *pst)
if (last_source_start_addr > text_offset)
last_source_start_addr = text_offset;
- pst->symtab = end_symtab (text_offset + text_size,
- SECT_OFF_TEXT (objfile));
+ pst->compunit_symtab = end_symtab (text_offset + text_size,
+ SECT_OFF_TEXT (objfile));
end_stabs ();
@@ -715,10 +715,10 @@ struct type_unit_group
and is deleted afterwards and not used again. */
VEC (sig_type_ptr) *tus;
- /* The primary symtab.
+ /* The compunit symtab.
Type units in a group needn't all be defined in the same source file,
- so we create an essentially anonymous symtab as the primary symtab. */
- struct symtab *primary_symtab;
+ so we create an essentially anonymous symtab as the compunit symtab. */
+ struct compunit_symtab *compunit_symtab;
/* The data used to construct the hash key. */
struct stmt_list_hash hash;
@@ -1516,8 +1516,9 @@ static void dwarf_decode_lines (struct line_header *, const char *,
static void dwarf2_start_subfile (const char *, const char *);
-static void dwarf2_start_symtab (struct dwarf2_cu *,
- const char *, const char *, CORE_ADDR);
+static struct compunit_symtab *dwarf2_start_symtab (struct dwarf2_cu *,
+ const char *, const char *,
+ CORE_ADDR);
static struct symbol *new_symbol (struct die_info *, struct type *,
struct dwarf2_cu *);
@@ -1716,8 +1717,7 @@ static struct dwarf_block *dwarf_alloc_block (struct dwarf2_cu *);
static struct die_info *dwarf_alloc_die (struct dwarf2_cu *, int);
-static void dwarf_decode_macros (struct dwarf2_cu *, unsigned int,
- const char *, int);
+static void dwarf_decode_macros (struct dwarf2_cu *, unsigned int, int);
static int attr_form_is_block (const struct attribute *);
@@ -2496,7 +2496,7 @@ struct dwarf2_per_cu_quick_data
/* The corresponding symbol table. This is NULL if symbols for this
CU have not yet been read. */
- struct symtab *symtab;
+ struct compunit_symtab *compunit_symtab;
/* A temporary mark bit used when iterating over all CUs in
expand_symtabs_matching. */
@@ -2617,7 +2617,7 @@ dw2_do_instantiate_symtab (struct dwarf2_per_cu_data *per_cu)
back_to = make_cleanup (dwarf2_release_queue, NULL);
if (dwarf2_per_objfile->using_index
- ? per_cu->v.quick->symtab == NULL
+ ? per_cu->v.quick->compunit_symtab == NULL
: (per_cu->v.psymtab == NULL || !per_cu->v.psymtab->readin))
{
queue_comp_unit (per_cu, language_minimal);
@@ -2648,11 +2648,11 @@ dw2_do_instantiate_symtab (struct dwarf2_per_cu_data *per_cu)
the objfile from which this CU came. Returns the resulting symbol
table. */
-static struct symtab *
+static struct compunit_symtab *
dw2_instantiate_symtab (struct dwarf2_per_cu_data *per_cu)
{
gdb_assert (dwarf2_per_objfile->using_index);
- if (!per_cu->v.quick->symtab)
+ if (!per_cu->v.quick->compunit_symtab)
{
struct cleanup *back_to = make_cleanup (free_cached_comp_units, NULL);
increment_reading_symtab ();
@@ -2661,10 +2661,7 @@ dw2_instantiate_symtab (struct dwarf2_per_cu_data *per_cu)
do_cleanups (back_to);
}
- /* The result of symtab expansion is always the primary symtab. */
- gdb_assert (per_cu->v.quick->symtab->primary);
-
- return per_cu->v.quick->symtab;
+ return per_cu->v.quick->compunit_symtab;
}
/* Return the CU/TU given its index.
@@ -3309,11 +3306,15 @@ dw2_get_real_path (struct objfile *objfile,
static struct symtab *
dw2_find_last_source_symtab (struct objfile *objfile)
{
+ struct compunit_symtab *cust;
int index;
dw2_setup (objfile);
index = dwarf2_per_objfile->n_comp_units - 1;
- return dw2_instantiate_symtab (dw2_get_cutu (index));
+ cust = dw2_instantiate_symtab (dw2_get_cutu (index));
+ if (cust == NULL)
+ return NULL;
+ return compunit_primary_filetab (cust);
}
/* Traversal function for dw2_forget_cached_source_info. */
@@ -3356,10 +3357,10 @@ dw2_map_expand_apply (struct objfile *objfile,
int (*callback) (struct symtab *, void *),
void *data)
{
- struct symtab *last_made = objfile->symtabs;
+ struct compunit_symtab *last_made = objfile->compunit_symtabs;
/* Don't visit already-expanded CUs. */
- if (per_cu->v.quick->symtab)
+ if (per_cu->v.quick->compunit_symtab)
return 0;
/* This may expand more than one symtab, and we want to iterate over
@@ -3367,7 +3368,7 @@ dw2_map_expand_apply (struct objfile *objfile,
dw2_instantiate_symtab (per_cu);
return iterate_over_some_symtabs (name, real_path, callback, data,
- objfile->symtabs, last_made);
+ objfile->compunit_symtabs, last_made);
}
/* Implementation of the map_symtabs_matching_filename method. */
@@ -3393,7 +3394,7 @@ dw2_map_symtabs_matching_filename (struct objfile *objfile, const char *name,
struct quick_file_names *file_data;
/* We only need to look at symtabs not already expanded. */
- if (per_cu->v.quick->symtab)
+ if (per_cu->v.quick->compunit_symtab)
continue;
file_data = dw2_get_file_names (per_cu);
@@ -3540,7 +3541,7 @@ dw2_symtab_iter_next (struct dw2_symtab_iterator *iter)
per_cu = dw2_get_cutu (cu_index);
/* Skip if already read in. */
- if (per_cu->v.quick->symtab)
+ if (per_cu->v.quick->compunit_symtab)
continue;
/* Check static vs global. */
@@ -3588,11 +3589,11 @@ dw2_symtab_iter_next (struct dw2_symtab_iterator *iter)
return NULL;
}
-static struct symtab *
+static struct compunit_symtab *
dw2_lookup_symbol (struct objfile *objfile, int block_index,
const char *name, domain_enum domain)
{
- struct symtab *stab_best = NULL;
+ struct compunit_symtab *stab_best = NULL;
struct mapped_index *index;
dw2_setup (objfile);
@@ -3610,8 +3611,8 @@ dw2_lookup_symbol (struct objfile *objfile, int block_index,
while ((per_cu = dw2_symtab_iter_next (&iter)) != NULL)
{
struct symbol *sym = NULL;
- struct symtab *stab = dw2_instantiate_symtab (per_cu);
- const struct blockvector *bv = SYMTAB_BLOCKVECTOR (stab);
+ struct compunit_symtab *stab = dw2_instantiate_symtab (per_cu);
+ const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (stab);
struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
/* Some caution must be observed with overloaded functions
@@ -3646,7 +3647,7 @@ dw2_print_stats (struct objfile *objfile)
{
struct dwarf2_per_cu_data *per_cu = dw2_get_cutu (i);
- if (!per_cu->v.quick->symtab)
+ if (!per_cu->v.quick->compunit_symtab)
++count;
}
printf_filtered (_(" Number of read CUs: %d\n"), total - count);
@@ -3743,7 +3744,7 @@ dw2_expand_symtabs_with_fullname (struct objfile *objfile,
struct quick_file_names *file_data;
/* We only need to look at symtabs not already expanded. */
- if (per_cu->v.quick->symtab)
+ if (per_cu->v.quick->compunit_symtab)
continue;
file_data = dw2_get_file_names (per_cu);
@@ -3823,7 +3824,7 @@ dw2_expand_symtabs_matching
per_cu->v.quick->mark = 0;
/* We only need to look at symtabs not already expanded. */
- if (per_cu->v.quick->symtab)
+ if (per_cu->v.quick->compunit_symtab)
continue;
file_data = dw2_get_file_names (per_cu);
@@ -3958,26 +3959,27 @@ dw2_expand_symtabs_matching
}
}
-/* A helper for dw2_find_pc_sect_symtab which finds the most specific
+/* A helper for dw2_find_pc_sect_compunit_symtab which finds the most specific
symtab. */
-static struct symtab *
-recursively_find_pc_sect_symtab (struct symtab *symtab, CORE_ADDR pc)
+static struct compunit_symtab *
+recursively_find_pc_sect_compunit_symtab (struct compunit_symtab *cust,
+ CORE_ADDR pc)
{
int i;
- if (SYMTAB_BLOCKVECTOR (symtab) != NULL
- && blockvector_contains_pc (SYMTAB_BLOCKVECTOR (symtab), pc))
- return symtab;
+ if (COMPUNIT_BLOCKVECTOR (cust) != NULL
+ && blockvector_contains_pc (COMPUNIT_BLOCKVECTOR (cust), pc))
+ return cust;
- if (symtab->includes == NULL)
+ if (cust->includes == NULL)
return NULL;
- for (i = 0; symtab->includes[i]; ++i)
+ for (i = 0; cust->includes[i]; ++i)
{
- struct symtab *s = symtab->includes[i];
+ struct compunit_symtab *s = cust->includes[i];
- s = recursively_find_pc_sect_symtab (s, pc);
+ s = recursively_find_pc_sect_compunit_symtab (s, pc);
if (s != NULL)
return s;
}
@@ -3985,15 +3987,15 @@ recursively_find_pc_sect_symtab (struct symtab *symtab, CORE_ADDR pc)
return NULL;
}
-static struct symtab *
-dw2_find_pc_sect_symtab (struct objfile *objfile,
- struct bound_minimal_symbol msymbol,
- CORE_ADDR pc,
- struct obj_section *section,
- int warn_if_readin)
+static struct compunit_symtab *
+dw2_find_pc_sect_compunit_symtab (struct objfile *objfile,
+ struct bound_minimal_symbol msymbol,
+ CORE_ADDR pc,
+ struct obj_section *section,
+ int warn_if_readin)
{
struct dwarf2_per_cu_data *data;
- struct symtab *result;
+ struct compunit_symtab *result;
dw2_setup (objfile);
@@ -4004,11 +4006,13 @@ dw2_find_pc_sect_symtab (struct objfile *objfile,
if (!data)
return NULL;
- if (warn_if_readin && data->v.quick->symtab)
+ if (warn_if_readin && data->v.quick->compunit_symtab)
warning (_("(Internal error: pc %s in read in CU, but not in symtab.)"),
paddress (get_objfile_arch (objfile), pc));
- result = recursively_find_pc_sect_symtab (dw2_instantiate_symtab (data), pc);
+ result
+ = recursively_find_pc_sect_compunit_symtab (dw2_instantiate_symtab (data),
+ pc);
gdb_assert (result != NULL);
return result;
}
@@ -4033,7 +4037,7 @@ dw2_map_symbol_filenames (struct objfile *objfile, symbol_filename_ftype *fun,
{
struct dwarf2_per_cu_data *per_cu = dw2_get_cutu (i);
- if (per_cu->v.quick->symtab)
+ if (per_cu->v.quick->compunit_symtab)
{
void **slot = htab_find_slot (visited, per_cu->v.quick->file_names,
INSERT);
@@ -4050,7 +4054,7 @@ dw2_map_symbol_filenames (struct objfile *objfile, symbol_filename_ftype *fun,
void **slot;
/* We only need to look at symtabs not already expanded. */
- if (per_cu->v.quick->symtab)
+ if (per_cu->v.quick->compunit_symtab)
continue;
file_data = dw2_get_file_names (per_cu);
@@ -4101,7 +4105,7 @@ const struct quick_symbol_functions dwarf2_gdb_index_functions =
dw2_expand_symtabs_with_fullname,
dw2_map_matching_symbols,
dw2_expand_symtabs_matching,
- dw2_find_pc_sect_symtab,
+ dw2_find_pc_sect_compunit_symtab,
dw2_map_symbol_filenames
};
@@ -4419,7 +4423,7 @@ dwarf2_create_include_psymtab (const char *name, struct partial_symtab *pst,
subpst->n_global_syms = 0;
subpst->statics_offset = 0;
subpst->n_static_syms = 0;
- subpst->symtab = NULL;
+ subpst->compunit_symtab = NULL;
subpst->read_symtab = pst->read_symtab;
subpst->readin = 0;
@@ -4757,7 +4761,7 @@ fill_in_sig_entry_from_dwo_entry (struct objfile *objfile,
if (dwarf2_per_objfile->using_index)
{
gdb_assert (sig_entry->per_cu.v.quick != NULL);
- gdb_assert (sig_entry->per_cu.v.quick->symtab == NULL);
+ gdb_assert (sig_entry->per_cu.v.quick->compunit_symtab == NULL);
}
else
gdb_assert (sig_entry->per_cu.v.psymtab == NULL);
@@ -7446,7 +7450,7 @@ process_queue (void)
for (item = dwarf2_queue; item != NULL; dwarf2_queue = item = next_item)
{
if (dwarf2_per_objfile->using_index
- ? !item->per_cu->v.quick->symtab
+ ? !item->per_cu->v.quick->compunit_symtab
: (item->per_cu->v.psymtab && !item->per_cu->v.psymtab->readin))
{
struct dwarf2_per_cu_data *per_cu = item->per_cu;
@@ -7773,26 +7777,26 @@ fixup_go_packaging (struct dwarf2_cu *cu)
/* Return the symtab for PER_CU. This works properly regardless of
whether we're using the index or psymtabs. */
-static struct symtab *
-get_symtab (struct dwarf2_per_cu_data *per_cu)
+static struct compunit_symtab *
+get_compunit_symtab (struct dwarf2_per_cu_data *per_cu)
{
return (dwarf2_per_objfile->using_index
- ? per_cu->v.quick->symtab
- : per_cu->v.psymtab->symtab);
+ ? per_cu->v.quick->compunit_symtab
+ : per_cu->v.psymtab->compunit_symtab);
}
/* A helper function for computing the list of all symbol tables
included by PER_CU. */
static void
-recursively_compute_inclusions (VEC (symtab_ptr) **result,
+recursively_compute_inclusions (VEC (compunit_symtab_ptr) **result,
htab_t all_children, htab_t all_type_symtabs,
struct dwarf2_per_cu_data *per_cu,
- struct symtab *immediate_parent)
+ struct compunit_symtab *immediate_parent)
{
void **slot;
int ix;
- struct symtab *symtab;
+ struct compunit_symtab *cust;
struct dwarf2_per_cu_data *iter;
slot = htab_find_slot (all_children, per_cu, INSERT);
@@ -7804,27 +7808,27 @@ recursively_compute_inclusions (VEC (symtab_ptr) **result,
*slot = per_cu;
/* Only add a CU if it has a symbol table. */
- symtab = get_symtab (per_cu);
- if (symtab != NULL)
+ cust = get_compunit_symtab (per_cu);
+ if (cust != NULL)
{
/* If this is a type unit only add its symbol table if we haven't
seen it yet (type unit per_cu's can share symtabs). */
if (per_cu->is_debug_types)
{
- slot = htab_find_slot (all_type_symtabs, symtab, INSERT);
+ slot = htab_find_slot (all_type_symtabs, cust, INSERT);
if (*slot == NULL)
{
- *slot = symtab;
- VEC_safe_push (symtab_ptr, *result, symtab);
- if (symtab->user == NULL)
- symtab->user = immediate_parent;
+ *slot = cust;
+ VEC_safe_push (compunit_symtab_ptr, *result, cust);
+ if (cust->user == NULL)
+ cust->user = immediate_parent;
}
}
else
{
- VEC_safe_push (symtab_ptr, *result, symtab);
- if (symtab->user == NULL)
- symtab->user = immediate_parent;
+ VEC_safe_push (compunit_symtab_ptr, *result, cust);
+ if (cust->user == NULL)
+ cust->user = immediate_parent;
}
}
@@ -7833,15 +7837,15 @@ recursively_compute_inclusions (VEC (symtab_ptr) **result,
++ix)
{
recursively_compute_inclusions (result, all_children,
- all_type_symtabs, iter, symtab);
+ all_type_symtabs, iter, cust);
}
}
-/* Compute the symtab 'includes' fields for the symtab related to
+/* Compute the compunit_symtab 'includes' fields for the compunit_symtab of
PER_CU. */
static void
-compute_symtab_includes (struct dwarf2_per_cu_data *per_cu)
+compute_compunit_symtab_includes (struct dwarf2_per_cu_data *per_cu)
{
gdb_assert (! per_cu->is_debug_types);
@@ -7849,13 +7853,13 @@ compute_symtab_includes (struct dwarf2_per_cu_data *per_cu)
{
int ix, len;
struct dwarf2_per_cu_data *per_cu_iter;
- struct symtab *symtab_iter;
- VEC (symtab_ptr) *result_symtabs = NULL;
+ struct compunit_symtab *compunit_symtab_iter;
+ VEC (compunit_symtab_ptr) *result_symtabs = NULL;
htab_t all_children, all_type_symtabs;
- struct symtab *symtab = get_symtab (per_cu);
+ struct compunit_symtab *cust = get_compunit_symtab (per_cu);
/* If we don't have a symtab, we can just skip this case. */
- if (symtab == NULL)
+ if (cust == NULL)
return;
all_children = htab_create_alloc (1, htab_hash_pointer, htab_eq_pointer,
@@ -7870,21 +7874,22 @@ compute_symtab_includes (struct dwarf2_per_cu_data *per_cu)
{
recursively_compute_inclusions (&result_symtabs, all_children,
all_type_symtabs, per_cu_iter,
- symtab);
+ cust);
}
/* Now we have a transitive closure of all the included symtabs. */
- len = VEC_length (symtab_ptr, result_symtabs);
- symtab->includes
+ len = VEC_length (compunit_symtab_ptr, result_symtabs);
+ cust->includes
= obstack_alloc (&dwarf2_per_objfile->objfile->objfile_obstack,
(len + 1) * sizeof (struct symtab *));
for (ix = 0;
- VEC_iterate (symtab_ptr, result_symtabs, ix, symtab_iter);
+ VEC_iterate (compunit_symtab_ptr, result_symtabs, ix,
+ compunit_symtab_iter);
++ix)
- symtab->includes[ix] = symtab_iter;
- symtab->includes[len] = NULL;
+ cust->includes[ix] = compunit_symtab_iter;
+ cust->includes[len] = NULL;
- VEC_free (symtab_ptr, result_symtabs);
+ VEC_free (compunit_symtab_ptr, result_symtabs);
htab_delete (all_children);
htab_delete (all_type_symtabs);
}
@@ -7905,7 +7910,7 @@ process_cu_includes (void)
++ix)
{
if (! iter->is_debug_types)
- compute_symtab_includes (iter);
+ compute_compunit_symtab_includes (iter);
}
VEC_free (dwarf2_per_cu_ptr, dwarf2_per_objfile->just_read_cus);
@@ -7921,7 +7926,7 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
struct dwarf2_cu *cu = per_cu->cu;
struct objfile *objfile = per_cu->objfile;
CORE_ADDR lowpc, highpc;
- struct symtab *symtab;
+ struct compunit_symtab *cust;
struct cleanup *back_to, *delayed_list_cleanup;
CORE_ADDR baseaddr;
struct block *static_block;
@@ -7965,18 +7970,19 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
this comp unit. */
dwarf2_record_block_ranges (cu->dies, static_block, baseaddr, cu);
- symtab = end_symtab_from_static_block (static_block,
- SECT_OFF_TEXT (objfile), 0);
+ cust = end_symtab_from_static_block (static_block,
+ SECT_OFF_TEXT (objfile), 0);
- if (symtab != NULL)
+ if (cust != NULL)
{
int gcc_4_minor = producer_is_gcc_ge_4 (cu->producer);
/* Set symtab language to language from DW_AT_language. If the
compilation is from a C file generated by language preprocessors, do
not set the language if it was already deduced by start_subfile. */
- if (!(cu->language == language_c && symtab->language != language_c))
- symtab->language = cu->language;
+ if (!(cu->language == language_c
+ && COMPUNIT_FILETABS (cust)->language != language_c))
+ COMPUNIT_FILETABS (cust)->language = cu->language;
/* GCC-4.0 has started to support -fvar-tracking. GCC-3.x still can
produce DW_AT_location with location lists but it can be possibly
@@ -7991,20 +7997,20 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
options - this waits on GCC PR other/32998 (-frecord-gcc-switches).
*/
if (cu->has_loclist && gcc_4_minor >= 5)
- symtab->locations_valid = 1;
+ cust->locations_valid = 1;
if (gcc_4_minor >= 5)
- symtab->epilogue_unwind_valid = 1;
+ cust->epilogue_unwind_valid = 1;
- symtab->call_site_htab = cu->call_site_htab;
+ cust->call_site_htab = cu->call_site_htab;
}
if (dwarf2_per_objfile->using_index)
- per_cu->v.quick->symtab = symtab;
+ per_cu->v.quick->compunit_symtab = cust;
else
{
struct partial_symtab *pst = per_cu->v.psymtab;
- pst->symtab = symtab;
+ pst->compunit_symtab = cust;
pst->readin = 1;
}
@@ -8023,7 +8029,7 @@ process_full_type_unit (struct dwarf2_per_cu_data *per_cu,
{
struct dwarf2_cu *cu = per_cu->cu;
struct objfile *objfile = per_cu->objfile;
- struct symtab *symtab;
+ struct compunit_symtab *cust;
struct cleanup *back_to, *delayed_list_cleanup;
struct signatured_type *sig_type;
@@ -8056,33 +8062,34 @@ process_full_type_unit (struct dwarf2_per_cu_data *per_cu,
If this is the first TU to use this symtab, complete the construction
of it with end_expandable_symtab. Otherwise, complete the addition of
this TU's symbols to the existing symtab. */
- if (sig_type->type_unit_group->primary_symtab == NULL)
+ if (sig_type->type_unit_group->compunit_symtab == NULL)
{
- symtab = end_expandable_symtab (0, SECT_OFF_TEXT (objfile));
- sig_type->type_unit_group->primary_symtab = symtab;
+ cust = end_expandable_symtab (0, SECT_OFF_TEXT (objfile));
+ sig_type->type_unit_group->compunit_symtab = cust;
- if (symtab != NULL)
+ if (cust != NULL)
{
/* Set symtab language to language from DW_AT_language. If the
compilation is from a C file generated by language preprocessors,
do not set the language if it was already deduced by
start_subfile. */
- if (!(cu->language == language_c && symtab->language != language_c))
- symtab->language = cu->language;
+ if (!(cu->language == language_c
+ && COMPUNIT_FILETABS (cust)->language != language_c))
+ COMPUNIT_FILETABS (cust)->language = cu->language;
}
}
else
{
- augment_type_symtab (sig_type->type_unit_group->primary_symtab);
- symtab = sig_type->type_unit_group->primary_symtab;
+ augment_type_symtab (sig_type->type_unit_group->compunit_symtab);
+ cust = sig_type->type_unit_group->compunit_symtab;
}
if (dwarf2_per_objfile->using_index)
- per_cu->v.quick->symtab = symtab;
+ per_cu->v.quick->compunit_symtab = cust;
else
{
struct partial_symtab *pst = per_cu->v.psymtab;
- pst->symtab = symtab;
+ pst->compunit_symtab = cust;
pst->readin = 1;
}
@@ -9063,7 +9070,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
complaint (&symfile_complaints,
_("CU refers to both DW_AT_GNU_macros and DW_AT_macro_info"));
- dwarf_decode_macros (cu, DW_UNSND (attr), comp_dir, 1);
+ dwarf_decode_macros (cu, DW_UNSND (attr), 1);
}
else
{
@@ -9072,7 +9079,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
{
unsigned int macro_offset = DW_UNSND (attr);
- dwarf_decode_macros (cu, macro_offset, comp_dir, 0);
+ dwarf_decode_macros (cu, macro_offset, 0);
}
}
@@ -9112,7 +9119,7 @@ setup_type_unit_groups (struct die_info *die, struct dwarf2_cu *cu)
do it again, we could fake it and just recreate the part we need
(file name,index -> symtab mapping). If data shows this optimization
is useful we can do it then. */
- first_time = tu_group->primary_symtab == NULL;
+ first_time = tu_group->compunit_symtab == NULL;
/* We have to handle the case of both a missing DW_AT_stmt_list or bad
debug info. */
@@ -9131,7 +9138,7 @@ setup_type_unit_groups (struct die_info *die, struct dwarf2_cu *cu)
gdb_assert (tu_group->symtabs == NULL);
restart_symtab (0);
}
- /* Note: The primary symtab will get allocated at the end. */
+ /* Note: The compunit symtab will get allocated at the end. */
return;
}
@@ -9140,7 +9147,7 @@ setup_type_unit_groups (struct die_info *die, struct dwarf2_cu *cu)
if (first_time)
{
- dwarf2_start_symtab (cu, "", NULL, 0);
+ struct compunit_symtab *cust = dwarf2_start_symtab (cu, "", NULL, 0);
tu_group->num_symtabs = lh->num_file_names;
tu_group->symtabs = XNEWVEC (struct symtab *, lh->num_file_names);
@@ -9154,17 +9161,14 @@ setup_type_unit_groups (struct die_info *die, struct dwarf2_cu *cu)
dir = lh->include_dirs[fe->dir_index - 1];
dwarf2_start_subfile (fe->name, dir);
- /* Note: We don't have to watch for the main subfile here, type units
- don't have DW_AT_name. */
-
if (current_subfile->symtab == NULL)
{
/* NOTE: start_subfile will recognize when it's been passed
a file it has already seen. So we can't assume there's a
- simple mapping from lh->file_names to subfiles,
+ simple mapping from lh->file_names to subfiles, plus
lh->file_names may contain dups. */
- current_subfile->symtab = allocate_symtab (current_subfile->name,
- objfile);
+ current_subfile->symtab
+ = allocate_symtab (cust, current_subfile->name);
}
fe->symtab = current_subfile->symtab;
@@ -17252,9 +17256,8 @@ dwarf_finish_line (struct gdbarch *gdbarch, struct subfile *subfile,
Process the line number information in LH. */
static void
-dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir,
- struct dwarf2_cu *cu, const int decode_for_pst_p,
- CORE_ADDR lowpc)
+dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu,
+ const int decode_for_pst_p, CORE_ADDR lowpc)
{
const gdb_byte *line_ptr, *extended_end;
const gdb_byte *line_end;
@@ -17613,9 +17616,8 @@ dwarf_decode_lines (struct line_header *lh, const char *comp_dir,
{
struct objfile *objfile = cu->objfile;
const int decode_for_pst_p = (pst != NULL);
- struct subfile *first_subfile = current_subfile;
- dwarf_decode_lines_1 (lh, comp_dir, cu, decode_for_pst_p, lowpc);
+ dwarf_decode_lines_1 (lh, cu, decode_for_pst_p, lowpc);
if (decode_for_pst_p)
{
@@ -17637,6 +17639,7 @@ dwarf_decode_lines (struct line_header *lh, const char *comp_dir,
/* Make sure a symtab is created for every file, even files
which contain only variables (i.e. no code with associated
line numbers). */
+ struct compunit_symtab *cust = buildsym_compunit_symtab ();
int i;
for (i = 0; i < lh->num_file_names; i++)
@@ -17649,15 +17652,11 @@ dwarf_decode_lines (struct line_header *lh, const char *comp_dir,
dir = lh->include_dirs[fe->dir_index - 1];
dwarf2_start_subfile (fe->name, dir);
- /* Skip the main file; we don't need it, and it must be
- allocated last, so that it will show up before the
- non-primary symtabs in the objfile's symtab list. */
- if (current_subfile == first_subfile)
- continue;
-
if (current_subfile->symtab == NULL)
- current_subfile->symtab = allocate_symtab (current_subfile->name,
- objfile);
+ {
+ current_subfile->symtab
+ = allocate_symtab (cust, current_subfile->name);
+ }
fe->symtab = current_subfile->symtab;
}
}
@@ -17713,11 +17712,13 @@ dwarf2_start_subfile (const char *filename, const char *dirname)
/* Start a symtab for DWARF.
NAME, COMP_DIR, LOW_PC are passed to start_symtab. */
-static void
+static struct compunit_symtab *
dwarf2_start_symtab (struct dwarf2_cu *cu,
const char *name, const char *comp_dir, CORE_ADDR low_pc)
{
- start_symtab (dwarf2_per_objfile->objfile, name, comp_dir, low_pc);
+ struct compunit_symtab *cust
+ = start_symtab (cu->objfile, name, comp_dir, low_pc);
+
record_debugformat ("DWARF 2");
record_producer (cu->producer);
@@ -17725,6 +17726,8 @@ dwarf2_start_symtab (struct dwarf2_cu *cu,
processing_gcc_compilation = 2;
cu->processing_has_namespace_info = 0;
+
+ return cust;
}
static void
@@ -20359,8 +20362,7 @@ file_full_name (int file, struct line_header *lh, const char *comp_dir)
static struct macro_source_file *
macro_start_file (int file, int line,
struct macro_source_file *current_file,
- const char *comp_dir,
- struct line_header *lh)
+ struct line_header *lh)
{
/* File name relative to the compilation directory of this source file. */
char *file_name = file_file_name (file, lh);
@@ -20369,7 +20371,7 @@ macro_start_file (int file, int line,
{
/* Note: We don't create a macro table for this compilation unit
at all until we actually get a filename. */
- struct macro_table *macro_table = get_macro_table (comp_dir);
+ struct macro_table *macro_table = get_macro_table ();
/* If we have no current file, then this must be the start_file
directive for the compilation unit's main source file. */
@@ -20747,7 +20749,7 @@ static void
dwarf_decode_macro_bytes (bfd *abfd,
const gdb_byte *mac_ptr, const gdb_byte *mac_end,
struct macro_source_file *current_file,
- struct line_header *lh, const char *comp_dir,
+ struct line_header *lh,
struct dwarf2_section_info *section,
int section_is_gnu, int section_is_dwz,
unsigned int offset_size,
@@ -20894,8 +20896,7 @@ dwarf_decode_macro_bytes (bfd *abfd,
at_commandline = 0;
}
else
- current_file = macro_start_file (file, line, current_file,
- comp_dir, lh);
+ current_file = macro_start_file (file, line, current_file, lh);
}
break;
@@ -20979,8 +20980,7 @@ dwarf_decode_macro_bytes (bfd *abfd,
*slot = (void *) new_mac_ptr;
dwarf_decode_macro_bytes (include_bfd, new_mac_ptr,
- include_mac_end, current_file,
- lh, comp_dir,
+ include_mac_end, current_file, lh,
section, section_is_gnu, is_dwz,
offset_size, include_hash);
@@ -21018,7 +21018,7 @@ dwarf_decode_macro_bytes (bfd *abfd,
static void
dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
- const char *comp_dir, int section_is_gnu)
+ int section_is_gnu)
{
struct objfile *objfile = dwarf2_per_objfile->objfile;
struct line_header *lh = cu->line_header;
@@ -21137,8 +21137,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
file = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
mac_ptr += bytes_read;
- current_file = macro_start_file (file, line, current_file,
- comp_dir, lh);
+ current_file = macro_start_file (file, line, current_file, lh);
}
break;
@@ -21203,7 +21202,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
slot = htab_find_slot (include_hash, mac_ptr, INSERT);
*slot = (void *) mac_ptr;
dwarf_decode_macro_bytes (abfd, mac_ptr, mac_end,
- current_file, lh, comp_dir, section,
+ current_file, lh, section,
section_is_gnu, 0, offset_size, include_hash);
do_cleanups (cleanup);
}
@@ -237,7 +237,7 @@ enum block_type { FUNCTION_BLOCK, NON_FUNCTION_BLOCK };
static struct block *new_block (enum block_type);
-static struct symtab *new_symtab (const char *, int, struct objfile *);
+static struct compunit_symtab *new_symtab (const char *, int, struct objfile *);
static struct linetable *new_linetable (int);
@@ -1922,7 +1922,7 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
in question, or NULL to use top_stack->cur_block. */
static void
-parse_procedure (PDR *pr, struct symtab *search_symtab,
+parse_procedure (PDR *pr, struct compunit_symtab *search_symtab,
struct partial_symtab *pst)
{
struct symbol *s, *i;
@@ -1984,7 +1984,8 @@ parse_procedure (PDR *pr, struct symtab *search_symtab,
#else
s = mylookup_symbol
(sh_name,
- BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (search_symtab), STATIC_BLOCK),
+ BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (search_symtab),
+ STATIC_BLOCK),
VAR_DOMAIN,
LOC_BLOCK);
#endif
@@ -3929,7 +3930,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
void (*swap_sym_in) (bfd *, void *, SYMR *);
void (*swap_pdr_in) (bfd *, void *, PDR *);
int i;
- struct symtab *st = NULL;
+ struct compunit_symtab *cust = NULL;
FDR *fh;
struct linetable *lines;
CORE_ADDR lowest_pdr_addr = 0;
@@ -4053,7 +4054,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
valu += ANOFFSET (pst->section_offsets,
SECT_OFF_TEXT (objfile));
previous_stab_code = N_SO;
- st = end_symtab (valu, SECT_OFF_TEXT (objfile));
+ cust = end_symtab (valu, SECT_OFF_TEXT (objfile));
end_stabs ();
last_symtab_ended = 1;
}
@@ -4117,7 +4118,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
if (! last_symtab_ended)
{
- st = end_symtab (pst->texthigh, SECT_OFF_TEXT (objfile));
+ cust = end_symtab (pst->texthigh, SECT_OFF_TEXT (objfile));
end_stabs ();
}
@@ -4161,7 +4162,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
pdr_in = pr_block;
pdr_in_end = pdr_in + fh->cpd;
for (; pdr_in < pdr_in_end; pdr_in++)
- parse_procedure (pdr_in, st, pst);
+ parse_procedure (pdr_in, cust, pst);
do_cleanups (old_chain);
}
@@ -4176,28 +4177,28 @@ psymtab_to_symtab_1 (struct objfile *objfile,
if (fh == 0)
{
maxlines = 0;
- st = new_symtab ("unknown", 0, objfile);
+ cust = new_symtab ("unknown", 0, objfile);
}
else
{
maxlines = 2 * fh->cline;
- st = new_symtab (pst->filename, maxlines, objfile);
+ cust = new_symtab (pst->filename, maxlines, objfile);
/* The proper language was already determined when building
the psymtab, use it. */
- st->language = PST_PRIVATE (pst)->pst_language;
+ COMPUNIT_FILETABS (cust)->language = PST_PRIVATE (pst)->pst_language;
}
- psymtab_language = st->language;
+ psymtab_language = COMPUNIT_FILETABS (cust)->language;
- lines = SYMTAB_LINETABLE (st);
+ lines = SYMTAB_LINETABLE (COMPUNIT_FILETABS (cust));
/* Get a new lexical context. */
push_parse_stack ();
- top_stack->cur_st = st;
- top_stack->cur_block = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (st),
- STATIC_BLOCK);
+ top_stack->cur_st = COMPUNIT_FILETABS (cust);
+ top_stack->cur_block
+ = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), STATIC_BLOCK);
BLOCK_START (top_stack->cur_block) = pst->textlow;
BLOCK_END (top_stack->cur_block) = 0;
top_stack->blocktype = stFile;
@@ -4271,7 +4272,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
pdr_in = pr_block;
pdr_in_end = pdr_in + fh->cpd;
for (; pdr_in < pdr_in_end; pdr_in++)
- parse_procedure (pdr_in, 0, pst);
+ parse_procedure (pdr_in, NULL, pst);
do_cleanups (old_chain);
}
@@ -4280,7 +4281,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
size = lines->nitems;
if (size > 1)
--size;
- SYMTAB_LINETABLE (st)
+ SYMTAB_LINETABLE (COMPUNIT_FILETABS (cust))
= obstack_copy (&mdebugread_objfile->objfile_obstack,
lines,
(sizeof (struct linetable)
@@ -4290,7 +4291,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
/* .. and our share of externals.
XXX use the global list to speed up things here. How?
FIXME, Maybe quit once we have found the right number of ext's? */
- top_stack->cur_st = st;
+ top_stack->cur_st = COMPUNIT_FILETABS (cust);
top_stack->cur_block
= BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (top_stack->cur_st),
GLOBAL_BLOCK);
@@ -4307,7 +4308,8 @@ psymtab_to_symtab_1 (struct objfile *objfile,
if (info_verbose && n_undef_symbols)
{
printf_filtered (_("File %s contains %d unresolved references:"),
- symtab_to_filename_for_display (st),
+ symtab_to_filename_for_display
+ (COMPUNIT_FILETABS (cust)),
n_undef_symbols);
printf_filtered ("\n\t%4d variables\n\t%4d "
"procedures\n\t%4d labels\n",
@@ -4317,13 +4319,11 @@ psymtab_to_symtab_1 (struct objfile *objfile,
}
pop_parse_stack ();
- set_symtab_primary (st, 1);
-
- sort_blocks (st);
+ sort_blocks (COMPUNIT_FILETABS (cust));
}
/* Now link the psymtab and the symtab. */
- pst->symtab = st;
+ pst->compunit_symtab = cust;
mdebugread_objfile = NULL;
}
@@ -4726,13 +4726,17 @@ sort_blocks (struct symtab *s)
/* Allocate a new symtab for NAME. Needs an estimate of how many
linenumbers MAXLINES we'll put in it. */
-static struct symtab *
+static struct compunit_symtab *
new_symtab (const char *name, int maxlines, struct objfile *objfile)
{
- struct symtab *s = allocate_symtab (name, objfile);
+ struct compunit_symtab *cust = allocate_compunit_symtab (objfile, name);
+ struct symtab *symtab;
struct blockvector *bv;
- SYMTAB_LINETABLE (s) = new_linetable (maxlines);
+ add_compunit_symtab_to_objfile (cust);
+ symtab = allocate_symtab (cust, name);
+
+ SYMTAB_LINETABLE (symtab) = new_linetable (maxlines);
/* All symtabs must have at least two blocks. */
bv = new_bvect (2);
@@ -4740,10 +4744,10 @@ new_symtab (const char *name, int maxlines, struct objfile *objfile)
BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = new_block (NON_FUNCTION_BLOCK);
BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)) =
BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
- SYMTAB_BLOCKVECTOR (s) = bv;
+ COMPUNIT_BLOCKVECTOR (cust) = bv;
- s->debugformat = "ECOFF";
- return (s);
+ COMPUNIT_DEBUGFORMAT (cust) = "ECOFF";
+ return cust;
}
/* Allocate a new partial_symtab NAME. */
@@ -1136,8 +1136,8 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
{
if (get_last_source_file ())
{
- pst->symtab = end_symtab (cur_src_end_addr,
- SECT_OFF_TEXT (objfile));
+ pst->compunit_symtab = end_symtab (cur_src_end_addr,
+ SECT_OFF_TEXT (objfile));
end_stabs ();
}
@@ -1194,8 +1194,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
{
complete_symtab (filestring, file_start_addr);
cur_src_end_addr = file_end_addr;
- end_symtab (file_end_addr,
- SECT_OFF_TEXT (objfile));
+ end_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
end_stabs ();
start_stabs ();
/* Give all csects for this source file the same
@@ -1504,17 +1503,17 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
if (get_last_source_file ())
{
- struct symtab *s;
+ struct compunit_symtab *cust;
complete_symtab (filestring, file_start_addr);
cur_src_end_addr = file_end_addr;
- s = end_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
+ cust = end_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
/* When reading symbols for the last C_FILE of the objfile, try
- to make sure that we set pst->symtab to the symtab for the
+ to make sure that we set pst->compunit_symtab to the symtab for the
file, not to the _globals_ symtab. I'm not sure whether this
actually works right or when/if it comes up. */
- if (pst->symtab == NULL)
- pst->symtab = s;
+ if (pst->compunit_symtab == NULL)
+ pst->compunit_symtab = cust;
end_stabs ();
}
}
@@ -2107,7 +2106,7 @@ xcoff_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
subpst->n_static_syms = 0;
subpst->readin = 0;
- subpst->symtab = 0;
+ subpst->compunit_symtab = NULL;
subpst->read_symtab = pst->read_symtab;
}