LLDB mainline
DWARFUnit.cpp
Go to the documentation of this file.
1//===-- DWARFUnit.cpp -----------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "DWARFUnit.h"
10
11#include "lldb/Core/Module.h"
15#include "lldb/Utility/Timer.h"
16#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
17#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
18#include "llvm/Object/Error.h"
19
20#include "DWARFCompileUnit.h"
21#include "DWARFDebugAranges.h"
22#include "DWARFDebugInfo.h"
23#include "DWARFTypeUnit.h"
24#include "LogChannelDWARF.h"
25#include "SymbolFileDWARFDwo.h"
26#include <optional>
27
28using namespace lldb;
29using namespace lldb_private;
30using namespace lldb_private::dwarf;
31using namespace lldb_private::plugin::dwarf;
32
33extern int g_verbose;
34
36 const llvm::DWARFUnitHeader &header,
37 const llvm::DWARFAbbreviationDeclarationSet &abbrevs,
38 DIERef::Section section, bool is_dwo)
39 : UserID(uid), m_dwarf(dwarf), m_header(header), m_abbrevs(&abbrevs),
40 m_cancel_scopes(false), m_section(section), m_is_dwo(is_dwo),
41 m_has_parsed_non_skeleton_unit(false), m_dwo_id(header.getDWOId()) {}
42
43DWARFUnit::~DWARFUnit() = default;
44
45// Parses first DIE of a compile unit, excluding DWO.
47 {
48 llvm::sys::ScopedReader lock(m_first_die_mutex);
49 if (m_first_die)
50 return; // Already parsed
51 }
52 llvm::sys::ScopedWriter lock(m_first_die_mutex);
53 if (m_first_die)
54 return; // Already parsed
55
57
58 // Set the offset to that of the first DIE and calculate the start of the
59 // next compilation unit header.
61
62 // We are in our compile unit, parse starting at the offset we were told to
63 // parse
64 const DWARFDataExtractor &data = GetData();
65 if (offset < GetNextUnitOffset() &&
66 m_first_die.Extract(data, *this, &offset)) {
68 return;
69 }
70}
71
72// Parses first DIE of a compile unit including DWO.
75
77 return;
78
81
82 if (!m_dwo_id)
83 return; // No DWO file.
84
85 std::shared_ptr<SymbolFileDWARFDwo> dwo_symbol_file =
87 if (!dwo_symbol_file)
88 return;
89
90 DWARFUnit *dwo_cu = dwo_symbol_file->GetDWOCompileUnitForHash(*m_dwo_id);
91
92 if (!dwo_cu) {
94 "unable to load .dwo file from \"{0}\" due to ID ({1:x16}) mismatch "
95 "for skeleton DIE at {2:x8}",
96 dwo_symbol_file->GetObjectFile()->GetFileSpec().GetPath().c_str(),
98 return; // Can't fetch the compile unit from the dwo file.
99 }
100
101 // Link the DWO unit to this object, if it hasn't been linked already (this
102 // can happen when we have an index, and the DWO unit is parsed first).
103 if (!dwo_cu->LinkToSkeletonUnit(*this)) {
105 "multiple compile units with Dwo ID {0:x16}", *m_dwo_id));
106 return;
107 }
108
109 DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly();
110 if (!dwo_cu_die.IsValid()) {
111 // Can't fetch the compile unit DIE from the dwo file.
113 "unable to extract compile unit DIE from .dwo file for skeleton "
114 "DIE at {0:x16}",
116 return;
117 }
118
119 // Here for DWO CU we want to use the address base set in the skeleton unit
120 // (DW_AT_addr_base) if it is available and use the DW_AT_GNU_addr_base
121 // otherwise. We do that because pre-DWARF v5 could use the DW_AT_GNU_*
122 // attributes which were applicable to the DWO units. The corresponding
123 // DW_AT_* attributes standardized in DWARF v5 are also applicable to the
124 // main unit in contrast.
125 if (m_addr_base)
126 dwo_cu->SetAddrBase(*m_addr_base);
127 else if (m_gnu_addr_base)
129
130 if (GetVersion() <= 4 && m_gnu_ranges_base)
132 else if (dwo_symbol_file->GetDWARFContext()
133 .getOrLoadRngListsData()
134 .GetByteSize() > 0)
135 dwo_cu->SetRangesBase(llvm::DWARFListTableHeader::getHeaderSize(DWARF32));
136
137 if (GetVersion() >= 5 &&
138 dwo_symbol_file->GetDWARFContext().getOrLoadLocListsData().GetByteSize() >
139 0)
140 dwo_cu->SetLoclistsBase(llvm::DWARFListTableHeader::getHeaderSize(DWARF32));
141
143
144 m_dwo = std::shared_ptr<DWARFUnit>(std::move(dwo_symbol_file), dwo_cu);
145}
146
147// Parses a compile unit and indexes its DIEs if it hasn't already been done.
148// It will leave this compile unit extracted forever.
150 m_cancel_scopes = true;
151
152 {
153 llvm::sys::ScopedReader lock(m_die_array_mutex);
154 if (!m_die_array.empty())
155 return; // Already parsed
156 }
157 llvm::sys::ScopedWriter lock(m_die_array_mutex);
158 if (!m_die_array.empty())
159 return; // Already parsed
160
162}
163
164// Parses a compile unit and indexes its DIEs if it hasn't already been done.
165// It will clear this compile unit after returned instance gets out of scope,
166// no other ScopedExtractDIEs instance is running for this compile unit
167// and no ExtractDIEsIfNeeded() has been executed during this ScopedExtractDIEs
168// lifetime.
170 ScopedExtractDIEs scoped(*this);
171
172 {
173 llvm::sys::ScopedReader lock(m_die_array_mutex);
174 if (!m_die_array.empty())
175 return scoped; // Already parsed
176 }
177 llvm::sys::ScopedWriter lock(m_die_array_mutex);
178 if (!m_die_array.empty())
179 return scoped; // Already parsed
180
181 // Otherwise m_die_array would be already populated.
183
185 scoped.m_clear_dies = true;
186 return scoped;
187}
188
190 m_cu->m_die_array_scoped_mutex.lock_shared();
191}
192
194 if (!m_cu)
195 return;
196 m_cu->m_die_array_scoped_mutex.unlock_shared();
197 if (!m_clear_dies || m_cu->m_cancel_scopes)
198 return;
199 // Be sure no other ScopedExtractDIEs is running anymore.
200 llvm::sys::ScopedWriter lock_scoped(m_cu->m_die_array_scoped_mutex);
201 llvm::sys::ScopedWriter lock(m_cu->m_die_array_mutex);
202 if (m_cu->m_cancel_scopes)
203 return;
204 m_cu->ClearDIEsRWLocked();
205}
206
208 : m_cu(rhs.m_cu), m_clear_dies(rhs.m_clear_dies) {
209 rhs.m_cu = nullptr;
210}
211
214 m_cu = rhs.m_cu;
215 rhs.m_cu = nullptr;
216 m_clear_dies = rhs.m_clear_dies;
217 return *this;
218}
219
220// Parses a compile unit and indexes its DIEs, m_die_array_mutex must be
221// held R/W and m_die_array must be empty.
223 llvm::sys::ScopedWriter first_die_lock(m_first_die_mutex);
224
227 "%s",
228 llvm::formatv("{0:x16}: DWARFUnit::ExtractDIEsIfNeeded()", GetOffset())
229 .str()
230 .c_str());
231
232 // Set the offset to that of the first DIE and calculate the start of the
233 // next compilation unit header.
235 lldb::offset_t next_cu_offset = GetNextUnitOffset();
236
238
239 uint32_t depth = 0;
240 // We are in our compile unit, parse starting at the offset we were told to
241 // parse
242 const DWARFDataExtractor &data = GetData();
243 std::vector<uint32_t> die_index_stack;
244 die_index_stack.reserve(32);
245 die_index_stack.push_back(0);
246 bool prev_die_had_children = false;
247 while (offset < next_cu_offset && die.Extract(data, *this, &offset)) {
248 const bool null_die = die.IsNULL();
249 if (depth == 0) {
250 assert(m_die_array.empty() && "Compile unit DIE already added");
251
252 // The average bytes per DIE entry has been seen to be around 14-20 so
253 // lets pre-reserve half of that since we are now stripping the NULL
254 // tags.
255
256 // Only reserve the memory if we are adding children of the main
257 // compile unit DIE. The compile unit DIE is always the first entry, so
258 // if our size is 1, then we are adding the first compile unit child
259 // DIE and should reserve the memory.
260 m_die_array.reserve(GetDebugInfoSize() / 24);
261 m_die_array.push_back(die);
262
263 if (!m_first_die)
264 AddUnitDIE(m_die_array.front());
265
266 // With -fsplit-dwarf-inlining, clang will emit non-empty skeleton compile
267 // units. We are not able to access these DIE *and* the dwo file
268 // simultaneously. We also don't need to do that as the dwo file will
269 // contain a superset of information. So, we don't even attempt to parse
270 // any remaining DIEs.
271 if (m_dwo) {
272 m_die_array.front().SetHasChildren(false);
273 break;
274 }
275
276 } else {
277 if (null_die) {
278 if (prev_die_had_children) {
279 // This will only happen if a DIE says is has children but all it
280 // contains is a NULL tag. Since we are removing the NULL DIEs from
281 // the list (saves up to 25% in C++ code), we need a way to let the
282 // DIE know that it actually doesn't have children.
283 if (!m_die_array.empty())
284 m_die_array.back().SetHasChildren(false);
285 }
286 } else {
287 die.SetParentIndex(m_die_array.size() - die_index_stack[depth - 1]);
288
289 if (die_index_stack.back())
290 m_die_array[die_index_stack.back()].SetSiblingIndex(
291 m_die_array.size() - die_index_stack.back());
292
293 // Only push the DIE if it isn't a NULL DIE
294 m_die_array.push_back(die);
295 }
296 }
297
298 if (null_die) {
299 // NULL DIE.
300 if (!die_index_stack.empty())
301 die_index_stack.pop_back();
302
303 if (depth > 0)
304 --depth;
305 prev_die_had_children = false;
306 } else {
307 die_index_stack.back() = m_die_array.size() - 1;
308 // Normal DIE
309 const bool die_has_children = die.HasChildren();
310 if (die_has_children) {
311 die_index_stack.push_back(0);
312 ++depth;
313 }
314 prev_die_had_children = die_has_children;
315 }
316
317 if (depth == 0)
318 break; // We are done with this compile unit!
319 }
320
321 if (!m_die_array.empty()) {
322 // The last die cannot have children (if it did, it wouldn't be the last
323 // one). This only makes a difference for malformed dwarf that does not have
324 // a terminating null die.
325 m_die_array.back().SetHasChildren(false);
326
327 if (m_first_die) {
328 // Only needed for the assertion.
329 m_first_die.SetHasChildren(m_die_array.front().HasChildren());
331 }
332 m_first_die = m_die_array.front();
333 }
334
335 m_die_array.shrink_to_fit();
336
337 if (m_dwo)
338 m_dwo->ExtractDIEsIfNeeded();
339}
340
341// This is used when a split dwarf is enabled.
342// A skeleton compilation unit may contain the DW_AT_str_offsets_base attribute
343// that points to the first string offset of the CU contribution to the
344// .debug_str_offsets. At the same time, the corresponding split debug unit also
345// may use DW_FORM_strx* forms pointing to its own .debug_str_offsets.dwo and
346// for that case, we should find the offset (skip the section header).
348 lldb::offset_t baseOffset = 0;
349
350 if (const llvm::DWARFUnitIndex::Entry *entry = m_header.getIndexEntry()) {
351 if (const auto *contribution =
352 entry->getContribution(llvm::DW_SECT_STR_OFFSETS))
353 baseOffset = contribution->getOffset();
354 else
355 return;
356 }
357
358 if (GetVersion() >= 5) {
359 const DWARFDataExtractor &strOffsets =
361 uint64_t length = strOffsets.GetU32(&baseOffset);
362 if (length == 0xffffffff)
363 length = strOffsets.GetU64(&baseOffset);
364
365 // Check version.
366 if (strOffsets.GetU16(&baseOffset) < 5)
367 return;
368
369 // Skip padding.
370 baseOffset += 2;
371 }
372
373 SetStrOffsetsBase(baseOffset);
374}
375
376std::optional<uint64_t> DWARFUnit::GetDWOId() {
378 return m_dwo_id;
379}
380
381// m_die_array_mutex must be already held as read/write.
383 DWARFAttributes attributes = cu_die.GetAttributes(this);
384
385 // Extract DW_AT_addr_base first, as other attributes may need it.
386 for (size_t i = 0; i < attributes.Size(); ++i) {
387 if (attributes.AttributeAtIndex(i) != DW_AT_addr_base)
388 continue;
389 DWARFFormValue form_value;
390 if (attributes.ExtractFormValueAtIndex(i, form_value)) {
391 SetAddrBase(form_value.Unsigned());
392 break;
393 }
394 }
395
396 for (size_t i = 0; i < attributes.Size(); ++i) {
397 dw_attr_t attr = attributes.AttributeAtIndex(i);
398 DWARFFormValue form_value;
399 if (!attributes.ExtractFormValueAtIndex(i, form_value))
400 continue;
401 switch (attr) {
402 default:
403 break;
404 case DW_AT_loclists_base:
405 SetLoclistsBase(form_value.Unsigned());
406 break;
407 case DW_AT_rnglists_base:
408 SetRangesBase(form_value.Unsigned());
409 break;
410 case DW_AT_str_offsets_base:
411 SetStrOffsetsBase(form_value.Unsigned());
412 break;
413 case DW_AT_low_pc:
414 SetBaseAddress(form_value.Address());
415 break;
416 case DW_AT_entry_pc:
417 // If the value was already set by DW_AT_low_pc, don't update it.
419 SetBaseAddress(form_value.Address());
420 break;
421 case DW_AT_stmt_list:
422 m_line_table_offset = form_value.Unsigned();
423 break;
424 case DW_AT_GNU_addr_base:
425 m_gnu_addr_base = form_value.Unsigned();
426 break;
427 case DW_AT_GNU_ranges_base:
428 m_gnu_ranges_base = form_value.Unsigned();
429 break;
430 case DW_AT_GNU_dwo_id:
431 m_dwo_id = form_value.Unsigned();
432 break;
433 }
434 }
435
436 if (m_is_dwo) {
439 return;
440 }
441}
442
445}
446
447const llvm::DWARFAbbreviationDeclarationSet *
449 return m_abbrevs;
450}
451
453 return m_abbrevs ? m_abbrevs->getOffset() : DW_INVALID_OFFSET;
454}
455
458 return m_line_table_offset;
459}
460
461void DWARFUnit::SetAddrBase(dw_addr_t addr_base) { m_addr_base = addr_base; }
462
463// Parse the rangelist table header, including the optional array of offsets
464// following it (DWARF v5 and later).
465template <typename ListTableType>
466static llvm::Expected<ListTableType>
467ParseListTableHeader(const llvm::DWARFDataExtractor &data, uint64_t offset,
468 DwarfFormat format) {
469 // We are expected to be called with Offset 0 or pointing just past the table
470 // header. Correct Offset in the latter case so that it points to the start
471 // of the header.
472 if (offset == 0) {
473 // This means DW_AT_rnglists_base is missing and therefore DW_FORM_rnglistx
474 // cannot be handled. Returning a default-constructed ListTableType allows
475 // DW_FORM_sec_offset to be supported.
476 return ListTableType();
477 }
478
479 uint64_t HeaderSize = llvm::DWARFListTableHeader::getHeaderSize(format);
480 if (offset < HeaderSize)
481 return llvm::createStringError(std::errc::invalid_argument,
482 "did not detect a valid"
483 " list table with base = 0x%" PRIx64 "\n",
484 offset);
485 offset -= HeaderSize;
486 ListTableType Table;
487 if (llvm::Error E = Table.extractHeaderAndOffsets(data, &offset))
488 return std::move(E);
489 return Table;
490}
491
493 uint64_t offset = 0;
494 if (const llvm::DWARFUnitIndex::Entry *entry = m_header.getIndexEntry()) {
495 const auto *contribution = entry->getContribution(llvm::DW_SECT_LOCLISTS);
496 if (!contribution) {
497 GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
498 "Failed to find location list contribution for CU with DWO Id "
499 "{0:x16}",
500 *GetDWOId());
501 return;
502 }
503 offset += contribution->getOffset();
504 }
505 m_loclists_base = loclists_base;
506
507 uint64_t header_size = llvm::DWARFListTableHeader::getHeaderSize(DWARF32);
508 if (loclists_base < header_size)
509 return;
510
511 m_loclist_table_header.emplace(".debug_loclists", "locations");
512 offset += loclists_base - header_size;
513 if (llvm::Error E = m_loclist_table_header->extract(
515 &offset)) {
516 GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
517 "Failed to extract location list table at offset {0:x16} (location "
518 "list base: {1:x16}): {2}",
519 offset, loclists_base, toString(std::move(E)).c_str());
520 }
521}
522
523std::unique_ptr<llvm::DWARFLocationTable>
525 llvm::DWARFDataExtractor llvm_data(
527 data.GetAddressByteSize());
528
529 if (m_is_dwo || GetVersion() >= 5)
530 return std::make_unique<llvm::DWARFDebugLoclists>(llvm_data, GetVersion());
531 return std::make_unique<llvm::DWARFDebugLoc>(llvm_data);
532}
533
536 const DWARFDataExtractor &data =
538 if (const llvm::DWARFUnitIndex::Entry *entry = m_header.getIndexEntry()) {
539 if (const auto *contribution = entry->getContribution(
540 GetVersion() >= 5 ? llvm::DW_SECT_LOCLISTS : llvm::DW_SECT_EXT_LOC))
541 return DWARFDataExtractor(data, contribution->getOffset(),
542 contribution->getLength32());
543 return DWARFDataExtractor();
544 }
545 return data;
546}
547
550 const DWARFDataExtractor &data = Ctx.getOrLoadRngListsData();
551 if (const llvm::DWARFUnitIndex::Entry *entry = m_header.getIndexEntry()) {
552 if (const auto *contribution =
553 entry->getContribution(llvm::DW_SECT_RNGLISTS))
554 return DWARFDataExtractor(data, contribution->getOffset(),
555 contribution->getLength32());
556 GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
557 "Failed to find range list contribution for CU with signature {0:x16}",
558 entry->getSignature());
559
560 return DWARFDataExtractor();
561 }
562 return data;
563}
564
567
568 m_ranges_base = ranges_base;
569}
570
571const std::optional<llvm::DWARFDebugRnglistTable> &
573 if (GetVersion() >= 5 && !m_rnglist_table_done) {
575 if (auto table_or_error =
576 ParseListTableHeader<llvm::DWARFDebugRnglistTable>(
577 GetRnglistData().GetAsLLVMDWARF(), m_ranges_base, DWARF32))
578 m_rnglist_table = std::move(table_or_error.get());
579 else
580 GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
581 "Failed to extract range list table at offset {0:x16}: {1}",
582 m_ranges_base, toString(table_or_error.takeError()).c_str());
583 }
584 return m_rnglist_table;
585}
586
587// This function is called only for DW_FORM_rnglistx.
588llvm::Expected<uint64_t> DWARFUnit::GetRnglistOffset(uint32_t Index) {
589 if (!GetRnglistTable())
590 return llvm::createStringError(std::errc::invalid_argument,
591 "missing or invalid range list table");
592 if (!m_ranges_base)
593 return llvm::createStringError(
594 std::errc::invalid_argument,
595 llvm::formatv("DW_FORM_rnglistx cannot be used without "
596 "DW_AT_rnglists_base for CU at {0:x16}",
597 GetOffset())
598 .str()
599 .c_str());
600 if (std::optional<uint64_t> off = GetRnglistTable()->getOffsetEntry(
601 GetRnglistData().GetAsLLVM(), Index))
602 return *off + m_ranges_base;
603 return llvm::createStringError(
604 std::errc::invalid_argument,
605 "invalid range list table index %u; OffsetEntryCount is %u, "
606 "DW_AT_rnglists_base is %" PRIu64,
607 Index, GetRnglistTable()->getOffsetEntryCount(), m_ranges_base);
608}
609
611 m_str_offsets_base = str_offsets_base;
612}
613
615 uint32_t index_size = GetAddressByteSize();
616 dw_offset_t addr_base = GetAddrBase();
617 dw_addr_t offset = addr_base + static_cast<dw_addr_t>(index) * index_size;
618 const DWARFDataExtractor &data =
620 if (data.ValidOffsetForDataOfSize(offset, index_size))
621 return data.GetMaxU64_unchecked(&offset, index_size);
623}
624
625// It may be called only with m_die_array_mutex held R/W.
627 m_die_array.clear();
628 m_die_array.shrink_to_fit();
629
630 if (m_dwo && !m_dwo->m_cancel_scopes)
631 m_dwo->ClearDIEsRWLocked();
632}
633
636}
637
638void DWARFUnit::SetBaseAddress(dw_addr_t base_addr) { m_base_addr = base_addr; }
639
640// Compare function DWARFDebugAranges::Range structures
642 const dw_offset_t die_offset) {
643 return die.GetOffset() < die_offset;
644}
645
646// GetDIE()
647//
648// Get the DIE (Debug Information Entry) with the specified offset by first
649// checking if the DIE is contained within this compile unit and grabbing the
650// DIE from this compile unit. Otherwise we grab the DIE from the DWARF file.
653 if (die_offset == DW_INVALID_OFFSET)
654 return DWARFDIE(); // Not found
655
656 if (!ContainsDIEOffset(die_offset)) {
657 GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
658 "GetDIE for DIE {0:x16} is outside of its CU {0:x16}", die_offset,
659 GetOffset());
660 return DWARFDIE(); // Not found
661 }
662
666 lower_bound(m_die_array.cbegin(), end, die_offset, CompareDIEOffset);
667
668 if (pos != end && die_offset == (*pos).GetOffset())
669 return DWARFDIE(this, &(*pos));
670 return DWARFDIE(); // Not found
671}
672
673llvm::StringRef DWARFUnit::PeekDIEName(dw_offset_t die_offset) {
675 if (!die.Extract(GetData(), *this, &die_offset))
676 return llvm::StringRef();
677
678 // Does die contain a DW_AT_Name?
679 if (const char *name =
680 die.GetAttributeValueAsString(this, DW_AT_name, nullptr))
681 return name;
682
683 // Does its DW_AT_specification or DW_AT_abstract_origin contain an AT_Name?
684 for (auto attr : {DW_AT_specification, DW_AT_abstract_origin}) {
685 DWARFFormValue form_value;
686 if (!die.GetAttributeValue(this, attr, form_value))
687 continue;
688 auto [unit, offset] = form_value.ReferencedUnitAndOffset();
689 if (unit)
690 if (auto name = unit->PeekDIEName(offset); !name.empty())
691 return name;
692 }
693
694 return llvm::StringRef();
695}
696
699 if (m_dwo)
700 return *m_dwo;
701 return *this;
702}
703
705 if (cu)
706 return cu->GetAddressByteSize();
708}
709
710uint8_t DWARFUnit::GetDefaultAddressSize() { return 4; }
711
713 if (m_skeleton_unit.load() == nullptr && IsDWOUnit()) {
714 SymbolFileDWARFDwo *dwo =
715 llvm::dyn_cast_or_null<SymbolFileDWARFDwo>(&GetSymbolFileDWARF());
716 // Do a reverse lookup if the skeleton compile unit wasn't set.
717 DWARFUnit *candidate_skeleton_unit =
718 dwo ? dwo->GetBaseSymbolFile().GetSkeletonUnit(this) : nullptr;
719 if (candidate_skeleton_unit)
720 (void)LinkToSkeletonUnit(*candidate_skeleton_unit);
721 // Linking may fail due to a race, so be sure to return the actual value.
722 }
723 return llvm::dyn_cast_or_null<DWARFCompileUnit>(m_skeleton_unit.load());
724}
725
727 DWARFUnit *expected_unit = nullptr;
728 if (m_skeleton_unit.compare_exchange_strong(expected_unit, &skeleton_unit))
729 return true;
730 if (expected_unit == &skeleton_unit) {
731 // Exchange failed because it already contained the right value.
732 return true;
733 }
734 return false; // Already linked to a different unit.
735}
736
738 return GetProducer() != eProducerLLVMGCC;
739}
740
742 // llvm-gcc makes completely invalid decl file attributes and won't ever be
743 // fixed, so we need to know to ignore these.
744 return GetProducer() == eProducerLLVMGCC;
745}
746
749 return GetProducerVersion() >= llvm::VersionTuple(425, 0, 13);
750 // Assume all other compilers didn't have incorrect ObjC bitfield info.
751 return true;
752}
753
757 if (!die)
758 return;
759
760 llvm::StringRef producer(
761 die->GetAttributeValueAsString(this, DW_AT_producer, nullptr));
762 if (producer.empty())
763 return;
764
765 static const RegularExpression g_swiftlang_version_regex(
766 llvm::StringRef(R"(swiftlang-([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?))"));
767 static const RegularExpression g_clang_version_regex(
768 llvm::StringRef(R"(clang-([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?))"));
769 static const RegularExpression g_llvm_gcc_regex(
770 llvm::StringRef(R"(4\.[012]\.[01] )"
771 R"(\‍(Based on Apple Inc\. build [0-9]+\) )"
772 R"(\‍(LLVM build [\.0-9]+\)$)"));
773
774 llvm::SmallVector<llvm::StringRef, 3> matches;
775 if (g_swiftlang_version_regex.Execute(producer, &matches)) {
776 m_producer_version.tryParse(matches[1]);
778 } else if (producer.contains("clang")) {
779 if (g_clang_version_regex.Execute(producer, &matches))
780 m_producer_version.tryParse(matches[1]);
782 } else if (producer.contains("GNU")) {
784 } else if (g_llvm_gcc_regex.Execute(producer)) {
786 }
787}
788
792 return m_producer;
793}
794
795llvm::VersionTuple DWARFUnit::GetProducerVersion() {
796 if (m_producer_version.empty())
798 return m_producer_version;
799}
800
802 if (m_language_type)
803 return *m_language_type;
804
806 if (!die)
807 m_language_type = 0;
808 else
809 m_language_type = die->GetAttributeValueAsUnsigned(this, DW_AT_language, 0);
810 return *m_language_type;
811}
812
816 if (die) {
818 if (die->GetAttributeValueAsUnsigned(this, DW_AT_APPLE_optimized, 0) ==
819 1) {
821 }
822 }
823 }
825}
826
828 if (!m_comp_dir)
830 return m_comp_dir->GetPathStyle();
831}
832
834 if (!m_comp_dir)
836 return *m_comp_dir;
837}
838
840 if (!m_file_spec)
842 return *m_file_spec;
843}
844
845FileSpec DWARFUnit::GetFile(size_t file_idx) {
846 return m_dwarf.GetFile(*this, file_idx);
847}
848
849// DWARF2/3 suggests the form hostname:pathname for compilation directory.
850// Remove the host part if present.
851static llvm::StringRef
852removeHostnameFromPathname(llvm::StringRef path_from_dwarf) {
853 if (!path_from_dwarf.contains(':'))
854 return path_from_dwarf;
855 llvm::StringRef host, path;
856 std::tie(host, path) = path_from_dwarf.split(':');
857
858 if (host.contains('/'))
859 return path_from_dwarf;
860
861 // check whether we have a windows path, and so the first character is a
862 // drive-letter not a hostname.
863 if (host.size() == 1 && llvm::isAlpha(host[0]) &&
864 (path.starts_with("\\") || path.starts_with("/")))
865 return path_from_dwarf;
866
867 return path;
868}
869
873 if (!die)
874 return;
875
876 llvm::StringRef comp_dir = removeHostnameFromPathname(
877 die->GetAttributeValueAsString(this, DW_AT_comp_dir, nullptr));
878 if (!comp_dir.empty()) {
879 FileSpec::Style comp_dir_style =
880 FileSpec::GuessPathStyle(comp_dir).value_or(FileSpec::Style::native);
881 m_comp_dir = FileSpec(comp_dir, comp_dir_style);
882 } else {
883 // Try to detect the style based on the DW_AT_name attribute, but just store
884 // the detected style in the m_comp_dir field.
885 const char *name =
886 die->GetAttributeValueAsString(this, DW_AT_name, nullptr);
888 "", FileSpec::GuessPathStyle(name).value_or(FileSpec::Style::native));
889 }
890}
891
895 if (!die)
896 return;
897
899 FileSpec(die->GetAttributeValueAsString(this, DW_AT_name, nullptr),
900 GetPathStyle());
901
902 if (m_file_spec->IsRelative())
903 m_file_spec->MakeAbsolute(GetCompilationDirectory());
904}
905
907 if (load_all_debug_info)
909 if (m_dwo)
910 return &llvm::cast<SymbolFileDWARFDwo>(m_dwo->GetSymbolFileDWARF());
911 return nullptr;
912}
913
915 if (m_func_aranges_up == nullptr) {
916 m_func_aranges_up = std::make_unique<DWARFDebugAranges>();
917 const DWARFDebugInfoEntry *die = DIEPtr();
918 if (die)
920
921 if (m_dwo) {
922 const DWARFDebugInfoEntry *dwo_die = m_dwo->DIEPtr();
923 if (dwo_die)
925 m_func_aranges_up.get());
926 }
927
928 const bool minimize = false;
929 m_func_aranges_up->Sort(minimize);
930 }
931 return *m_func_aranges_up;
932}
933
934llvm::Expected<DWARFUnitSP>
936 const DWARFDataExtractor &debug_info,
937 DIERef::Section section, lldb::offset_t *offset_ptr) {
938 assert(debug_info.ValidOffset(*offset_ptr));
939
940 DWARFContext &context = dwarf.GetDWARFContext();
941
942 // FIXME: Either properly map between DIERef::Section and
943 // llvm::DWARFSectionKind or switch to llvm's definition entirely.
944 llvm::DWARFSectionKind section_kind_llvm =
946 ? llvm::DWARFSectionKind::DW_SECT_INFO
947 : llvm::DWARFSectionKind::DW_SECT_EXT_TYPES;
948
949 llvm::DWARFDataExtractor debug_info_llvm = debug_info.GetAsLLVMDWARF();
950 llvm::DWARFUnitHeader header;
951 if (llvm::Error extract_err = header.extract(
952 context.GetAsLLVM(), debug_info_llvm, offset_ptr, section_kind_llvm))
953 return std::move(extract_err);
954
955 if (context.isDwo()) {
956 const llvm::DWARFUnitIndex::Entry *entry = nullptr;
957 const llvm::DWARFUnitIndex &index = header.isTypeUnit()
958 ? context.GetAsLLVM().getTUIndex()
959 : context.GetAsLLVM().getCUIndex();
960 if (index) {
961 if (header.isTypeUnit())
962 entry = index.getFromHash(header.getTypeHash());
963 else if (auto dwo_id = header.getDWOId())
964 entry = index.getFromHash(*dwo_id);
965 }
966 if (!entry)
967 entry = index.getFromOffset(header.getOffset());
968 if (entry)
969 if (llvm::Error err = header.applyIndexEntry(entry))
970 return std::move(err);
971 }
972
973 const llvm::DWARFDebugAbbrev *abbr = dwarf.DebugAbbrev();
974 if (!abbr)
975 return llvm::make_error<llvm::object::GenericBinaryError>(
976 "No debug_abbrev data");
977
978 bool abbr_offset_OK =
979 dwarf.GetDWARFContext().getOrLoadAbbrevData().ValidOffset(
980 header.getAbbrOffset());
981 if (!abbr_offset_OK)
982 return llvm::make_error<llvm::object::GenericBinaryError>(
983 "Abbreviation offset for unit is not valid");
984
985 llvm::Expected<const llvm::DWARFAbbreviationDeclarationSet *> abbrevs_or_err =
986 abbr->getAbbreviationDeclarationSet(header.getAbbrOffset());
987 if (!abbrevs_or_err)
988 return abbrevs_or_err.takeError();
989
990 const llvm::DWARFAbbreviationDeclarationSet *abbrevs = *abbrevs_or_err;
991 if (!abbrevs)
992 return llvm::make_error<llvm::object::GenericBinaryError>(
993 "No abbrev exists at the specified offset.");
994
995 bool is_dwo = dwarf.GetDWARFContext().isDwo();
996 if (header.isTypeUnit())
997 return DWARFUnitSP(
998 new DWARFTypeUnit(dwarf, uid, header, *abbrevs, section, is_dwo));
999 return DWARFUnitSP(
1000 new DWARFCompileUnit(dwarf, uid, header, *abbrevs, section, is_dwo));
1001}
1002
1007}
1008
1010 switch (m_header.getUnitType()) {
1011 case llvm::dwarf::DW_UT_compile:
1012 case llvm::dwarf::DW_UT_partial:
1013 return GetVersion() < 5 ? 11 : 12;
1014 case llvm::dwarf::DW_UT_skeleton:
1015 case llvm::dwarf::DW_UT_split_compile:
1016 return 20;
1017 case llvm::dwarf::DW_UT_type:
1018 case llvm::dwarf::DW_UT_split_type:
1019 return GetVersion() < 5 ? 23 : 24;
1020 }
1021 llvm_unreachable("invalid UnitType.");
1022}
1023
1024std::optional<uint64_t>
1026 offset_t offset = GetStrOffsetsBase() + index * 4;
1028}
1029
1030llvm::Expected<DWARFRangeList>
1032 if (GetVersion() <= 4) {
1033 const DWARFDebugRanges *debug_ranges = m_dwarf.GetDebugRanges();
1034 if (!debug_ranges)
1035 return llvm::make_error<llvm::object::GenericBinaryError>(
1036 "No debug_ranges section");
1037 return debug_ranges->FindRanges(this, offset);
1038 }
1039
1040 if (!GetRnglistTable())
1041 return llvm::createStringError(std::errc::invalid_argument,
1042 "missing or invalid range list table");
1043
1044 llvm::DWARFDataExtractor data = GetRnglistData().GetAsLLVMDWARF();
1045
1046 // As DW_AT_rnglists_base may be missing we need to call setAddressSize.
1047 data.setAddressSize(m_header.getAddressByteSize());
1048 auto range_list_or_error = GetRnglistTable()->findList(data, offset);
1049 if (!range_list_or_error)
1050 return range_list_or_error.takeError();
1051
1052 llvm::Expected<llvm::DWARFAddressRangesVector> llvm_ranges =
1053 range_list_or_error->getAbsoluteRanges(
1054 llvm::object::SectionedAddress{GetBaseAddress()},
1055 GetAddressByteSize(), [&](uint32_t index) {
1056 uint32_t index_size = GetAddressByteSize();
1057 dw_offset_t addr_base = GetAddrBase();
1058 lldb::offset_t offset =
1059 addr_base + static_cast<lldb::offset_t>(index) * index_size;
1060 return llvm::object::SectionedAddress{
1062 &offset, index_size)};
1063 });
1064 if (!llvm_ranges)
1065 return llvm_ranges.takeError();
1066
1067 DWARFRangeList ranges;
1068 for (const llvm::DWARFAddressRange &llvm_range : *llvm_ranges) {
1069 ranges.Append(DWARFRangeList::Entry(llvm_range.LowPC,
1070 llvm_range.HighPC - llvm_range.LowPC));
1071 }
1072 ranges.Sort();
1073 return ranges;
1074}
1075
1076llvm::Expected<DWARFRangeList> DWARFUnit::FindRnglistFromIndex(uint32_t index) {
1077 llvm::Expected<uint64_t> maybe_offset = GetRnglistOffset(index);
1078 if (!maybe_offset)
1079 return maybe_offset.takeError();
1080 return FindRnglistFromOffset(*maybe_offset);
1081}
1082
1083bool DWARFUnit::HasAny(llvm::ArrayRef<dw_tag_t> tags) {
1085 if (m_dwo)
1086 return m_dwo->HasAny(tags);
1087
1088 for (const auto &die : m_die_array) {
1089 for (const auto tag : tags) {
1090 if (tag == die.Tag())
1091 return true;
1092 }
1093 }
1094 return false;
1095}
static bool CompareDIEOffset(const DWARFDebugInfoEntry &die, const dw_offset_t die_offset)
Definition: DWARFUnit.cpp:641
static llvm::Expected< ListTableType > ParseListTableHeader(const llvm::DWARFDataExtractor &data, uint64_t offset, DwarfFormat format)
Definition: DWARFUnit.cpp:467
static llvm::StringRef removeHostnameFromPathname(llvm::StringRef path_from_dwarf)
Definition: DWARFUnit.cpp:852
int g_verbose
#define lldbassert(x)
Definition: LLDBAssert.h:15
static double elapsed(const StatsTimepoint &start, const StatsTimepoint &end)
Definition: Statistics.cpp:39
#define LLDB_SCOPED_TIMERF(...)
Definition: Timer.h:86
llvm::DWARFDataExtractor GetAsLLVMDWARF() const
An data extractor class.
Definition: DataExtractor.h:48
uint64_t GetU64(lldb::offset_t *offset_ptr) const
Extract a uint64_t value from *offset_ptr.
const void * GetData(lldb::offset_t *offset_ptr, lldb::offset_t length) const
Extract length bytes from *offset_ptr.
uint64_t GetMaxU64_unchecked(lldb::offset_t *offset_ptr, size_t byte_size) const
uint32_t GetU32(lldb::offset_t *offset_ptr) const
Extract a uint32_t value from *offset_ptr.
uint16_t GetU16(lldb::offset_t *offset_ptr) const
Extract a uint16_t value from *offset_ptr.
bool ValidOffset(lldb::offset_t offset) const
Test the validity of offset.
uint32_t GetAddressByteSize() const
Get the current address size.
uint64_t GetMaxU64(lldb::offset_t *offset_ptr, size_t byte_size) const
Extract an unsigned integer of size byte_size from *offset_ptr.
lldb::ByteOrder GetByteOrder() const
Get the current byte order value.
A class that measures elapsed time in an exception safe way.
Definition: Statistics.h:69
A file utility class.
Definition: FileSpec.h:56
static std::optional< Style > GuessPathStyle(llvm::StringRef absolute_path)
Attempt to guess path style for a given path string.
Definition: FileSpec.cpp:310
llvm::sys::path::Style Style
Definition: FileSpec.h:58
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
Definition: ModuleChild.cpp:24
virtual lldb::ByteOrder GetByteOrder() const =0
Gets whether endian swapping should occur when extracting data from this object file.
void Append(const Entry &entry)
Definition: RangeMap.h:179
bool Execute(llvm::StringRef string, llvm::SmallVectorImpl< llvm::StringRef > *matches=nullptr) const
Execute a regular expression match using the compiled regular expression that is already in this obje...
void Clear()
Clear the object state.
Definition: Status.cpp:166
static Status createWithFormat(const char *format, Args &&...args)
Definition: Status.h:68
ObjectFile * GetObjectFile() override
Definition: SymbolFile.h:533
dw_attr_t AttributeAtIndex(uint32_t i) const
bool ExtractFormValueAtIndex(uint32_t i, DWARFFormValue &form_value) const
const DWARFDataExtractor & getOrLoadLocListsData()
const DWARFDataExtractor & getOrLoadStrOffsetsData()
const DWARFDataExtractor & getOrLoadDebugTypesData()
const DWARFDataExtractor & getOrLoadDebugInfoData()
const DWARFDataExtractor & getOrLoadRngListsData()
const DWARFDataExtractor & getOrLoadLocData()
const DWARFDataExtractor & getOrLoadAddrData()
DWARFDebugInfoEntry objects assume that they are living in one big vector and do pointer arithmetic o...
const char * GetAttributeValueAsString(const DWARFUnit *cu, const dw_attr_t attr, const char *fail_value, bool check_specification_or_abstract_origin=false) const
dw_offset_t GetAttributeValue(const DWARFUnit *cu, const dw_attr_t attr, DWARFFormValue &formValue, dw_offset_t *end_attr_offset_ptr=nullptr, bool check_specification_or_abstract_origin=false) const
DWARFAttributes GetAttributes(DWARFUnit *cu, Recurse recurse=Recurse::yes) const
void BuildFunctionAddressRangeTable(DWARFUnit *cu, DWARFDebugAranges *debug_aranges) const
This function is builds a table very similar to the standard .debug_aranges table,...
uint64_t GetAttributeValueAsUnsigned(const DWARFUnit *cu, const dw_attr_t attr, uint64_t fail_value, bool check_specification_or_abstract_origin=false) const
bool Extract(const DWARFDataExtractor &data, const DWARFUnit &cu, lldb::offset_t *offset_ptr)
DWARFRangeList FindRanges(const DWARFUnit *cu, dw_offset_t debug_ranges_offset) const
std::pair< DWARFUnit *, uint64_t > ReferencedUnitAndOffset() const
If this is a reference to another DIE, return the corresponding DWARFUnit and DIE offset such that Un...
const ScopedExtractDIEs & operator=(const ScopedExtractDIEs &)=delete
std::optional< dw_addr_t > m_addr_base
Value of DW_AT_addr_base.
Definition: DWARFUnit.h:335
std::unique_ptr< llvm::DWARFLocationTable > GetLocationTable(const DataExtractor &data) const
Return the location table for parsing the given location list data.
Definition: DWARFUnit.cpp:524
std::optional< FileSpec > m_file_spec
Definition: DWARFUnit.h:334
size_t GetLengthByteSize() const
Get the size in bytes of the length field in the header.
Definition: DWARFUnit.h:105
std::optional< llvm::DWARFDebugRnglistTable > m_rnglist_table
Definition: DWARFUnit.h:346
const DWARFDebugInfoEntry * GetUnitDIEPtrOnly()
Definition: DWARFUnit.h:285
llvm::sys::RWMutex m_die_array_mutex
Definition: DWARFUnit.h:314
bool LinkToSkeletonUnit(DWARFUnit &skeleton_unit)
Definition: DWARFUnit.cpp:726
dw_offset_t m_line_table_offset
Value of DW_AT_stmt_list.
Definition: DWARFUnit.h:342
llvm::sys::RWMutex m_die_array_scoped_mutex
Definition: DWARFUnit.h:316
void SetStrOffsetsBase(dw_offset_t str_offsets_base)
Definition: DWARFUnit.cpp:610
std::atomic< bool > m_cancel_scopes
Definition: DWARFUnit.h:319
Status m_dwo_error
If we get an error when trying to load a .dwo file, save that error here.
Definition: DWARFUnit.h:358
void SetLoclistsBase(dw_addr_t loclists_base)
Definition: DWARFUnit.cpp:492
SymbolFileDWARF & GetSymbolFileDWARF() const
Definition: DWARFUnit.h:181
const DWARFDebugAranges & GetFunctionAranges()
Definition: DWARFUnit.cpp:914
const DWARFDataExtractor & GetData() const
Get the data that contains the DIE information for this unit.
Definition: DWARFUnit.cpp:1003
static llvm::Expected< DWARFUnitSP > extract(SymbolFileDWARF &dwarf2Data, lldb::user_id_t uid, const DWARFDataExtractor &debug_info, DIERef::Section section, lldb::offset_t *offset_ptr)
Definition: DWARFUnit.cpp:935
DWARFCompileUnit * GetSkeletonUnit()
Get the skeleton compile unit for a DWO file.
Definition: DWARFUnit.cpp:712
dw_addr_t ReadAddressFromDebugAddrSection(uint32_t index) const
Definition: DWARFUnit.cpp:614
const DWARFDebugInfoEntry * DIEPtr()
Definition: DWARFUnit.h:294
bool ContainsDIEOffset(dw_offset_t die_offset) const
Definition: DWARFUnit.h:107
std::optional< FileSpec > m_comp_dir
Definition: DWARFUnit.h:333
dw_offset_t GetFirstDIEOffset() const
Definition: DWARFUnit.h:111
std::optional< uint64_t > m_language_type
Definition: DWARFUnit.h:331
llvm::StringRef PeekDIEName(dw_offset_t die_offset)
Returns the AT_Name of the DIE at die_offset, if it exists, without parsing the entire compile unit.
Definition: DWARFUnit.cpp:673
DWARFDebugInfoEntry::collection m_die_array
Definition: DWARFUnit.h:313
void SetBaseAddress(dw_addr_t base_addr)
Definition: DWARFUnit.cpp:638
std::optional< uint64_t > m_gnu_ranges_base
Definition: DWARFUnit.h:339
const llvm::DWARFAbbreviationDeclarationSet * m_abbrevs
Definition: DWARFUnit.h:308
const DIERef::Section m_section
Definition: DWARFUnit.h:350
dw_offset_t GetNextUnitOffset() const
Definition: DWARFUnit.h:114
DWARFDataExtractor GetLocationData() const
Definition: DWARFUnit.cpp:534
const std::optional< llvm::DWARFDebugRnglistTable > & GetRnglistTable()
Definition: DWARFUnit.cpp:572
llvm::Expected< uint64_t > GetRnglistOffset(uint32_t Index)
Return a rangelist's offset based on an index.
Definition: DWARFUnit.cpp:588
std::unique_ptr< DWARFDebugAranges > m_func_aranges_up
Definition: DWARFUnit.h:327
dw_addr_t m_ranges_base
Value of DW_AT_rnglists_base.
Definition: DWARFUnit.h:337
dw_addr_t m_loclists_base
Value of DW_AT_loclists_base.
Definition: DWARFUnit.h:336
void SetRangesBase(dw_addr_t ranges_base)
Definition: DWARFUnit.cpp:565
uint32_t GetHeaderByteSize() const
Get the size in bytes of the unit header.
Definition: DWARFUnit.cpp:1009
void SetAddrBase(dw_addr_t addr_base)
Definition: DWARFUnit.cpp:461
llvm::Expected< DWARFRangeList > FindRnglistFromIndex(uint32_t index)
Return a list of address ranges retrieved from an encoded range list whose offset is found via a tabl...
Definition: DWARFUnit.cpp:1076
std::optional< llvm::DWARFListTableHeader > m_loclist_table_header
Definition: DWARFUnit.h:348
llvm::VersionTuple GetProducerVersion()
Definition: DWARFUnit.cpp:795
std::optional< uint64_t > m_dwo_id
Value of DW_AT_GNU_dwo_id (v4) or dwo_id from CU header (v5).
Definition: DWARFUnit.h:354
std::shared_ptr< DWARFUnit > m_dwo
Definition: DWARFUnit.h:306
std::optional< uint64_t > m_gnu_addr_base
Definition: DWARFUnit.h:338
DWARFUnit(SymbolFileDWARF &dwarf, lldb::user_id_t uid, const llvm::DWARFUnitHeader &header, const llvm::DWARFAbbreviationDeclarationSet &abbrevs, DIERef::Section section, bool is_dwo)
Definition: DWARFUnit.cpp:35
llvm::VersionTuple m_producer_version
Definition: DWARFUnit.h:330
std::optional< uint64_t > GetStringOffsetSectionItem(uint32_t index) const
Definition: DWARFUnit.cpp:1025
DWARFDIE GetDIE(dw_offset_t die_offset)
Definition: DWARFUnit.cpp:652
lldb::ByteOrder GetByteOrder() const
Definition: DWARFUnit.cpp:634
void AddUnitDIE(const DWARFDebugInfoEntry &cu_die)
Definition: DWARFUnit.cpp:382
void SetDwoError(const Status &error)
Set the fission .dwo file specific error for this compile unit.
Definition: DWARFUnit.h:271
llvm::sys::RWMutex m_first_die_mutex
Definition: DWARFUnit.h:324
SymbolFileDWARFDwo * GetDwoSymbolFile(bool load_all_debug_info=true)
Definition: DWARFUnit.cpp:906
const FileSpec & GetCompilationDirectory()
Definition: DWARFUnit.cpp:833
std::optional< uint64_t > GetDWOId()
Get the DWO ID from the DWARFUnitHeader for DWARF5, or from the unit DIE's DW_AT_dwo_id or DW_AT_GNU_...
Definition: DWARFUnit.cpp:376
llvm::DWARFUnitHeader m_header
Definition: DWARFUnit.h:307
const llvm::DWARFAbbreviationDeclarationSet * GetAbbreviations() const
Definition: DWARFUnit.cpp:448
bool HasAny(llvm::ArrayRef< dw_tag_t > tags)
Returns true if any DIEs in the unit match any DW_TAG values in tags.
Definition: DWARFUnit.cpp:1083
llvm::Expected< DWARFRangeList > FindRnglistFromOffset(dw_offset_t offset)
Return a list of address ranges resulting from a (possibly encoded) range list starting at a given of...
Definition: DWARFUnit.cpp:1031
std::atomic< DWARFUnit * > m_skeleton_unit
Definition: DWARFUnit.h:311
DWARFDataExtractor GetRnglistData() const
Definition: DWARFUnit.cpp:548
FileSpec GetFile(size_t file_idx)
Definition: DWARFUnit.cpp:845
DWARFUnit * GetSkeletonUnit(DWARFUnit *dwo_unit)
Given a DWO DWARFUnit, find the corresponding skeleton DWARFUnit in the main symbol file.
FileSpec GetFile(DWARFUnit &unit, size_t file_idx)
std::shared_ptr< SymbolFileDWARFDwo > GetDwoSymbolFileForCompileUnit(DWARFUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die)
uint64_t dw_offset_t
Definition: dwarf.h:31
#define DW_INVALID_OFFSET
Definition: dwarf.h:36
llvm::dwarf::Attribute dw_attr_t
Definition: dwarf.h:24
uint64_t dw_addr_t
Definition: dwarf.h:27
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:82
std::shared_ptr< DWARFUnit > DWARFUnitSP
Definition: DWARFUnit.h:30
A class that represents a running process on the host machine.
const char * toString(AppleArm64ExceptionClass EC)
Definition: SBAddress.h:15
uint64_t offset_t
Definition: lldb-types.h:85
ByteOrder
Byte ordering definitions.
@ eByteOrderLittle
uint64_t user_id_t
Definition: lldb-types.h:82
A mix in class that contains a generic user ID.
Definition: UserID.h:31