aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/dwarf2/cooked-index.c14
-rw-r--r--gdb/dwarf2/cooked-index.h25
-rw-r--r--gdb/dwarf2/read.c6
3 files changed, 29 insertions, 16 deletions
diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
index c82f49e..a4a400e 100644
--- a/gdb/dwarf2/cooked-index.c
+++ b/gdb/dwarf2/cooked-index.c
@@ -203,7 +203,7 @@ cooked_index_entry::full_name (struct obstack *storage, bool for_main) const
{
const char *local_name = for_main ? name : canonical;
- if ((flags & IS_LINKAGE) != 0 || parent_entry == nullptr)
+ if ((flags & IS_LINKAGE) != 0 || get_parent () == nullptr)
return local_name;
const char *sep = nullptr;
@@ -224,7 +224,7 @@ cooked_index_entry::full_name (struct obstack *storage, bool for_main) const
return local_name;
}
- parent_entry->write_scope (storage, sep, for_main);
+ get_parent ()->write_scope (storage, sep, for_main);
obstack_grow0 (storage, local_name, strlen (local_name));
return (const char *) obstack_finish (storage);
}
@@ -236,8 +236,8 @@ cooked_index_entry::write_scope (struct obstack *storage,
const char *sep,
bool for_main) const
{
- if (parent_entry != nullptr)
- parent_entry->write_scope (storage, sep, for_main);
+ if (get_parent () != nullptr)
+ get_parent ()->write_scope (storage, sep, for_main);
const char *local_name = for_main ? name : canonical;
obstack_grow (storage, local_name, strlen (local_name));
obstack_grow (storage, sep, strlen (sep));
@@ -310,7 +310,7 @@ cooked_index_shard::handle_gnat_encoded_entry (cooked_index_entry *entry,
parent = last;
}
- entry->parent_entry = parent;
+ entry->set_parent (parent);
return make_unique_xstrndup (tail.data (), tail.length ());
}
@@ -638,9 +638,9 @@ cooked_index::dump (gdbarch *arch)
gdb_printf (" flags: %s\n", to_string (entry->flags).c_str ());
gdb_printf (" DIE offset: %s\n", sect_offset_str (entry->die_offset));
- if (entry->parent_entry != nullptr)
+ if (entry->get_parent () != nullptr)
gdb_printf (" parent: ((cooked_index_entry *) %p) [%s]\n",
- entry->parent_entry, entry->parent_entry->name);
+ entry->get_parent (), entry->get_parent ()->name);
else
gdb_printf (" parent: ((cooked_index_entry *) 0)\n");
diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h
index a175f67..fa0807a 100644
--- a/gdb/dwarf2/cooked-index.h
+++ b/gdb/dwarf2/cooked-index.h
@@ -94,8 +94,8 @@ struct cooked_index_entry : public allocate_on_obstack
tag (tag_),
flags (flags_),
die_offset (die_offset_),
- parent_entry (parent_entry_),
- per_cu (per_cu_)
+ per_cu (per_cu_),
+ m_parent_entry (parent_entry_)
{
}
@@ -220,6 +220,18 @@ struct cooked_index_entry : public allocate_on_obstack
return compare (canonical, other.canonical, SORT) < 0;
}
+ /* Set parent entry to PARENT. */
+ void set_parent (const cooked_index_entry *parent)
+ {
+ m_parent_entry = parent;
+ }
+
+ /* Return parent entry. */
+ const cooked_index_entry *get_parent () const
+ {
+ return m_parent_entry;
+ }
+
/* The name as it appears in DWARF. This always points into one of
the mapped DWARF sections. Note that this may be the name or the
linkage name -- two entries are created for DIEs which have both
@@ -234,10 +246,6 @@ struct cooked_index_entry : public allocate_on_obstack
cooked_index_flag flags;
/* The offset of this DIE. */
sect_offset die_offset;
- /* The parent entry. This is NULL for top-level entries.
- Otherwise, it points to the parent entry, such as a namespace or
- class. */
- const cooked_index_entry *parent_entry;
/* The CU from which this entry originates. */
dwarf2_per_cu_data *per_cu;
@@ -248,6 +256,11 @@ private:
a parent, its write_scope method is called first. */
void write_scope (struct obstack *storage, const char *sep,
bool for_name) const;
+
+ /* The parent entry. This is NULL for top-level entries.
+ Otherwise, it points to the parent entry, such as a namespace or
+ class. */
+ const cooked_index_entry *m_parent_entry;
};
class cooked_index;
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index ca4dda5..bfbf094 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -16523,7 +16523,7 @@ cooked_indexer::index_dies (cutu_reader *reader,
/* The scope of a DW_TAG_entry_point cooked_index_entry is the one of
its surrounding subroutine. */
if (abbrev->tag == DW_TAG_entry_point)
- this_parent_entry = parent_entry->parent_entry;
+ this_parent_entry = parent_entry->get_parent ();
info_ptr = scan_attributes (reader->cu->per_cu, reader, info_ptr,
info_ptr, abbrev, &name, &linkage_name,
&flags, &sibling, &this_parent_entry,
@@ -16862,7 +16862,7 @@ cooked_index_functions::expand_symtabs_matching
matches. */
bool found = true;
- const cooked_index_entry *parent = entry->parent_entry;
+ const cooked_index_entry *parent = entry->get_parent ();
for (int i = name_vec.size () - 1; i > 0; --i)
{
/* If we ran out of entries, or if this segment doesn't
@@ -16875,7 +16875,7 @@ cooked_index_functions::expand_symtabs_matching
break;
}
- parent = parent->parent_entry;
+ parent = parent->get_parent ();
}
if (!found)