Lines Matching +full:entry +full:- +full:name
1 //===-- DebugNamesDWARFIndex.cpp ------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
31 if (llvm::Error E = index_up->extract())
64 DebugNamesDWARFIndex::GetForeignTypeUnit(const DebugNames::Entry &entry) const {
65 std::optional<uint64_t> type_sig = entry.getForeignTUTypeSignature();
69 // Ask the entry for the skeleton compile unit offset and fetch the .dwo
73 std::optional<uint64_t> cu_offset = entry.getRelatedCUOffset();
85 DWARFUnit &dwo_cu = cu->GetNonSkeletonUnit();
101 // then we need to ignore this accelerator table entry as the type unit that
103 // type unit that ended up in a .dwp file matches this DebugNames::Entry, we
104 // need to find the skeleton compile unit for this entry.
105 DWARFTypeUnit *foreign_tu = dwp_sp->DebugInfo().GetTypeUnitForHash(*type_sig);
109 DWARFBaseDIE cu_die = cu->GetUnitDIEOnly();
110 DWARFBaseDIE tu_die = foreign_tu->GetUnitDIEOnly();
121 DebugNamesDWARFIndex::GetNonSkeletonUnit(const DebugNames::Entry &entry) const {
123 if (std::optional<DWARFTypeUnit *> foreign_tu = GetForeignTypeUnit(entry))
128 std::optional<uint64_t> unit_offset = entry.getCUOffset();
130 unit_offset = entry.getLocalTUOffset();
134 return &cu->GetNonSkeletonUnit();
139 DWARFDIE DebugNamesDWARFIndex::GetDIE(const DebugNames::Entry &entry) const {
140 DWARFUnit *unit = GetNonSkeletonUnit(entry);
141 std::optional<uint64_t> die_offset = entry.getDIEUnitOffset();
144 if (DWARFDIE die = unit->GetDIE(unit->GetOffset() + *die_offset))
155 const DebugNames::Entry &entry,
157 DWARFDIE die = GetDIE(entry);
170 llvm::StringRef name) {
175 "Failed to parse index entries for index at {1:x}, name {2}: {0}",
176 ni.getUnitOffset(), name);
181 for (const DebugNames::Entry &entry :
182 m_debug_names_up->equal_range(basename.GetStringRef())) {
183 if (entry.tag() != DW_TAG_variable)
186 if (!ProcessEntry(entry, callback))
203 llvm::Expected<DebugNames::Entry> entry_or = ni.getEntry(&entry_offset);
205 if (entry_or->tag() != DW_TAG_variable)
223 // Check if this name index contains an entry for the given CU.
236 llvm::Expected<DebugNames::Entry> entry_or = ni.getEntry(&entry_offset);
238 if (entry_or->tag() != DW_TAG_variable)
240 if (entry_or->getCUOffset() != cu_offset)
250 // If no name index for that particular CU was found, fallback to
263 for (const DebugNames::Entry &entry :
264 m_debug_names_up->equal_range(class_name.GetStringRef())) {
265 if (entry.tag() != DW_TAG_structure_type &&
266 entry.tag() != DW_TAG_class_type)
269 DWARFDIE die = GetDIE(entry);
275 if (!cu->Supports_DW_AT_APPLE_objc_complete_type()) {
296 using Entry = llvm::DWARFDebugNames::Entry;
298 /// If `entry` and all of its parents have an `IDX_parent`, use that information
300 /// `entry` itself is not included in the list.
301 /// If any parent does not have an `IDX_parent`, or the Entry data is corrupted,
303 std::optional<llvm::SmallVector<Entry, 4>>
304 getParentChain(Entry entry, uint32_t max_parents) {
305 llvm::SmallVector<Entry, 4> parent_entries;
308 if (!entry.hasParentInformation())
311 llvm::Expected<std::optional<Entry>> parent = entry.getParentDIEEntry();
316 "Failed to extract parent entry from a non-empty IDX_parent");
321 if (!parent->has_value())
325 entry = **parent;
338 llvm::StringRef leaf_name = context[0].name;
341 parent_names.emplace_back(context[idx].name);
343 // For each entry, grab its parent chain and check if we have a match.
344 for (const DebugNames::Entry &entry :
345 m_debug_names_up->equal_range(leaf_name)) {
346 if (!isType(entry.tag()))
349 // If we get a NULL foreign_tu back, the entry doesn't match the type unit
352 std::optional<DWARFTypeUnit *> foreign_tu = GetForeignTypeUnit(entry);
358 std::optional<llvm::SmallVector<Entry, 4>> parent_chain =
359 getParentChain(entry, parent_names.size() + 1);
363 if (!ProcessEntry(entry, [&](DWARFDIE die) {
371 !ProcessEntry(entry, callback))
378 llvm::ArrayRef<DebugNames::Entry> parent_entries) const {
383 auto SameAsEntryATName = [this](llvm::StringRef name,
384 const DebugNames::Entry &entry) {
385 // Peek at the AT_name of `entry` and test equality to `name`.
386 auto maybe_dieoffset = entry.getDIEUnitOffset();
389 DWARFUnit *unit = GetNonSkeletonUnit(entry);
392 return name == unit->PeekDIEName(unit->GetOffset() + *maybe_dieoffset);
395 // If the AT_name of any parent fails to match the expected name, we don't
405 ConstString name, llvm::function_ref<bool(DWARFDIE die)> callback) {
406 for (const DebugNames::Entry &entry :
407 m_debug_names_up->equal_range(name.GetStringRef())) {
408 if (isType(entry.tag())) {
409 if (!ProcessEntry(entry, callback))
414 m_fallback.GetTypes(name, callback);
420 auto name = context[0].name;
421 for (const DebugNames::Entry &entry : m_debug_names_up->equal_range(name)) {
422 if (entry.tag() == context[0].tag) {
423 if (!ProcessEntry(entry, callback))
432 ConstString name, llvm::function_ref<bool(DWARFDIE die)> callback) {
433 for (const DebugNames::Entry &entry :
434 m_debug_names_up->equal_range(name.GetStringRef())) {
435 lldb_private::dwarf::Tag entry_tag = entry.tag();
438 if (!ProcessEntry(entry, callback))
443 m_fallback.GetNamespaces(name, callback);
450 ConstString name = lookup_info.GetLookupName();
452 for (const DebugNames::Entry &entry :
453 m_debug_names_up->equal_range(name.GetStringRef())) {
454 Tag tag = entry.tag();
458 if (DWARFDIE die = GetDIE(entry)) {
481 llvm::Expected<DebugNames::Entry> entry_or = ni.getEntry(&entry_offset);
483 Tag tag = entry_or->tag();
502 m_debug_names_up->dump(os);