LLDB mainline
DWARFDebugInfoEntry.cpp
Go to the documentation of this file.
1//===-- DWARFDebugInfoEntry.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
10
11#include <cassert>
12
13#include <algorithm>
14#include <limits>
15#include <optional>
16
17#include "LogChannelDWARF.h"
18#include "lldb/Core/Module.h"
21#include "llvm/ADT/STLExtras.h"
22#include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
23#include "llvm/Support/Error.h"
24#include "llvm/Support/FormatAdapters.h"
25#include "llvm/Support/LEB128.h"
26
27#include "DWARFCompileUnit.h"
28#include "DWARFDebugAranges.h"
29#include "DWARFDebugInfo.h"
30#include "DWARFDeclContext.h"
31#include "DWARFFormValue.h"
32#include "DWARFUnit.h"
33#include "SymbolFileDWARF.h"
34#include "SymbolFileDWARFDwo.h"
35
36using namespace lldb_private;
37using namespace lldb_private::dwarf;
38using namespace lldb_private::plugin::dwarf;
39extern int g_verbose;
40
41// Extract a debug info entry for a given DWARFUnit from the data
42// starting at the offset in offset_ptr
44 const DWARFUnit &unit,
45 lldb::offset_t *offset_ptr) {
46 m_offset = *offset_ptr;
47 auto report_error = [&](const char *fmt, const auto &...vals) {
48 unit.GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
49 "[{0:x16}]: {1}, please file a bug and "
50 "attach the file at the start of this error message",
51 static_cast<uint64_t>(m_offset), llvm::formatv(fmt, vals...));
52 *offset_ptr = std::numeric_limits<lldb::offset_t>::max();
53 return false;
54 };
55
56 m_parent_idx = 0;
57 m_sibling_idx = 0;
58 const uint64_t abbr_idx = data.GetULEB128(offset_ptr);
59 if (abbr_idx > std::numeric_limits<uint16_t>::max())
60 return report_error("abbreviation code {0} too big", abbr_idx);
61 m_abbr_idx = abbr_idx;
62
63 if (m_abbr_idx == 0) {
64 m_tag = llvm::dwarf::DW_TAG_null;
65 m_has_children = false;
66 return true; // NULL debug tag entry
67 }
68
69 const auto *abbrevDecl = GetAbbreviationDeclarationPtr(&unit);
70 if (abbrevDecl == nullptr)
71 return report_error("invalid abbreviation code {0}", abbr_idx);
72
73 m_tag = abbrevDecl->getTag();
74 m_has_children = abbrevDecl->hasChildren();
75 // Skip all data in the .debug_info or .debug_types for the attributes
76 for (const auto &attribute : abbrevDecl->attributes()) {
77 if (DWARFFormValue::SkipValue(attribute.Form, data, offset_ptr, &unit))
78 continue;
79
80 return report_error("Unsupported DW_FORM_{1:x}", attribute.Form);
81 }
82 return true;
83}
84
85static llvm::Expected<llvm::DWARFAddressRangesVector>
86GetRanges(DWARFUnit &unit, const DWARFFormValue &value) {
87 return (value.Form() == DW_FORM_rnglistx)
88 ? unit.FindRnglistFromIndex(value.Unsigned())
89 : unit.FindRnglistFromOffset(value.Unsigned());
90}
91
93 const llvm::DWARFAbbreviationDeclaration::AttributeSpec &attr_spec,
94 dw_attr_t &attr, DWARFFormValue &form_value) {
95 attr = attr_spec.Attr;
96 form_value.FormRef() = attr_spec.Form;
97 if (attr_spec.isImplicitConst())
98 form_value.SetSigned(attr_spec.getImplicitConstValue());
99}
100
101// GetDIENamesAndRanges
102//
103// Gets the valid address ranges for a given DIE by looking for a
104// DW_AT_low_pc/DW_AT_high_pc pair, DW_AT_entry_pc, or DW_AT_ranges attributes.
106 DWARFUnit *cu, const char *&name, const char *&mangled,
107 llvm::DWARFAddressRangesVector &ranges, std::optional<int> &decl_file,
108 std::optional<int> &decl_line, std::optional<int> &decl_column,
109 std::optional<int> &call_file, std::optional<int> &call_line,
110 std::optional<int> &call_column, DWARFExpressionList *frame_base) const {
113 std::vector<DWARFDIE> dies;
114 bool set_frame_base_loclist_addr = false;
115
117 lldb::ModuleSP module = dwarf.GetObjectFile()->GetModule();
118
119 if (const auto *abbrevDecl = GetAbbreviationDeclarationPtr(cu)) {
120 const DWARFDataExtractor &data = cu->GetData();
122
123 if (!data.ValidOffset(offset))
124 return false;
125
126 bool do_offset = false;
127
128 for (const auto &attribute : abbrevDecl->attributes()) {
129 DWARFFormValue form_value(cu);
130 dw_attr_t attr;
131 ExtractAttrAndFormValue(attribute, attr, form_value);
132
133 if (form_value.ExtractValue(data, &offset)) {
134 switch (attr) {
135 case DW_AT_low_pc:
136 lo_pc = form_value.Address();
137
138 if (do_offset)
139 hi_pc += lo_pc;
140 do_offset = false;
141 break;
142
143 case DW_AT_entry_pc:
144 lo_pc = form_value.Address();
145 break;
146
147 case DW_AT_high_pc:
148 if (form_value.Form() == DW_FORM_addr ||
149 form_value.Form() == DW_FORM_addrx ||
150 form_value.Form() == DW_FORM_GNU_addr_index) {
151 hi_pc = form_value.Address();
152 } else {
153 hi_pc = form_value.Unsigned();
154 if (lo_pc == LLDB_INVALID_ADDRESS)
155 do_offset = hi_pc != LLDB_INVALID_ADDRESS;
156 else
157 hi_pc += lo_pc; // DWARF 4 introduces <offset-from-lo-pc> to save
158 // on relocations
159 }
160 break;
161
162 case DW_AT_ranges:
163 if (llvm::Expected<llvm::DWARFAddressRangesVector> r =
164 GetRanges(*cu, form_value)) {
165 ranges = std::move(*r);
166 } else {
167 module->ReportError(
168 "[{0:x16}]: DIE has DW_AT_ranges({1} {2:x16}) attribute, but "
169 "range extraction failed ({3}), please file a bug "
170 "and attach the file at the start of this error message",
171 GetOffset(), llvm::dwarf::FormEncodingString(form_value.Form()),
172 form_value.Unsigned(), fmt_consume(r.takeError()));
173 }
174 break;
175
176 case DW_AT_name:
177 if (name == nullptr)
178 name = form_value.AsCString();
179 break;
180
181 case DW_AT_MIPS_linkage_name:
182 case DW_AT_linkage_name:
183 if (mangled == nullptr)
184 mangled = form_value.AsCString();
185 break;
186
187 case DW_AT_abstract_origin:
188 dies.push_back(form_value.Reference());
189 break;
190
191 case DW_AT_specification:
192 dies.push_back(form_value.Reference());
193 break;
194
195 case DW_AT_decl_file:
196 if (!decl_file)
197 decl_file = form_value.Unsigned();
198 break;
199
200 case DW_AT_decl_line:
201 if (!decl_line)
202 decl_line = form_value.Unsigned();
203 break;
204
205 case DW_AT_decl_column:
206 if (!decl_column)
207 decl_column = form_value.Unsigned();
208 break;
209
210 case DW_AT_call_file:
211 if (!call_file)
212 call_file = form_value.Unsigned();
213 break;
214
215 case DW_AT_call_line:
216 if (!call_line)
217 call_line = form_value.Unsigned();
218 break;
219
220 case DW_AT_call_column:
221 if (!call_column)
222 call_column = form_value.Unsigned();
223 break;
224
225 case DW_AT_frame_base:
226 if (frame_base) {
227 if (form_value.BlockData()) {
228 uint64_t block_offset =
229 form_value.BlockData() - data.GetDataStart();
230 uint64_t block_length = form_value.Unsigned();
231 *frame_base =
232 DWARFExpressionList(module,
234 data, block_offset, block_length)),
235 cu);
236 } else {
237 DataExtractor data = cu->GetLocationData();
238 const dw_offset_t offset = form_value.Unsigned();
239 if (data.ValidOffset(offset)) {
240 data = DataExtractor(data, offset, data.GetByteSize() - offset);
241 if (lo_pc != LLDB_INVALID_ADDRESS) {
242 assert(lo_pc >= cu->GetBaseAddress());
243 DWARFExpression::ParseDWARFLocationList(cu, data, frame_base);
244 frame_base->SetFuncFileAddress(lo_pc);
245 } else
246 set_frame_base_loclist_addr = true;
247 }
248 }
249 }
250 break;
251
252 default:
253 break;
254 }
255 }
256 }
257 }
258
259 if (ranges.empty() && lo_pc != LLDB_INVALID_ADDRESS) {
260 lldb::addr_t range_hi_pc =
261 (hi_pc != LLDB_INVALID_ADDRESS && hi_pc > lo_pc) ? hi_pc : lo_pc;
262 ranges.emplace_back(lo_pc, range_hi_pc);
263 }
264
265 if (set_frame_base_loclist_addr && !ranges.empty()) {
266 // TODO: Use the first range instead.
267 dw_addr_t lowest_range_pc = llvm::min_element(ranges)->LowPC;
268 assert(lowest_range_pc >= cu->GetBaseAddress());
269 frame_base->SetFuncFileAddress(lowest_range_pc);
270 }
271
272 if (ranges.empty() || name == nullptr || mangled == nullptr) {
273 for (const DWARFDIE &die : dies) {
274 if (die) {
275 die.GetDIE()->GetDIENamesAndRanges(die.GetCU(), name, mangled, ranges,
276 decl_file, decl_line, decl_column,
277 call_file, call_line, call_column);
278 }
279 }
280 }
281 return !ranges.empty();
282}
283
284// Get all attribute values for a given DIE, including following any
285// specification or abstract origin attributes and including those in the
286// results. Any duplicate attributes will have the first instance take
287// precedence (this can happen for declaration attributes).
289 DWARFAttributes &attributes,
290 Recurse recurse,
291 uint32_t curr_depth) const {
292 const auto *abbrevDecl = GetAbbreviationDeclarationPtr(cu);
293 if (!abbrevDecl) {
294 attributes.Clear();
295 return;
296 }
297
298 const DWARFDataExtractor &data = cu->GetData();
300
301 for (const auto &attribute : abbrevDecl->attributes()) {
302 DWARFFormValue form_value(cu);
303 dw_attr_t attr;
304 ExtractAttrAndFormValue(attribute, attr, form_value);
305
306 // If we are tracking down DW_AT_specification or DW_AT_abstract_origin
307 // attributes, the depth will be non-zero. We need to omit certain
308 // attributes that don't make sense.
309 switch (attr) {
310 case DW_AT_sibling:
311 case DW_AT_declaration:
312 if (curr_depth > 0) {
313 // This attribute doesn't make sense when combined with the DIE that
314 // references this DIE. We know a DIE is referencing this DIE because
315 // curr_depth is not zero
316 break;
317 }
318 [[fallthrough]];
319 default:
320 attributes.Append(form_value, offset, attr);
321 break;
322 }
323
324 if (recurse == Recurse::yes &&
325 ((attr == DW_AT_specification) || (attr == DW_AT_abstract_origin))) {
326 if (form_value.ExtractValue(data, &offset)) {
327 DWARFDIE spec_die = form_value.Reference();
328 if (spec_die)
329 spec_die.GetDIE()->GetAttributes(spec_die.GetCU(), attributes,
330 recurse, curr_depth + 1);
331 }
332 } else {
333 const dw_form_t form = form_value.Form();
334 std::optional<uint8_t> fixed_skip_size =
336 if (fixed_skip_size)
337 offset += *fixed_skip_size;
338 else
339 DWARFFormValue::SkipValue(form, data, &offset, cu);
340 }
341 }
342}
343
344// GetAttributeValue
345//
346// Get the value of an attribute and return the .debug_info or .debug_types
347// offset of the attribute if it was properly extracted into form_value,
348// or zero if we fail since an offset of zero is invalid for an attribute (it
349// would be a compile unit header).
351 const DWARFUnit *cu, const dw_attr_t attr, DWARFFormValue &form_value,
352 dw_offset_t *end_attr_offset_ptr, bool check_elaborating_dies) const {
353 if (const auto *abbrevDecl = GetAbbreviationDeclarationPtr(cu)) {
354 std::optional<uint32_t> attr_idx = abbrevDecl->findAttributeIndex(attr);
355
356 if (attr_idx) {
357 const DWARFDataExtractor &data = cu->GetData();
359
360 uint32_t idx = 0;
361 while (idx < *attr_idx)
362 DWARFFormValue::SkipValue(abbrevDecl->getFormByIndex(idx++), data,
363 &offset, cu);
364
365 const dw_offset_t attr_offset = offset;
366 form_value.SetUnit(cu);
367 form_value.SetForm(abbrevDecl->getFormByIndex(idx));
368 if (form_value.ExtractValue(data, &offset)) {
369 if (end_attr_offset_ptr)
370 *end_attr_offset_ptr = offset;
371 return attr_offset;
372 }
373 }
374 }
375
376 if (check_elaborating_dies) {
377 for (dw_attr_t elaborating_attr :
378 {DW_AT_specification, DW_AT_abstract_origin, DW_AT_signature}) {
379 if (!GetAttributeValue(cu, elaborating_attr, form_value))
380 continue;
381 DWARFDIE die = form_value.Reference();
382 if (!die)
383 continue;
384 dw_offset_t die_offset = die.GetDIE()->GetAttributeValue(
385 die.GetCU(), attr, form_value, end_attr_offset_ptr, false);
386 if (die_offset)
387 return die_offset;
388 }
389 }
390 return 0;
391}
392
393// GetAttributeValueAsString
394//
395// Get the value of an attribute as a string return it. The resulting pointer
396// to the string data exists within the supplied SymbolFileDWARF and will only
397// be available as long as the SymbolFileDWARF is still around and it's content
398// doesn't change.
400 const DWARFUnit *cu, const dw_attr_t attr, const char *fail_value,
401 bool check_elaborating_dies) const {
402 DWARFFormValue form_value;
403 if (GetAttributeValue(cu, attr, form_value, nullptr, check_elaborating_dies))
404 return form_value.AsCString();
405 return fail_value;
406}
407
408// GetAttributeValueAsUnsigned
409//
410// Get the value of an attribute as unsigned and return it.
412 const DWARFUnit *cu, const dw_attr_t attr, uint64_t fail_value,
413 bool check_elaborating_dies) const {
414 DWARFFormValue form_value;
415 if (GetAttributeValue(cu, attr, form_value, nullptr, check_elaborating_dies))
416 return form_value.Unsigned();
417 return fail_value;
418}
419
420std::optional<uint64_t>
422 const DWARFUnit *cu, const dw_attr_t attr,
423 bool check_elaborating_dies) const {
424 DWARFFormValue form_value;
425 if (GetAttributeValue(cu, attr, form_value, nullptr, check_elaborating_dies))
426 return form_value.Unsigned();
427 return std::nullopt;
428}
429
430// GetAttributeValueAsReference
431//
432// Get the value of an attribute as reference and fix up and compile unit
433// relative offsets as needed.
435 const DWARFUnit *cu, const dw_attr_t attr,
436 bool check_elaborating_dies) const {
437 DWARFFormValue form_value;
438 if (GetAttributeValue(cu, attr, form_value, nullptr, check_elaborating_dies))
439 return form_value.Reference();
440 return {};
441}
442
444 const DWARFUnit *cu, const dw_attr_t attr, uint64_t fail_value,
445 bool check_elaborating_dies) const {
446 DWARFFormValue form_value;
447 if (GetAttributeValue(cu, attr, form_value, nullptr, check_elaborating_dies))
448 return form_value.Address();
449 return fail_value;
450}
451
452// GetAttributeHighPC
453//
454// Get the hi_pc, adding hi_pc to lo_pc when specified as an <offset-from-low-
455// pc>.
456//
457// Returns the hi_pc or fail_value.
460 uint64_t fail_value,
461 bool check_elaborating_dies) const {
462 DWARFFormValue form_value;
463 if (GetAttributeValue(cu, DW_AT_high_pc, form_value, nullptr,
464 check_elaborating_dies)) {
465 dw_form_t form = form_value.Form();
466 if (form == DW_FORM_addr || form == DW_FORM_addrx ||
467 form == DW_FORM_GNU_addr_index)
468 return form_value.Address();
469
470 // DWARF4 can specify the hi_pc as an <offset-from-lowpc>
471 return lo_pc + form_value.Unsigned();
472 }
473 return fail_value;
474}
475
476// GetAttributeAddressRange
477//
478// Get the lo_pc and hi_pc, adding hi_pc to lo_pc when specified as an <offset-
479// from-low-pc>.
480//
481// Returns true or sets lo_pc and hi_pc to fail_value.
483 const DWARFUnit *cu, dw_addr_t &lo_pc, dw_addr_t &hi_pc,
484 uint64_t fail_value, bool check_elaborating_dies) const {
485 lo_pc = GetAttributeValueAsAddress(cu, DW_AT_low_pc, fail_value,
486 check_elaborating_dies);
487 if (lo_pc != fail_value) {
488 hi_pc = GetAttributeHighPC(cu, lo_pc, fail_value, check_elaborating_dies);
489 if (hi_pc != fail_value)
490 return true;
491 }
492 lo_pc = fail_value;
493 hi_pc = fail_value;
494 return false;
495}
496
497llvm::Expected<llvm::DWARFAddressRangesVector>
499 DWARFUnit *cu, bool check_hi_lo_pc, bool check_elaborating_dies) const {
500
501 DWARFFormValue form_value;
502 if (GetAttributeValue(cu, DW_AT_ranges, form_value))
503 return GetRanges(*cu, form_value);
504
505 if (check_hi_lo_pc) {
509 check_elaborating_dies) &&
510 lo_pc < hi_pc)
511 return llvm::DWARFAddressRangesVector{{lo_pc, hi_pc}};
512 }
513 return llvm::createStringError("DIE has no address range information");
514}
515
516// GetName
517//
518// Get value of the DW_AT_name attribute and return it if one exists, else
519// return NULL.
520const char *DWARFDebugInfoEntry::GetName(const DWARFUnit *cu) const {
521 return GetAttributeValueAsString(cu, DW_AT_name, nullptr, true);
522}
523
524// GetMangledName
525//
526// Get value of the DW_AT_MIPS_linkage_name attribute and return it if one
527// exists, else return the value of the DW_AT_name attribute
528const char *
530 bool substitute_name_allowed) const {
531 const char *name = nullptr;
532
533 name = GetAttributeValueAsString(cu, DW_AT_MIPS_linkage_name, nullptr, true);
534 if (name)
535 return name;
536
537 name = GetAttributeValueAsString(cu, DW_AT_linkage_name, nullptr, true);
538 if (name)
539 return name;
540
541 if (!substitute_name_allowed)
542 return nullptr;
543
544 name = GetAttributeValueAsString(cu, DW_AT_name, nullptr, true);
545 return name;
546}
547
548// GetPubname
549//
550// Get value the name for a DIE as it should appear for a .debug_pubnames or
551// .debug_pubtypes section.
552const char *DWARFDebugInfoEntry::GetPubname(const DWARFUnit *cu) const {
553 const char *name = nullptr;
554 if (!cu)
555 return name;
556
557 name = GetAttributeValueAsString(cu, DW_AT_MIPS_linkage_name, nullptr, true);
558 if (name)
559 return name;
560
561 name = GetAttributeValueAsString(cu, DW_AT_linkage_name, nullptr, true);
562 if (name)
563 return name;
564
565 name = GetAttributeValueAsString(cu, DW_AT_name, nullptr, true);
566 return name;
567}
568
569/// This function is builds a table very similar to the standard .debug_aranges
570/// table, except that the actual DIE offset for the function is placed in the
571/// table instead of the compile unit offset.
573 DWARFUnit *cu, DWARFDebugAranges *debug_aranges) const {
575 if (m_tag) {
576 if (m_tag == DW_TAG_subprogram) {
577 if (llvm::Expected<llvm::DWARFAddressRangesVector> ranges =
578 GetAttributeAddressRanges(cu, /*check_hi_lo_pc=*/true)) {
579 for (const auto &r : *ranges)
580 debug_aranges->AppendRange(GetOffset(), r.LowPC, r.HighPC);
581 } else {
582 LLDB_LOG_ERROR(log, ranges.takeError(), "DIE({1:x}): {0}", GetOffset());
583 }
584 }
585
586 const DWARFDebugInfoEntry *child = GetFirstChild();
587 while (child) {
588 child->BuildFunctionAddressRangeTable(cu, debug_aranges);
589 child = child->GetSibling();
590 }
591 }
592}
593
595 return GetOffset() + llvm::getULEB128Size(m_abbr_idx);
596}
597
598const llvm::DWARFAbbreviationDeclaration *
600 if (!cu)
601 return nullptr;
602
603 const llvm::DWARFAbbreviationDeclarationSet *abbrev_set =
604 cu->GetAbbreviations();
605 if (!abbrev_set)
606 return nullptr;
607
608 return abbrev_set->getAbbreviationDeclaration(m_abbr_idx);
609}
610
612 if (Tag() != DW_TAG_variable && Tag() != DW_TAG_member)
613 return false;
614 const DWARFDebugInfoEntry *parent_die = GetParent();
615 while (parent_die != nullptr) {
616 switch (parent_die->Tag()) {
617 case DW_TAG_subprogram:
618 case DW_TAG_lexical_block:
619 case DW_TAG_inlined_subroutine:
620 return false;
621
622 case DW_TAG_compile_unit:
623 case DW_TAG_partial_unit:
624 return true;
625
626 default:
627 break;
628 }
629 parent_die = parent_die->GetParent();
630 }
631 return false;
632}
633
635 return m_offset == rhs.m_offset && m_parent_idx == rhs.m_parent_idx &&
638 m_tag == rhs.m_tag;
639}
640
642 return !(*this == rhs);
643}
static void ExtractAttrAndFormValue(const llvm::DWARFAbbreviationDeclaration::AttributeSpec &attr_spec, dw_attr_t &attr, DWARFFormValue &form_value)
static llvm::Expected< llvm::DWARFAddressRangesVector > GetRanges(DWARFUnit &unit, const DWARFFormValue &value)
int g_verbose
#define LLDB_LOG_ERROR(log, error,...)
Definition: Log.h:392
"lldb/Expression/DWARFExpressionList.h" Encapsulates a range map from file address range to a single ...
void SetFuncFileAddress(lldb::addr_t func_file_addr)
"lldb/Expression/DWARFExpression.h" Encapsulates a DWARF location expression and interprets it.
static bool ParseDWARFLocationList(const plugin::dwarf::DWARFUnit *dwarf_cu, const DataExtractor &data, DWARFExpressionList *loc_list)
An data extractor class.
Definition: DataExtractor.h:48
uint64_t GetULEB128(lldb::offset_t *offset_ptr) const
Extract a unsigned LEB128 value from *offset_ptr.
uint64_t GetByteSize() const
Get the number of bytes contained in this object.
const uint8_t * GetDataStart() const
Get the data start pointer.
bool ValidOffset(lldb::offset_t offset) const
Test the validity of offset.
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
Definition: ModuleChild.cpp:24
ObjectFile * GetObjectFile() override
Definition: SymbolFile.h:536
void Append(const DWARFFormValue &form_value, dw_offset_t attr_die_offset, dw_attr_t attr)
DWARFAttributes GetAttributes(Recurse recurse=Recurse::yes) const
DWARFDIE GetDIE(dw_offset_t die_offset) const
Definition: DWARFDIE.cpp:124
void AppendRange(dw_offset_t cu_offset, dw_addr_t low_pc, dw_addr_t high_pc)
DWARFDebugInfoEntry objects assume that they are living in one big vector and do pointer arithmetic o...
bool operator==(const DWARFDebugInfoEntry &rhs) const
dw_tag_t m_tag
A copy of the DW_TAG value so we don't have to go through the compile unit abbrev table.
bool GetAttributeAddressRange(const DWARFUnit *cu, dw_addr_t &lo_pc, dw_addr_t &hi_pc, uint64_t fail_value, bool check_elaborating_dies=false) const
dw_addr_t GetAttributeHighPC(const DWARFUnit *cu, dw_addr_t lo_pc, uint64_t fail_value, bool check_elaborating_dies=false) const
bool operator!=(const DWARFDebugInfoEntry &rhs) const
llvm::Expected< llvm::DWARFAddressRangesVector > GetAttributeAddressRanges(DWARFUnit *cu, bool check_hi_lo_pc, bool check_elaborating_dies=false) const
DWARFAttributes GetAttributes(DWARFUnit *cu, Recurse recurse=Recurse::yes) const
const char * GetMangledName(const DWARFUnit *cu, bool substitute_name_allowed=true) const
std::optional< uint64_t > GetAttributeValueAsOptionalUnsigned(const DWARFUnit *cu, const dw_attr_t attr, bool check_elaborating_dies=false) const
const llvm::DWARFAbbreviationDeclaration * GetAbbreviationDeclarationPtr(const DWARFUnit *cu) const
void BuildFunctionAddressRangeTable(DWARFUnit *cu, DWARFDebugAranges *debug_aranges) const
This function is builds a table very similar to the standard .debug_aranges table,...
DWARFDIE GetAttributeValueAsReference(const DWARFUnit *cu, const dw_attr_t attr, bool check_elaborating_dies=false) const
const char * GetAttributeValueAsString(const DWARFUnit *cu, const dw_attr_t attr, const char *fail_value, bool check_elaborating_dies=false) const
bool GetDIENamesAndRanges(DWARFUnit *cu, const char *&name, const char *&mangled, llvm::DWARFAddressRangesVector &rangeList, std::optional< int > &decl_file, std::optional< int > &decl_line, std::optional< int > &decl_column, std::optional< int > &call_file, std::optional< int > &call_line, std::optional< int > &call_column, DWARFExpressionList *frame_base=nullptr) const
uint64_t GetAttributeValueAsAddress(const DWARFUnit *cu, const dw_attr_t attr, uint64_t fail_value, bool check_elaborating_dies=false) const
uint64_t GetAttributeValueAsUnsigned(const DWARFUnit *cu, const dw_attr_t attr, uint64_t fail_value, bool check_elaborating_dies=false) const
const char * GetPubname(const DWARFUnit *cu) const
bool Extract(const DWARFDataExtractor &data, const DWARFUnit &cu, lldb::offset_t *offset_ptr)
dw_offset_t GetAttributeValue(const DWARFUnit *cu, const dw_attr_t attr, DWARFFormValue &formValue, dw_offset_t *end_attr_offset_ptr=nullptr, bool check_elaborating_dies=false) const
const char * GetName(const DWARFUnit *cu) const
bool ExtractValue(const DWARFDataExtractor &data, lldb::offset_t *offset_ptr)
std::optional< uint8_t > GetFixedSize() const
bool SkipValue(const DWARFDataExtractor &debug_info_data, lldb::offset_t *offset_ptr) const
llvm::Expected< llvm::DWARFAddressRangesVector > 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:1017
SymbolFileDWARF & GetSymbolFileDWARF() const
Definition: DWARFUnit.h:177
const DWARFDataExtractor & GetData() const
Get the data that contains the DIE information for this unit.
Definition: DWARFUnit.cpp:989
DWARFDataExtractor GetLocationData() const
Definition: DWARFUnit.cpp:536
llvm::Expected< llvm::DWARFAddressRangesVector > 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:1057
const llvm::DWARFAbbreviationDeclarationSet * GetAbbreviations() const
Definition: DWARFUnit.cpp:450
uint64_t dw_offset_t
Definition: dwarf.h:30
llvm::dwarf::Attribute dw_attr_t
Definition: dwarf.h:23
uint64_t dw_addr_t
Definition: dwarf.h:26
llvm::dwarf::Form dw_form_t
Definition: dwarf.h:24
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:82
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:332
uint64_t offset_t
Definition: lldb-types.h:85
uint64_t addr_t
Definition: lldb-types.h:80
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:373