LLVM: lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
25
26using namespace llvm;
29
30#define DEBUG_TYPE "DWARFReader"
31
32void LVDWARFReader::processOneAttribute(const DWARFDie &Die,
35 uint64_t OffsetOnEntry = *OffsetPtr;
39
40
41
42 auto GetAsUnsignedConstant = [&]() -> int64_t {
46 return *Val;
47 return 0;
48 };
49
50 auto GetFlag = [](const DWARFFormValue &FormValue) -> bool {
52 };
53
54 auto GetBoundValue = [&AttrSpec](const DWARFFormValue &FormValue) -> int64_t {
55 switch (FormValue.getForm()) {
56 case dwarf::DW_FORM_ref_addr:
57 case dwarf::DW_FORM_ref1:
58 case dwarf::DW_FORM_ref2:
59 case dwarf::DW_FORM_ref4:
60 case dwarf::DW_FORM_ref8:
61 case dwarf::DW_FORM_ref_udata:
62 case dwarf::DW_FORM_ref_sig8:
64 case dwarf::DW_FORM_data1:
65 case dwarf::DW_FORM_flag:
66 case dwarf::DW_FORM_data2:
67 case dwarf::DW_FORM_data4:
68 case dwarf::DW_FORM_data8:
69 case dwarf::DW_FORM_udata:
70 case dwarf::DW_FORM_ref_sup4:
71 case dwarf::DW_FORM_ref_sup8:
73 case dwarf::DW_FORM_sdata:
75 case dwarf::DW_FORM_implicit_const:
77 default:
78 return 0;
79 }
80 };
81
84 << formatv(" {0}", AttrSpec.Attr) << "\n";
85 });
86
87 switch (AttrSpec.Attr) {
88 case dwarf::DW_AT_accessibility:
90 break;
91 case dwarf::DW_AT_artificial:
93 break;
94 case dwarf::DW_AT_bit_size:
96 break;
97 case dwarf::DW_AT_byte_size:
99 break;
100 case dwarf::DW_AT_call_file:
102 ? GetAsUnsignedConstant() + 1
103 : GetAsUnsignedConstant());
104 break;
105 case dwarf::DW_AT_call_line:
107 break;
108 case dwarf::DW_AT_comp_dir:
110 break;
111 case dwarf::DW_AT_const_value:
114
118
119
120 if (FormValue.getForm() == dwarf::DW_FORM_sdata) {
121 std::stringstream Stream;
124 Stream << "-";
126 }
129 } else
131 } else
133 break;
134 case dwarf::DW_AT_count:
136 break;
137 case dwarf::DW_AT_decl_line:
139 break;
140 case dwarf::DW_AT_decl_file:
142 ? GetAsUnsignedConstant() + 1
143 : GetAsUnsignedConstant());
144 break;
145 case dwarf::DW_AT_enum_class:
146 if (GetFlag(FormValue))
148 break;
149 case dwarf::DW_AT_external:
150 if (GetFlag(FormValue))
152 break;
153 case dwarf::DW_AT_GNU_discriminator:
155 break;
156 case dwarf::DW_AT_inline:
158 break;
159 case dwarf::DW_AT_lower_bound:
161 break;
162 case dwarf::DW_AT_name:
164 break;
165 case dwarf::DW_AT_GNU_template_name:
167 break;
168 case dwarf::DW_AT_linkage_name:
169 case dwarf::DW_AT_MIPS_linkage_name:
171 break;
172 case dwarf::DW_AT_producer:
173 if (options().getAttributeProducer())
175 break;
176 case dwarf::DW_AT_language:
177 if (options().getAttributeLanguage())
180 break;
181 case dwarf::DW_AT_upper_bound:
183 break;
184 case dwarf::DW_AT_virtuality:
186 break;
187
188 case dwarf::DW_AT_abstract_origin:
189 case dwarf::DW_AT_call_origin:
190 case dwarf::DW_AT_extension:
191 case dwarf::DW_AT_import:
192 case dwarf::DW_AT_specification:
193 case dwarf::DW_AT_type:
194 updateReference(AttrSpec.Attr, FormValue);
195 break;
196
197 case dwarf::DW_AT_low_pc:
198 if (options().getGeneralCollectRanges()) {
199 FoundLowPC = true;
200
201
202
204 CurrentLowPC = *Value;
205 } else {
207 if (U->getAddrOffsetSectionItem(UValue)) {
209 } else {
210 FoundLowPC = false;
211
214 });
215 }
216 }
217 if (FoundLowPC) {
220 else
221
225 }
226 }
227 break;
228
229 case dwarf::DW_AT_high_pc:
230 if (options().getGeneralCollectRanges()) {
231 FoundHighPC = true;
232 if (std::optional<uint64_t> Address = FormValue.getAsAddress())
233
234 CurrentHighPC = *Address;
236
237
238
239
240 CurrentHighPC =
243
245 --CurrentHighPC;
246
250 }
251 break;
252
253 case dwarf::DW_AT_ranges:
254 if (RangesDataAvailable && options().getGeneralCollectRanges()) {
257 if (FormValue.getForm() == dwarf::DW_FORM_rnglistx)
260 };
262 GetRanges(FormValue, U);
263 if (!RangesOrError) {
266 dbgs() << format("error decoding address ranges = ",
267 TheError.c_str());
268 });
270 break;
271 }
272
275
278 continue;
279
282
285
287
290 }
291 }
292 break;
293
294
295 case dwarf::DW_AT_data_member_location:
296 if (options().getAttributeAnyLocation())
297 processLocationMember(AttrSpec.Attr, FormValue, Die, OffsetOnEntry);
298 break;
299
300
301 case dwarf::DW_AT_location:
302 case dwarf::DW_AT_string_length:
303 case dwarf::DW_AT_use_location:
305 processLocationList(AttrSpec.Attr, FormValue, Die, OffsetOnEntry);
306 break;
307
308 case dwarf::DW_AT_call_data_value:
309 case dwarf::DW_AT_call_value:
310 case dwarf::DW_AT_GNU_call_site_data_value:
311 case dwarf::DW_AT_GNU_call_site_value:
313 processLocationList(AttrSpec.Attr, FormValue, Die, OffsetOnEntry,
314 true);
315 break;
316
317 default:
318 break;
319 }
320}
321
322LVScope *LVDWARFReader::processOneDie(const DWARFDie &InputDIE, LVScope *Parent,
323 DWARFDie &SkeletonDie) {
324
325
326
327
328 const DWARFDie &DIE = SkeletonDie.isValid() ? SkeletonDie : InputDIE;
329 DWARFDataExtractor DebugInfoData =
332
333
334 CurrentLowPC = 0;
335 CurrentHighPC = 0;
337 CurrentEndOffset = 0;
338 FoundLowPC = false;
339 FoundHighPC = false;
340
341
343
346 << "\n";
347 });
348
349
354
357
361
362
363
364
367
368
371
372 for (LVElement *Target : Reference.References)
374 for (LVElement *Target : Reference.Types)
376
379 }
380
381
382
389
390
391 auto ProcessAttributes = [&](const DWARFDie &TheDIE,
392 DWARFDataExtractor &DebugData) {
393 CurrentEndOffset = Offset;
394 uint32_t abbrCode = DebugData.getULEB128(&CurrentEndOffset);
395 if (abbrCode) {
396 if (const DWARFAbbreviationDeclaration *AbbrevDecl =
398 for (const DWARFAbbreviationDeclaration::AttributeSpec &AttrSpec :
399 AbbrevDecl->attributes())
400 processOneAttribute(TheDIE, &CurrentEndOffset, AttrSpec);
401 }
402 };
403
404 ProcessAttributes(DIE, DebugInfoData);
405
406
407
408 if (SkeletonDie.isValid()) {
409 DWARFDataExtractor DebugInfoData =
413 ProcessAttributes(InputDIE, DebugInfoData);
414 }
415 }
416
419
420
422 if (FoundLowPC && FoundHighPC) {
423 CurrentScope->addObject(CurrentLowPC, CurrentHighPC);
425
426 if ((options().getAttributePublics() ||
427 options().getPrintAnyLine()) &&
431 CurrentHighPC);
432 }
433 }
434
435
436
437
440 CurrentScope->getHasReferenceSpecification()) {
441
442 std::optional LinkageDIE =
444 if (LinkageDIE.has_value()) {
446 if (.empty())
448 }
449 }
450
451
452
453
457
458
459 if (SectionIndex) {
464 ? Range.second - 1
467 }
468
469 if (FoundLowPC && FoundHighPC && ) {
471 CurrentHighPC > CurrentLowPC
472 ? CurrentHighPC - 1
473 : CurrentHighPC);
474 }
475 }
476 }
477
478 if (Parent->getIsAggregate())
480 }
481
482
486
487
489 Parent->setIsTemplate();
490
492}
493
494void LVDWARFReader::traverseDieAndChildren(DWARFDie &DIE, LVScope *Parent,
495 DWARFDie &SkeletonDie) {
496
497 LVScope *Scope = processOneDie(DIE, Parent, SkeletonDie);
498 if (Scope) {
501 DWARFDie DummyDie;
502
504 while (Child) {
505 traverseDieAndChildren(Child, Scope, DummyDie);
508 }
509
512 }
513}
514
515void LVDWARFReader::processLocationGaps() {
516 if (options().getAttributeAnyLocation())
517 for (LVSymbol *Symbol : SymbolsWithLocations)
518 Symbol->fillLocationGaps();
519}
520
521void LVDWARFReader::createLineAndFileRecords(
522 const DWARFDebugLine::LineTable *Lines) {
523 if (!Lines)
524 return;
525
526
527 if (!Lines->Prologue.FileNames.empty())
528 for (const DWARFDebugLine::FileNameEntry &Entry :
529 Lines->Prologue.FileNames) {
530 std::string Directory;
531 if (Lines->getDirectoryForEntry(Entry, Directory))
533 if (Directory.empty())
534 Directory = std::string(CompileUnit->getCompilationDirectory());
537 raw_string_ostream(String) << Directory << "/" << File;
539 }
540
541
542 bool IncrementIndex = Lines->Prologue.getVersion() >= 5;
543
544
545 if (options().getPrintLines() && Lines->Rows.size())
546 for (const DWARFDebugLine::Row &Row : Lines->Rows) {
547
548
549
550
551 LVLineDebug *Line = createLineDebug();
553
555 Line->setFilename(
556 CompileUnit->getFilename(IncrementIndex ? Row.File + 1 : Row.File));
557 Line->setLineNumber(Row.Line);
558 if (Row.Discriminator)
559 Line->setDiscriminator(Row.Discriminator);
560 if (Row.IsStmt)
561 Line->setIsNewStatement();
562 if (Row.BasicBlock)
563 Line->setIsBasicBlock();
564 if (Row.EndSequence)
565 Line->setIsEndSequence();
566 if (Row.EpilogueBegin)
567 Line->setIsEpilogueBegin();
568 if (Row.PrologueEnd)
569 Line->setIsPrologueEnd();
572 << " Line: " << Line->lineNumberAsString(true)
573 << "\n";
574 });
575 }
576}
577
580
581
582
583
584 if (Opcode == dwarf::DW_OP_regval_type)
585 return {};
586
587 std::string string;
590 auto *MCRegInfo = MRI.get();
591 auto GetRegName = [&MCRegInfo](uint64_t DwarfRegNum, bool IsEH) -> StringRef {
592 if (!MCRegInfo)
593 return {};
594 if (std::optional LLVMRegNum =
595 MCRegInfo->getLLVMRegNum(DwarfRegNum, IsEH))
596 if (const char *RegName = MCRegInfo->getName(*LLVMRegNum))
598 return {};
599 };
602 return Stream.str();
603}
604
607 W.startLine() << "\n";
608 W.printString("File", Obj.getFileName().str());
610 });
611
613 return Err;
614
615
616
617
619 if (!DwarfContext)
621 "Could not create DWARF information: %s",
623
624 if (Error Err = loadTargetInfo(Obj))
625 return Err;
626
627
629
630
631
633 DwarfContext->getNumCompileUnits() ? DwarfContext->compile_units()
634 : DwarfContext->dwo_compile_units();
635 for (const std::unique_ptr &CU : CompileUnits) {
636
637
638
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693 auto DeduceIncrementFileIndex = [&]() -> bool {
694 if (CU->getVersion() < 5)
695
696 return false;
697
699 CU->getContext().getLineTableForUnit(CU.get())) {
700
701 if (LT->hasFileAtIndex(0) && LT->hasFileAtIndex(1)) {
703 LT->Prologue.getFileNameEntry(0);
705 LT->Prologue.getFileNameEntry(1);
706
708
709 return true;
710
711 std::string FileZero;
712 std::string FileOne;
714 LT->getFileNameByIndex(
716 FileZero);
717 LT->getFileNameByIndex(
719 FileOne);
720 return FileZero != FileOne;
721 }
722 }
723
724
725 return true;
726 };
727
728 IncrementFileIndex = DeduceIncrementFileIndex();
729
732 if (UnitDie) {
733 std::optional<const char *> DWOFileName =
734 CU->getVersion() >= 5
737 StringRef From(DWOFileName.value_or(""));
739 }
740
741
742
743
744 DWARFDie CUDie = CU->getNonSkeletonUnitDIE(
745 false,
746 DWOAlternativeLocation);
748 continue;
749
750
751
752
756
757
758 RangesDataAvailable =
761 : true));
762
763 traverseDieAndChildren(CUDie, Root, SkeletonDie);
764
765 createLineAndFileRecords(DwarfContext->getLineTableForUnit(CU.get()));
767 return Err;
768
769
770
771
775 ScopesWithRanges->sort();
776
778 processLocationGaps();
779
780
781 ScopesWithRanges->clear();
782 SymbolsWithLocations.clear();
784 }
785
787}
788
789
790void LVDWARFReader::processLocationList(dwarf::Attribute Attr,
794 bool CallSiteLocation) {
795
799 };
800
802 DWARFContext &DwarfContext = U->getContext();
809 IsLittleEndian, 0);
811 U->getFormParams().Format);
812
813
815 0, OffsetOnEntry,
816 CallSiteLocation);
817 ProcessLocationExpression(Expression);
818 return;
819 }
820
824 if (FormValue.getForm() == dwarf::DW_FORM_loclistx) {
825 std::optional<uint64_t> LoclistOffset = U->getLoclistOffset(Offset);
826 if (!LoclistOffset)
827 return;
828 Offset = *LoclistOffset;
829 }
831 if (std::optional BA = U->getBaseAddress())
835
836 auto ProcessLocationEntry = [&](const DWARFLocationEntry &Entry) {
837 if (Entry.Kind == dwarf::DW_LLE_base_address) {
839 return;
840 }
841 if (Entry.Kind == dwarf::DW_LLE_offset_pair) {
844 DWARFAddressRange Range{LowPC, HighPC, Entry.SectionIndex};
846 Range.SectionIndex = Entry.SectionIndex;
847 DWARFLocationExpression Loc{Range, Entry.Loc};
848 DWARFDataExtractor Data(Loc.Expr, IsLittleEndian,
849 U->getAddressByteSize());
850 DWARFExpression Expression(Data, U->getAddressByteSize());
851
852
854 --HighPC;
855
857 CallSiteLocation);
858 ProcessLocationExpression(Expression);
859 }
860 };
861 Error E = U->getLocationTable().visitLocationList(
862 &Offset, [&](const DWARFLocationEntry &E) {
863 ProcessLocationEntry(E);
864 return true;
865 });
866 if (E)
868 }
869}
870
871void LVDWARFReader::processLocationMember(dwarf::Attribute Attr,
872 const DWARFFormValue &FormValue,
873 const DWARFDie &Die,
874 uint64_t OffsetOnEntry) {
875
877
879 OffsetOnEntry);
880 else
881
882 processLocationList(Attr, FormValue, Die, OffsetOnEntry);
883}
884
885
887 const DWARFFormValue &FormValue) {
888
889
890
896 else
898
899
900 LVElement *Target = getElementForOffset(
902 Attr == dwarf::DW_AT_import || Attr == dwarf::DW_AT_type);
903
904 if (FormValue.getForm() == dwarf::DW_FORM_ref_addr) {
905 if (Target) {
906
907 Target->setIsGlobalReference();
908
909 removeGlobalOffset(Offset);
910 } else
911
912 addGlobalOffset(Offset);
913 }
914
915
916
917
918
919
920
921
922 switch (Attr) {
923 case dwarf::DW_AT_abstract_origin:
924 case dwarf::DW_AT_call_origin:
927 break;
928 case dwarf::DW_AT_extension:
931 break;
932 case dwarf::DW_AT_specification:
935 break;
936 case dwarf::DW_AT_import:
937 case dwarf::DW_AT_type:
939 break;
940 default:
941 break;
942 }
943}
944
945
947 LVElement *Element, bool IsType) {
948
949 LVElementEntry &Entry = ElementTable[Offset];
950 if (.Element) {
951 if (IsType)
952 Entry.Types.insert(Element);
953 else
954 Entry.References.insert(Element);
955 }
956 return Entry.Element;
957}
958
959Error LVDWARFReader::loadTargetInfo(const ObjectFile &Obj) {
960
961
962 Triple TT = Obj.makeTriple();
963
964
965 Expected Features = Obj.getFeatures();
966 SubtargetFeatures FeaturesValue;
967 if (!Features) {
969 FeaturesValue = SubtargetFeatures();
970 }
971 FeaturesValue = *Features;
972
973 StringRef CPU;
974 if (auto OptCPU = Obj.tryGetCPUName())
975 CPU = *OptCPU;
976
978}
979
980void LVDWARFReader::mapRangeAddress(const ObjectFile &Obj) {
981 for (auto Iter = Obj.symbol_begin(); Iter != Obj.symbol_end(); ++Iter) {
982 const SymbolRef &Symbol = *Iter;
983
984 ExpectedSymbolRef::Type TypeOrErr = Symbol.getType();
985 if (!TypeOrErr) {
987 continue;
988 }
989
990
993 continue;
994
995
996
997
998
1000 bool IsSTAB = false;
1001 if (MachO) {
1002 DataRefImpl SymDRI = Symbol.getRawDataRefImpl();
1003 uint8_t NType =
1007 IsSTAB = true;
1008 }
1009
1010 Expected<section_iterator> IterOrErr = Symbol.getSection();
1011 if (!IterOrErr) {
1013 continue;
1014 }
1016 if (Section == Obj.section_end())
1017 continue;
1018
1019
1020 Expected<uint64_t> AddressOrErr = Symbol.getAddress();
1021 if (!AddressOrErr) {
1023 continue;
1024 }
1025 uint64_t Address = *AddressOrErr;
1026
1027
1028 StringRef Name;
1029 Expected NameOrErr = Symbol.getName();
1030 if (!NameOrErr) {
1032 continue;
1033 }
1034 Name = *NameOrErr;
1035
1036
1037 Expected<uint32_t> FlagsOrErr = Symbol.getFlags();
1038 if (!FlagsOrErr) {
1040 continue;
1041 }
1042 uint32_t Flags = *FlagsOrErr;
1043
1044
1045
1046
1048 bool IsComdat =
1050
1051
1053 }
1054}
1055
1057
1059 OS << "LVType\n";
1061}
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
DWARFUnitVector::compile_unit_range compile_unit_range
bool isLittleEndian() const
static std::unique_ptr< DWARFContext > create(const object::ObjectFile &Obj, ProcessDebugRelocations RelocAction=ProcessDebugRelocations::Process, const LoadedObjectInfo *L=nullptr, std::string DWPName="", std::function< void(Error)> RecoverableErrorHandler=WithColor::defaultErrorHandler, std::function< void(Error)> WarningHandler=WithColor::defaultWarningHandler, bool ThreadSafe=false)
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
uint64_t getOffset() const
Get the absolute offset into the debug info or types section.
LLVM_ABI std::optional< DWARFFormValue > find(dwarf::Attribute Attr) const
Extract the specified attribute from this DIE.
DWARFUnit * getDwarfUnit() const
LLVM_ABI DWARFDie getSibling() const
Get the sibling of this DIE object.
LLVM_ABI std::optional< DWARFFormValue > findRecursively(ArrayRef< dwarf::Attribute > Attrs) const
Extract the first value of any attribute in Attrs from this DIE and recurse into any DW_AT_specificat...
const DWARFAbbreviationDeclaration * getAbbreviationDeclarationPtr() const
Get the abbreviation declaration for this DIE.
LLVM_ABI DWARFDie getFirstChild() const
Get the first child of this DIE object.
dwarf::Tag getTag() const
This class represents an Operation in the Expression.
LLVM_ABI std::optional< ArrayRef< uint8_t > > getAsBlock() const
LLVM_ABI std::optional< uint64_t > getAsSectionOffset() const
LLVM_ABI bool isFormClass(FormClass FC) const
LLVM_ABI std::optional< uint64_t > getAsReferenceUVal() const
LLVM_ABI std::optional< int64_t > getAsSignedConstant() const
LLVM_ABI std::optional< uint64_t > getAsAddress() const
LLVM_ABI std::optional< uint64_t > getAsRelativeReference() const
getAsFoo functions below return the extracted value as Foo if only DWARFFormValue has form class is s...
LLVM_ABI std::optional< uint64_t > getAsDebugInfoReference() const
LLVM_ABI std::optional< uint64_t > getAsUnsignedConstant() const
static LLVM_ABI DWARFFormValue createFromUnit(dwarf::Form F, const DWARFUnit *Unit, uint64_t *OffsetPtr)
const DWARFUnit * getUnit() const
dwarf::Form getForm() const
uint64_t getRawUValue() const
DWARFDataExtractor getDebugInfoExtractor() const
uint64_t getOffset() const
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
reference get()
Returns a reference to the stored T value.
Class representing an expression and its matching format.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
StringRef - Represent a constant reference to a string, i.e.
LLVM_ABI std::string getString() const
Returns features as a string.
LLVM Value Representation.
Stores all information relating to a compile unit, be it in its original instance in the object file ...
LVSectionIndex updateSymbolTable(LVScope *Function)
LVSectionIndex getSectionIndex(LVScope *Scope) override
Error loadGenericTargetInfo(StringRef TheTriple, StringRef TheFeatures, StringRef TheCPU)
void addToSymbolTable(StringRef Name, LVScope *Function, LVSectionIndex SectionIndex=0)
void processLines(LVLines *DebugLines, LVSectionIndex SectionIndex)
void mapVirtualAddress(const object::ObjectFile &Obj)
std::unique_ptr< const MCRegisterInfo > MRI
Error createInstructions()
LVAddress WasmCodeSectionOffset
LVAddress getTombstoneAddress() const
void setCUHighAddress(LVAddress Address)
void setTombstoneAddress(LVAddress Address)
void print(raw_ostream &OS) const
Definition LVDWARFReader.cpp:1058
std::string getRegisterName(LVSmall Opcode, ArrayRef< uint64_t > Operands) override
Definition LVDWARFReader.cpp:578
void sortScopes() override
Definition LVDWARFReader.cpp:1056
void setCUBaseAddress(LVAddress Address)
Error createScopes() override
Definition LVDWARFReader.cpp:605
virtual void setCount(int64_t Value)
virtual void setCallLineNumber(uint32_t Number)
virtual void setBitSize(uint32_t Size)
virtual void setLinkageName(StringRef LinkageName)
virtual void setProducer(StringRef ProducerName)
virtual void setUpperBound(int64_t Value)
virtual void setDiscriminator(uint32_t Value)
virtual void setLowerBound(int64_t Value)
virtual void setValue(StringRef Value)
void setInlineCode(uint32_t Code)
void setName(StringRef ElementName) override
virtual bool isCompileUnit() const
void setAccessibilityCode(uint32_t Access)
void setVirtualityCode(uint32_t Virtuality)
void setFilenameIndex(size_t Index)
virtual void setSourceLanguage(LVSourceLanguage SL)
virtual void setCallFilenameIndex(size_t Index)
void setLineNumber(uint32_t Number)
LVRange * getSectionRanges(LVSectionIndex SectionIndex)
void addCompileUnitOffset(LVOffset Offset, LVScopeCompileUnit *CompileUnit)
std::vector< LVAddressRange > CurrentRanges
std::string FileFormatName
std::string createAlternativePath(StringRef From)
LVElement * CurrentElement
LVElement * createElement(dwarf::Tag Tag)
StringRef getFilename() const
LVScopeCompileUnit * CompileUnit
LVSectionIndex DotTextSectionIndex
void addSectionRange(LVSectionIndex SectionIndex, LVScope *Scope)
virtual Error createScopes()
void addElement(LVElement *Element)
void addObject(LVLocation *Location)
void addLocation(dwarf::Attribute Attr, LVAddress LowPC, LVAddress HighPC, LVUnsigned SectionOffset, uint64_t LocDescOffset, bool CallSiteLocation=false)
void addLocationOperands(LVSmall Opcode, ArrayRef< uint64_t > Operands)
MachO::nlist getSymbolTableEntry(DataRefImpl DRI) const
MachO::nlist_64 getSymbol64TableEntry(DataRefImpl DRI) const
bool is64Bit() const override
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an std::string.
std::string & str()
Returns the string's reference.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::optional< const char * > toString(const std::optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract a string value from it.
StringRef toStringRef(const std::optional< DWARFFormValue > &V, StringRef Default={})
Take an optional DWARFFormValue and try to extract a string value from it.
uint64_t computeTombstoneAddress(uint8_t AddressByteSize)
Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface o...
FormattedNumber hexValue(uint64_t N, unsigned Width=HEX_WIDTH, bool Upper=false)
std::string hexString(uint64_t Value, size_t Width=HEX_WIDTH)
constexpr unsigned int DWARF_CHAR_BIT
LLVM_ABI std::string transformPath(StringRef Path)
std::pair< LVAddress, LVAddress > LVAddressRange
constexpr bool UpdateHighAddress
DWARFAbbreviationDeclaration::AttributeSpec AttributeSpec
content_iterator< SectionRef > section_iterator
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast - Return the argument parameter cast to the specified type.
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
DWARFExpression::Operation Op
std::string toString(const APInt &I, unsigned Radix, bool Signed, bool formatAsCLiteral=false, bool UpperCase=true, bool InsertSeparators=false)
void toHex(ArrayRef< uint8_t > Input, bool LowerCase, SmallVectorImpl< char > &Output)
Convert buffer Input to its hexadecimal representation. The returned string is double the size of Inp...
LLVM_ABI bool prettyPrintRegisterOp(DWARFUnit *U, raw_ostream &OS, DIDumpOptions DumpOpts, uint8_t Opcode, ArrayRef< uint64_t > Operands)
Pretty print a register opcode and operands.
void consumeError(Error Err)
Consume a Error without doing anything.
StringRef toStringRef(bool B)
Construct a string ref from a boolean.
std::vector< DWARFAddressRange > DWARFAddressRangesVector
DWARFAddressRangesVector - represents a set of absolute address ranges.
Container for dump options that control which debug information will be dumped.
std::function< llvm::StringRef(uint64_t DwarfRegNum, bool IsEH)> GetNameForDWARFReg
bool isImplicitConst() const
int64_t getImplicitConstValue() const
static LLVM_ABI bool mayHaveLocationList(dwarf::Attribute Attr)
Identify DWARF attributes that may contain a pointer to a location list.
static LLVM_ABI bool mayHaveLocationExpr(dwarf::Attribute Attr)
Identifies DWARF attributes that may contain a reference to a DWARF expression.
SmallVector< uint8_t, 4 > Expr
The expression itself.
static const uint64_t UndefSection
A source language supported by any of the debug info representations.