forked from Imagelibrary/binutils-gdb
gdb/dwarf: rename comp_unit_die to top_level_die
The name "comp_unit_die" is a bit misleading, because it can also represent a type unit (DW_TAG_type_unit). I think that "top_level_die" is clear. Change-Id: Ibaac99897f0ac7499f0f82caeed3385e1e6ee870 Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
@@ -45,9 +45,9 @@ cooked_indexer::check_bounds (cutu_reader *reader)
|
||||
unrelocated_addr best_lowpc = {}, best_highpc = {};
|
||||
/* Possibly set the default values of LOWPC and HIGHPC from
|
||||
`DW_AT_ranges'. */
|
||||
dwarf2_find_base_address (reader->comp_unit_die (), cu);
|
||||
dwarf2_find_base_address (reader->top_level_die (), cu);
|
||||
enum pc_bounds_kind cu_bounds_kind
|
||||
= dwarf2_get_pc_bounds (reader->comp_unit_die (), &best_lowpc, &best_highpc,
|
||||
= dwarf2_get_pc_bounds (reader->top_level_die (), &best_lowpc, &best_highpc,
|
||||
cu, m_index_storage->get_addrmap (), cu->per_cu);
|
||||
if (cu_bounds_kind == PC_BOUNDS_HIGH_LOW && best_lowpc < best_highpc)
|
||||
{
|
||||
@@ -113,16 +113,16 @@ cooked_indexer::ensure_cu_exists (cutu_reader *reader,
|
||||
language_minimal,
|
||||
&m_index_storage->get_abbrev_table_cache ());
|
||||
|
||||
if (new_reader.is_dummy () || new_reader.comp_unit_die () == nullptr
|
||||
|| !new_reader.comp_unit_die ()->has_children)
|
||||
if (new_reader.is_dummy () || new_reader.top_level_die () == nullptr
|
||||
|| !new_reader.top_level_die ()->has_children)
|
||||
return nullptr;
|
||||
|
||||
auto copy = std::make_unique<cutu_reader> (std::move (new_reader));
|
||||
result = m_index_storage->preserve (std::move (copy));
|
||||
}
|
||||
|
||||
if (result->is_dummy () || result->comp_unit_die () == nullptr
|
||||
|| !result->comp_unit_die ()->has_children)
|
||||
if (result->is_dummy () || result->top_level_die () == nullptr
|
||||
|| !result->top_level_die ()->has_children)
|
||||
return nullptr;
|
||||
|
||||
if (for_scanning)
|
||||
@@ -684,9 +684,9 @@ void
|
||||
cooked_indexer::make_index (cutu_reader *reader)
|
||||
{
|
||||
check_bounds (reader);
|
||||
find_file_and_directory (reader->comp_unit_die (), reader->cu ());
|
||||
find_file_and_directory (reader->top_level_die (), reader->cu ());
|
||||
|
||||
if (!reader->comp_unit_die ()->has_children)
|
||||
if (!reader->top_level_die ()->has_children)
|
||||
return;
|
||||
|
||||
index_dies (reader, reader->info_ptr (), nullptr, false);
|
||||
|
||||
@@ -1863,7 +1863,7 @@ dw2_get_file_names (dwarf2_per_cu *this_cu, dwarf2_per_objfile *per_objfile)
|
||||
per_objfile->get_cu (this_cu), true, language_minimal,
|
||||
nullptr);
|
||||
if (!reader.is_dummy ())
|
||||
dw2_get_file_names_reader (reader.cu (), reader.comp_unit_die ());
|
||||
dw2_get_file_names_reader (reader.cu (), reader.top_level_die ());
|
||||
|
||||
return this_cu->file_names;
|
||||
}
|
||||
@@ -2774,7 +2774,7 @@ cutu_reader::init_cu_die_reader (dwarf2_cu *cu, dwarf2_section_info *section,
|
||||
attribute of the referencing CU. At most one of STUB_COMP_UNIT_DIE and
|
||||
STUB_COMP_DIR may be non-NULL.
|
||||
|
||||
*RESULT_READER,*RESULT_INFO_PTR,*RESULT_COMP_UNIT_DIE
|
||||
*RESULT_READER,*RESULT_INFO_PTR,*RESULT_TOP_LEVEL_DIE
|
||||
are filled in with the info of the DIE from the DWO file.
|
||||
|
||||
*RESULT_DWO_ABBREV_TABLE will be filled in with the abbrev table allocated
|
||||
@@ -2788,7 +2788,7 @@ cutu_reader::read_cutu_die_from_dwo (dwarf2_cu *cu, dwo_unit *dwo_unit,
|
||||
die_info *stub_comp_unit_die,
|
||||
const char *stub_comp_dir,
|
||||
const gdb_byte **result_info_ptr,
|
||||
die_info **result_comp_unit_die,
|
||||
die_info **result_top_level_die,
|
||||
abbrev_table_up *result_dwo_abbrev_table)
|
||||
{
|
||||
dwarf2_per_objfile *per_objfile = cu->per_objfile;
|
||||
@@ -2916,7 +2916,7 @@ cutu_reader::read_cutu_die_from_dwo (dwarf2_cu *cu, dwo_unit *dwo_unit,
|
||||
has the benefit of simplifying the rest of the code - all the
|
||||
work to maintain the illusion of a single
|
||||
DW_TAG_{compile,type}_unit DIE is done here. */
|
||||
info_ptr = this->read_toplevel_die (result_comp_unit_die, info_ptr,
|
||||
info_ptr = this->read_toplevel_die (result_top_level_die, info_ptr,
|
||||
gdb::make_array_view (attributes,
|
||||
next_attr_idx));
|
||||
|
||||
@@ -3029,7 +3029,7 @@ cutu_reader::init_tu_and_read_dwo_dies (dwarf2_per_cu *this_cu,
|
||||
if (read_cutu_die_from_dwo (cu, sig_type->dwo_unit,
|
||||
NULL /* stub_comp_unit_die */,
|
||||
sig_type->dwo_unit->dwo_file->comp_dir,
|
||||
&m_info_ptr, &m_comp_unit_die,
|
||||
&m_info_ptr, &m_top_level_die,
|
||||
&m_dwo_abbrev_table)
|
||||
== 0)
|
||||
{
|
||||
@@ -3197,9 +3197,9 @@ cutu_reader::cutu_reader (dwarf2_per_cu *this_cu,
|
||||
|
||||
/* Read the top level CU/TU die. */
|
||||
this->init_cu_die_reader (cu, section, NULL, abbrev_table);
|
||||
m_info_ptr = this->read_toplevel_die (&m_comp_unit_die, m_info_ptr);
|
||||
m_info_ptr = this->read_toplevel_die (&m_top_level_die, m_info_ptr);
|
||||
|
||||
if (skip_partial && m_comp_unit_die->tag == DW_TAG_partial_unit)
|
||||
if (skip_partial && m_top_level_die->tag == DW_TAG_partial_unit)
|
||||
m_dummy_p = true;
|
||||
else
|
||||
{
|
||||
@@ -3213,23 +3213,23 @@ cutu_reader::cutu_reader (dwarf2_per_cu *this_cu,
|
||||
Note that if USE_EXISTING_OK != 0, and THIS_CU->cu
|
||||
already contains a DWO CU, that this test will fail (the
|
||||
attribute will not be present). */
|
||||
const char *dwo_name = dwarf2_dwo_name (m_comp_unit_die, cu);
|
||||
const char *dwo_name = dwarf2_dwo_name (m_top_level_die, cu);
|
||||
if (dwo_name != nullptr)
|
||||
{
|
||||
struct dwo_unit *dwo_unit;
|
||||
struct die_info *dwo_comp_unit_die;
|
||||
|
||||
if (m_comp_unit_die->has_children)
|
||||
if (m_top_level_die->has_children)
|
||||
{
|
||||
complaint (_("compilation unit with DW_AT_GNU_dwo_name"
|
||||
" has children (offset %s) [in module %s]"),
|
||||
sect_offset_str (this_cu->sect_off),
|
||||
bfd_get_filename (abfd));
|
||||
}
|
||||
dwo_unit = lookup_dwo_unit (cu, m_comp_unit_die, dwo_name);
|
||||
dwo_unit = lookup_dwo_unit (cu, m_top_level_die, dwo_name);
|
||||
if (dwo_unit != NULL)
|
||||
{
|
||||
if (read_cutu_die_from_dwo (cu, dwo_unit, m_comp_unit_die,
|
||||
if (read_cutu_die_from_dwo (cu, dwo_unit, m_top_level_die,
|
||||
nullptr, &m_info_ptr,
|
||||
&dwo_comp_unit_die,
|
||||
&m_dwo_abbrev_table)
|
||||
@@ -3239,7 +3239,7 @@ cutu_reader::cutu_reader (dwarf2_per_cu *this_cu,
|
||||
m_dummy_p = true;
|
||||
}
|
||||
else
|
||||
m_comp_unit_die = dwo_comp_unit_die;
|
||||
m_top_level_die = dwo_comp_unit_die;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3254,7 +3254,7 @@ cutu_reader::cutu_reader (dwarf2_per_cu *this_cu,
|
||||
}
|
||||
|
||||
/* Only a dummy unit can be missing the compunit DIE. */
|
||||
gdb_assert (m_dummy_p || m_comp_unit_die != nullptr);
|
||||
gdb_assert (m_dummy_p || m_top_level_die != nullptr);
|
||||
prepare_one_comp_unit (cu, pretend_language);
|
||||
}
|
||||
|
||||
@@ -3342,7 +3342,7 @@ cutu_reader::cutu_reader (dwarf2_per_cu *this_cu,
|
||||
|
||||
this->init_cu_die_reader (m_new_cu.get (), section, dwo_file,
|
||||
m_abbrev_table_holder.get ());
|
||||
info_ptr = this->read_toplevel_die (&m_comp_unit_die, info_ptr);
|
||||
info_ptr = this->read_toplevel_die (&m_top_level_die, info_ptr);
|
||||
}
|
||||
|
||||
prepare_one_comp_unit (m_new_cu.get (), pretend_language);
|
||||
@@ -3482,12 +3482,12 @@ process_psymtab_comp_unit (dwarf2_per_cu *this_cu,
|
||||
reader = storage->preserve (std::move (copy));
|
||||
}
|
||||
|
||||
if (reader->comp_unit_die () == nullptr || reader->is_dummy ())
|
||||
if (reader->top_level_die () == nullptr || reader->is_dummy ())
|
||||
return;
|
||||
|
||||
if (this_cu->is_debug_types)
|
||||
build_type_psymtabs_reader (reader, storage);
|
||||
else if (reader->comp_unit_die ()->tag != DW_TAG_partial_unit)
|
||||
else if (reader->top_level_die ()->tag != DW_TAG_partial_unit)
|
||||
{
|
||||
bool nope = false;
|
||||
if (this_cu->scanned.compare_exchange_strong (nope, true))
|
||||
@@ -3507,7 +3507,7 @@ build_type_psymtabs_reader (cutu_reader *reader,
|
||||
{
|
||||
struct dwarf2_cu *cu = reader->cu ();
|
||||
dwarf2_per_cu *per_cu = cu->per_cu;
|
||||
die_info *type_unit_die = reader->comp_unit_die ();
|
||||
die_info *type_unit_die = reader->top_level_die ();
|
||||
|
||||
gdb_assert (per_cu->is_debug_types);
|
||||
|
||||
@@ -4421,11 +4421,11 @@ load_full_comp_unit (dwarf2_per_cu *this_cu,
|
||||
gdb_assert (cu->die_hash.empty ());
|
||||
cu->die_hash.reserve (cu->header.get_length_without_initial () / 12);
|
||||
|
||||
if (reader.comp_unit_die ()->has_children)
|
||||
reader.comp_unit_die ()->child
|
||||
if (reader.top_level_die ()->has_children)
|
||||
reader.top_level_die ()->child
|
||||
= reader.read_die_and_siblings (reader.info_ptr (), &info_ptr,
|
||||
reader.comp_unit_die ());
|
||||
cu->dies = reader.comp_unit_die ();
|
||||
reader.top_level_die ());
|
||||
cu->dies = reader.top_level_die ();
|
||||
/* comp_unit_die is not stored in die_hash, no need. */
|
||||
|
||||
reader.keep ();
|
||||
@@ -6619,7 +6619,7 @@ create_cus_hash_table (dwarf2_cu *cu, dwo_file &dwo_file)
|
||||
|
||||
if (!reader.is_dummy ())
|
||||
create_dwo_cu_reader (reader.cu (), reader.info_ptr (),
|
||||
reader.comp_unit_die (), &dwo_file, &read_unit);
|
||||
reader.top_level_die (), &dwo_file, &read_unit);
|
||||
info_ptr += per_cu.length ();
|
||||
|
||||
/* If the unit could not be parsed, skip it. */
|
||||
@@ -19160,11 +19160,11 @@ read_signatured_type (signatured_type *sig_type,
|
||||
gdb_assert (cu->die_hash.empty ());
|
||||
cu->die_hash.reserve (cu->header.get_length_without_initial () / 12);
|
||||
|
||||
if (reader.comp_unit_die ()->has_children)
|
||||
reader.comp_unit_die ()->child
|
||||
if (reader.top_level_die ()->has_children)
|
||||
reader.top_level_die ()->child
|
||||
= reader.read_die_and_siblings (info_ptr, &info_ptr,
|
||||
reader.comp_unit_die ());
|
||||
cu->dies = reader.comp_unit_die ();
|
||||
reader.top_level_die ());
|
||||
cu->dies = reader.top_level_die ();
|
||||
/* comp_unit_die is not stored in die_hash, no need. */
|
||||
|
||||
reader.keep ();
|
||||
@@ -19804,7 +19804,7 @@ cutu_reader::prepare_one_comp_unit (struct dwarf2_cu *cu,
|
||||
{
|
||||
struct attribute *attr;
|
||||
|
||||
if (m_comp_unit_die == nullptr)
|
||||
if (m_top_level_die == nullptr)
|
||||
{
|
||||
cu->set_producer (nullptr);
|
||||
cu->language_defn = language_def (pretend_language);
|
||||
@@ -19813,10 +19813,10 @@ cutu_reader::prepare_one_comp_unit (struct dwarf2_cu *cu,
|
||||
return;
|
||||
}
|
||||
|
||||
cu->set_producer (dwarf2_string_attr (m_comp_unit_die, DW_AT_producer, cu));
|
||||
cu->set_producer (dwarf2_string_attr (m_top_level_die, DW_AT_producer, cu));
|
||||
|
||||
/* Set the language we're debugging. */
|
||||
attr = dwarf2_attr (m_comp_unit_die, DW_AT_language, cu);
|
||||
attr = dwarf2_attr (m_top_level_die, DW_AT_language, cu);
|
||||
enum language lang;
|
||||
dwarf_source_language dw_lang = (dwarf_source_language) 0;
|
||||
if (cu->producer_is_xlc_opencl ())
|
||||
@@ -19845,14 +19845,14 @@ cutu_reader::prepare_one_comp_unit (struct dwarf2_cu *cu,
|
||||
cu->language_defn = language_def (lang);
|
||||
|
||||
/* Initialize the lto_artificial field. */
|
||||
attr = dwarf2_attr (m_comp_unit_die, DW_AT_name, cu);
|
||||
attr = dwarf2_attr (m_top_level_die, DW_AT_name, cu);
|
||||
if (attr != nullptr
|
||||
&& cu->producer_is_gcc ()
|
||||
&& attr->as_string () != nullptr
|
||||
&& strcmp (attr->as_string (), "<artificial>") == 0)
|
||||
cu->per_cu->lto_artificial = true;
|
||||
|
||||
switch (m_comp_unit_die->tag)
|
||||
switch (m_top_level_die->tag)
|
||||
{
|
||||
case DW_TAG_compile_unit:
|
||||
cu->per_cu->set_unit_type (DW_UT_compile);
|
||||
@@ -19865,7 +19865,7 @@ cutu_reader::prepare_one_comp_unit (struct dwarf2_cu *cu,
|
||||
break;
|
||||
default:
|
||||
error (_(DWARF_ERROR_PREFIX "unexpected tag '%s' at offset %s"),
|
||||
dwarf_tag_name (m_comp_unit_die->tag),
|
||||
dwarf_tag_name (m_top_level_die->tag),
|
||||
sect_offset_str (cu->per_cu->sect_off));
|
||||
}
|
||||
|
||||
|
||||
@@ -954,7 +954,7 @@ public:
|
||||
|
||||
dwarf2_cu *cu () const { return m_cu; }
|
||||
|
||||
die_info *comp_unit_die () const { return m_comp_unit_die; }
|
||||
die_info *top_level_die () const { return m_top_level_die; }
|
||||
|
||||
const gdb_byte *info_ptr () const { return m_info_ptr; }
|
||||
|
||||
@@ -1061,7 +1061,7 @@ private:
|
||||
const struct abbrev_table *m_abbrev_table;
|
||||
|
||||
const gdb_byte *m_info_ptr = nullptr;
|
||||
struct die_info *m_comp_unit_die = nullptr;
|
||||
struct die_info *m_top_level_die = nullptr;
|
||||
bool m_dummy_p = false;
|
||||
|
||||
dwarf2_per_cu *m_this_cu;
|
||||
|
||||
Reference in New Issue
Block a user