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 if (AbbrevDecl)
399 for (const DWARFAbbreviationDeclaration::AttributeSpec &AttrSpec :
400 AbbrevDecl->attributes())
401 processOneAttribute(TheDIE, &CurrentEndOffset, AttrSpec);
402 }
403 };
404
405 ProcessAttributes(DIE, DebugInfoData);
406
407
408
409 if (SkeletonDie.isValid()) {
410 DWARFDataExtractor DebugInfoData =
414 ProcessAttributes(InputDIE, DebugInfoData);
415 }
416 }
417
420
421
423 if (FoundLowPC && FoundHighPC) {
424 CurrentScope->addObject(CurrentLowPC, CurrentHighPC);
426
427 if ((options().getAttributePublics() ||
428 options().getPrintAnyLine()) &&
432 CurrentHighPC);
433 }
434 }
435
436
437
438
441 CurrentScope->getHasReferenceSpecification()) {
442
443 std::optional LinkageDIE =
445 if (LinkageDIE.has_value()) {
447 if (.empty())
449 }
450 }
451
452
453
454
458
459
460 if (SectionIndex) {
465 ? Range.second - 1
468 }
469
470 if (FoundLowPC && FoundHighPC && ) {
472 CurrentHighPC > CurrentLowPC
473 ? CurrentHighPC - 1
474 : CurrentHighPC);
475 }
476 }
477 }
478
479 if (Parent->getIsAggregate())
481 }
482
483
487
488
490 Parent->setIsTemplate();
491
493}
494
495void LVDWARFReader::traverseDieAndChildren(DWARFDie &DIE, LVScope *Parent,
496 DWARFDie &SkeletonDie) {
497
498 LVScope *Scope = processOneDie(DIE, Parent, SkeletonDie);
499 if (Scope) {
502 DWARFDie DummyDie;
503
505 while (Child) {
506 traverseDieAndChildren(Child, Scope, DummyDie);
509 }
510
513 }
514}
515
516void LVDWARFReader::processLocationGaps() {
517 if (options().getAttributeAnyLocation())
518 for (LVSymbol *Symbol : SymbolsWithLocations)
519 Symbol->fillLocationGaps();
520}
521
522void LVDWARFReader::createLineAndFileRecords(
523 const DWARFDebugLine::LineTable *Lines) {
524 if (!Lines)
525 return;
526
527
528 if (!Lines->Prologue.FileNames.empty())
529 for (const DWARFDebugLine::FileNameEntry &Entry :
530 Lines->Prologue.FileNames) {
531 std::string Directory;
532 if (Lines->getDirectoryForEntry(Entry, Directory))
534 if (Directory.empty())
535 Directory = std::string(CompileUnit->getCompilationDirectory());
538 raw_string_ostream(String) << Directory << "/" << File;
540 }
541
542
543 bool IncrementIndex = Lines->Prologue.getVersion() >= 5;
544
545
546 if (options().getPrintLines() && Lines->Rows.size())
547 for (const DWARFDebugLine::Row &Row : Lines->Rows) {
548
549
550
551
552 LVLineDebug *Line = createLineDebug();
554
556 Line->setFilename(
557 CompileUnit->getFilename(IncrementIndex ? Row.File + 1 : Row.File));
558 Line->setLineNumber(Row.Line);
559 if (Row.Discriminator)
560 Line->setDiscriminator(Row.Discriminator);
561 if (Row.IsStmt)
562 Line->setIsNewStatement();
563 if (Row.BasicBlock)
564 Line->setIsBasicBlock();
565 if (Row.EndSequence)
566 Line->setIsEndSequence();
567 if (Row.EpilogueBegin)
568 Line->setIsEpilogueBegin();
569 if (Row.PrologueEnd)
570 Line->setIsPrologueEnd();
573 << " Line: " << Line->lineNumberAsString(true)
574 << "\n";
575 });
576 }
577}
578
581
582
583
584
585 if (Opcode == dwarf::DW_OP_regval_type)
586 return {};
587
588 std::string string;
591 auto *MCRegInfo = MRI.get();
592 auto GetRegName = [&MCRegInfo](uint64_t DwarfRegNum, bool IsEH) -> StringRef {
593 if (!MCRegInfo)
594 return {};
595 if (std::optional LLVMRegNum =
596 MCRegInfo->getLLVMRegNum(DwarfRegNum, IsEH))
597 if (const char *RegName = MCRegInfo->getName(*LLVMRegNum))
599 return {};
600 };
603 return Stream.str();
604}
605
608 W.startLine() << "\n";
609 W.printString("File", Obj.getFileName().str());
611 });
612
614 return Err;
615
616
617
618
620 if (!DwarfContext)
622 "Could not create DWARF information: %s",
624
625 if (Error Err = loadTargetInfo(Obj))
626 return Err;
627
628
630
631
632
634 DwarfContext->getNumCompileUnits() ? DwarfContext->compile_units()
635 : DwarfContext->dwo_compile_units();
636 for (const std::unique_ptr &CU : CompileUnits) {
637
638
639
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
694 auto DeduceIncrementFileIndex = [&]() -> bool {
695 if (CU->getVersion() < 5)
696
697 return false;
698
700 CU->getContext().getLineTableForUnit(CU.get())) {
701
702 if (LT->hasFileAtIndex(0) && LT->hasFileAtIndex(1)) {
704 LT->Prologue.getFileNameEntry(0);
706 LT->Prologue.getFileNameEntry(1);
707
709
710 return true;
711
712 std::string FileZero;
713 std::string FileOne;
715 LT->getFileNameByIndex(
717 FileZero);
718 LT->getFileNameByIndex(
720 FileOne);
721 return FileZero != FileOne;
722 }
723 }
724
725
726 return true;
727 };
728
729 IncrementFileIndex = DeduceIncrementFileIndex();
730
733 if (UnitDie) {
734 std::optional<const char *> DWOFileName =
735 CU->getVersion() >= 5
738 StringRef From(DWOFileName.value_or(""));
740 }
741
742
743
744
745 DWARFDie CUDie = CU->getNonSkeletonUnitDIE(
746 false,
747 DWOAlternativeLocation);
749 continue;
750
751
752
753
757
758
759 RangesDataAvailable =
762 : true));
763
764 traverseDieAndChildren(CUDie, Root, SkeletonDie);
765
766 createLineAndFileRecords(DwarfContext->getLineTableForUnit(CU.get()));
768 return Err;
769
770
771
772
776 ScopesWithRanges->sort();
777
779 processLocationGaps();
780
781
782 ScopesWithRanges->clear();
783 SymbolsWithLocations.clear();
785 }
786
788}
789
790
791void LVDWARFReader::processLocationList(dwarf::Attribute Attr,
795 bool CallSiteLocation) {
796
800 };
801
803 DWARFContext &DwarfContext = U->getContext();
810 IsLittleEndian, 0);
812 U->getFormParams().Format);
813
814
816 0, OffsetOnEntry,
817 CallSiteLocation);
818 ProcessLocationExpression(Expression);
819 return;
820 }
821
825 if (FormValue.getForm() == dwarf::DW_FORM_loclistx) {
826 std::optional<uint64_t> LoclistOffset = U->getLoclistOffset(Offset);
827 if (!LoclistOffset)
828 return;
829 Offset = *LoclistOffset;
830 }
832 if (std::optional BA = U->getBaseAddress())
836
837 auto ProcessLocationEntry = [&](const DWARFLocationEntry &Entry) {
838 if (Entry.Kind == dwarf::DW_LLE_base_address) {
840 return;
841 }
842 if (Entry.Kind == dwarf::DW_LLE_offset_pair) {
845 DWARFAddressRange Range{LowPC, HighPC, Entry.SectionIndex};
847 Range.SectionIndex = Entry.SectionIndex;
848 DWARFLocationExpression Loc{Range, Entry.Loc};
849 DWARFDataExtractor Data(Loc.Expr, IsLittleEndian,
850 U->getAddressByteSize());
851 DWARFExpression Expression(Data, U->getAddressByteSize());
852
853
855 --HighPC;
856
858 CallSiteLocation);
859 ProcessLocationExpression(Expression);
860 }
861 };
862 Error E = U->getLocationTable().visitLocationList(
863 &Offset, [&](const DWARFLocationEntry &E) {
864 ProcessLocationEntry(E);
865 return true;
866 });
867 if (E)
869 }
870}
871
872void LVDWARFReader::processLocationMember(dwarf::Attribute Attr,
873 const DWARFFormValue &FormValue,
874 const DWARFDie &Die,
875 uint64_t OffsetOnEntry) {
876
878
880 OffsetOnEntry);
881 else
882
883 processLocationList(Attr, FormValue, Die, OffsetOnEntry);
884}
885
886
888 const DWARFFormValue &FormValue) {
889
890
891
897 else
899
900
901 LVElement *Target = getElementForOffset(
903 Attr == dwarf::DW_AT_import || Attr == dwarf::DW_AT_type);
904
905 if (FormValue.getForm() == dwarf::DW_FORM_ref_addr) {
906 if (Target) {
907
908 Target->setIsGlobalReference();
909
910 removeGlobalOffset(Offset);
911 } else
912
913 addGlobalOffset(Offset);
914 }
915
916
917
918
919
920
921
922
923 switch (Attr) {
924 case dwarf::DW_AT_abstract_origin:
925 case dwarf::DW_AT_call_origin:
928 break;
929 case dwarf::DW_AT_extension:
932 break;
933 case dwarf::DW_AT_specification:
936 break;
937 case dwarf::DW_AT_import:
938 case dwarf::DW_AT_type:
940 break;
941 default:
942 break;
943 }
944}
945
946
948 LVElement *Element, bool IsType) {
949
950 LVElementEntry &Entry = ElementTable[Offset];
951 if (.Element) {
952 if (IsType)
953 Entry.Types.insert(Element);
954 else
955 Entry.References.insert(Element);
956 }
957 return Entry.Element;
958}
959
960Error LVDWARFReader::loadTargetInfo(const ObjectFile &Obj) {
961
962
963 Triple TT = Obj.makeTriple();
964
965
966 Expected Features = Obj.getFeatures();
967 SubtargetFeatures FeaturesValue;
968 if (!Features) {
970 FeaturesValue = SubtargetFeatures();
971 }
972 FeaturesValue = *Features;
973
974 StringRef CPU;
975 if (auto OptCPU = Obj.tryGetCPUName())
976 CPU = *OptCPU;
977
979}
980
981void LVDWARFReader::mapRangeAddress(const ObjectFile &Obj) {
982 for (auto Iter = Obj.symbol_begin(); Iter != Obj.symbol_end(); ++Iter) {
983 const SymbolRef &Symbol = *Iter;
984
985 ExpectedSymbolRef::Type TypeOrErr = Symbol.getType();
986 if (!TypeOrErr) {
988 continue;
989 }
990
991
994 continue;
995
996
997
998
999
1001 bool IsSTAB = false;
1002 if (MachO) {
1003 DataRefImpl SymDRI = Symbol.getRawDataRefImpl();
1004 uint8_t NType =
1008 IsSTAB = true;
1009 }
1010
1011 Expected<section_iterator> IterOrErr = Symbol.getSection();
1012 if (!IterOrErr) {
1014 continue;
1015 }
1017 if (Section == Obj.section_end())
1018 continue;
1019
1020
1021 Expected<uint64_t> AddressOrErr = Symbol.getAddress();
1022 if (!AddressOrErr) {
1024 continue;
1025 }
1026 uint64_t Address = *AddressOrErr;
1027
1028
1029 StringRef Name;
1030 Expected NameOrErr = Symbol.getName();
1031 if (!NameOrErr) {
1033 continue;
1034 }
1035 Name = *NameOrErr;
1036
1037
1038 Expected<uint32_t> FlagsOrErr = Symbol.getFlags();
1039 if (!FlagsOrErr) {
1041 continue;
1042 }
1043 uint32_t Flags = *FlagsOrErr;
1044
1045
1046
1047
1049 bool IsComdat =
1051
1052
1054 }
1055}
1056
1058
1060 OS << "LVType\n";
1062}
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:1059
std::string getRegisterName(LVSmall Opcode, ArrayRef< uint64_t > Operands) override
Definition LVDWARFReader.cpp:579
void sortScopes() override
Definition LVDWARFReader.cpp:1057
void setCUBaseAddress(LVAddress Address)
Error createScopes() override
Definition LVDWARFReader.cpp:606
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.