33 if (DwarfVersion <= 4)
60 if (Form == dwarf::DW_FORM_string)
61 return InfoData.
getCStr(&InfoOffset);
64 case dwarf::DW_FORM_strx1:
65 StrIndex = InfoData.
getU8(&InfoOffset);
67 case dwarf::DW_FORM_strx2:
68 StrIndex = InfoData.
getU16(&InfoOffset);
70 case dwarf::DW_FORM_strx3:
71 StrIndex = InfoData.
getU24(&InfoOffset);
73 case dwarf::DW_FORM_strx4:
74 StrIndex = InfoData.
getU32(&InfoOffset);
76 case dwarf::DW_FORM_strx:
77 case dwarf::DW_FORM_GNU_str_index:
82 "string field must be encoded with one of the following: "
83 "DW_FORM_string, DW_FORM_strx, DW_FORM_strx1, DW_FORM_strx2, "
84 "DW_FORM_strx3, DW_FORM_strx4, or DW_FORM_GNU_str_index.");
87 uint64_t StrOffsetsOffset = 4 * StrIndex;
92 return StrData.
getCStr(&StrOffset);
100 if (Header.Version >= 5 && Header.UnitType != dwarf::DW_UT_split_compile)
102 std::string(
"unit type DW_UT_split_compile type not found in "
103 "debug_info header. Unexpected unit type 0x" +
104 utostr(Header.UnitType) +
" found"));
112 if (Tag != dwarf::DW_TAG_compile_unit)
115 AbbrevData.
getU8(&AbbrevOffset);
118 while ((Name = AbbrevData.
getULEB128(&AbbrevOffset)) |
121 (Name != 0 || Form != 0)) {
123 case dwarf::DW_AT_name: {
125 Form, InfoData,
Offset, StrOffsets, Str, Header.Version);
131 case dwarf::DW_AT_GNU_dwo_name:
132 case dwarf::DW_AT_dwo_name: {
134 Form, InfoData,
Offset, StrOffsets, Str, Header.Version);
140 case dwarf::DW_AT_GNU_dwo_id:
149 if (!Header.Signature)
151 ID.Signature = *Header.Signature;
170 return Index + DW_SECT_INFO;
176 const auto *Off = Entry.getContribution(
Kind);
179 return Section.substr(Off->getOffset(), Off->getLength());
186 bool &AnySectionOverflow) {
189 Twine(
" Section Contribution Offset overflow 4G. Previous Offset ") +
190 Twine(PrevOffset) +
Twine(
", After overflow offset ") +
197 AnySectionOverflow =
true;
209 bool &AnySectionOverflow) {
212 auto *
I =
E.getContributions();
215 auto P = TypeIndexEntries.
insert(std::make_pair(
E.getSignature(), TUEntry));
218 auto &Entry =
P.first->second;
220 Entry.Contributions[0] = {};
226 C.setOffset(
C.getOffset() +
I->getOffset());
227 C.setLength(
I->getLength());
230 auto &
C = Entry.Contributions[TypesContributionIndex];
235 C.setOffset(TypesOffset);
237 static_assert(
sizeof(OldOffset) ==
sizeof(TypesOffset));
238 TypesOffset +=
C.getLength();
239 if (OldOffset > TypesOffset) {
241 "Types", OverflowOptValue,
244 if (AnySectionOverflow) {
245 TypesOffset = OldOffset;
255 DWPSectionId OutputSection,
const std::vector<StringRef> &TypesSections,
267 C.setOffset(TypesOffset);
276 Offset = PrevOffset +
C.getLength32();
278 auto P = TypeIndexEntries.
insert(std::make_pair(Signature, Entry));
282 Out.
emitBytes(Types.substr(PrevOffset,
C.getLength32()));
284 TypesOffset +=
C.getLength32();
285 if (OldOffset > TypesOffset) {
287 "Types", OverflowOptValue,
290 if (AnySectionOverflow) {
291 TypesOffset = OldOffset;
302 std::string Text =
"\'";
305 bool HasDWO = !DWOName.
empty();
306 bool HasDWP = !DWPName.
empty();
307 if (HasDWO || HasDWP) {
314 if (HasDWO && HasDWP)
316 if (!DWPName.
empty()) {
328 (
"failure while decompressing compressed section: '" + Name +
"', " +
348 UncompressedSections.emplace_back();
349 if (
Error E = Dec->resizeAndDecompress(UncompressedSections.back()))
352 Contents = UncompressedSections.
back();
360 std::string(
"duplicate DWO ID (") +
utohexstr(PrevE.first) +
") in " +
362 PrevE.second.DWOName) +
375 const uint64_t NewOffset = OffsetRemapping[OldOffset];
378 Out.
emitIntValue(NewOffset & NewOffsetMask, NewOffsetSize);
389 std::tie(Header.Length, Header.Format) =
397 "compile unit exceeds .debug_info section range: " +
407 if (Header.Version >= 5) {
410 MinHeaderLength = 16;
415 if (Header.Length < MinHeaderLength) {
417 utostr(MinHeaderLength) +
" got " +
418 utostr(Header.Length) +
".");
420 if (Header.Version >= 5) {
425 if (Header.UnitType == dwarf::DW_UT_split_type) {
427 MinHeaderLength += 4;
428 if (Header.Length < MinHeaderLength)
439 Header.HeaderSize =
Offset;
451 if (CurStrSection.
empty() || CurStrOffsetSection.
empty())
466 OffsetRemapping.
reserve(CurStrSection.
size() / 20);
479 while (
const char *S =
Data.getCStr(&LocalOffset)) {
481 OffsetRemapping[PrevOffset] = NewOffset;
484 NewOffset > UINT32_MAX) {
487 PrevOffset = LocalOffset;
500 "StrOffsetSection size is less than its header");
505 if (HeaderSize == 8) {
506 ContributionSize =
Data.getU32(&HeaderLengthOffset);
507 }
else if (HeaderSize == 16) {
509 HeaderLengthOffset += 4;
510 ContributionSize =
Data.getU64(&HeaderLengthOffset);
512 ContributionEnd = ContributionSize + HeaderLengthOffset;
515 if (OldOffsetSize == 4 && NewOffsetSize == 8) {
525 (ContributionSize - VersionPadSize) * 2 + VersionPadSize;
536 for (
auto &Pair : SectionLength) {
537 if (Pair.first == DW_SECT_STR_OFFSETS) {
538 Pair.second = NewLength + 12;
547 OldOffsetSize, NewOffsetSize);
551 assert(OldOffsetSize == NewOffsetSize);
563 for (
const auto &E : IndexEntries)
564 for (
size_t I = 0;
I != std::size(E.second.Contributions); ++
I)
565 if (ContributionOffsets[
I])
567 ? E.second.Contributions[
I].getOffset32()
568 : E.second.Contributions[
I].getLength32()),
576 if (IndexEntries.
empty())
579 unsigned Columns = 0;
580 for (
auto &
C : ContributionOffsets)
587 for (
const auto &
P : IndexEntries) {
590 auto HP = ((S >> 32) & Mask) | 1;
592 assert(S != IndexEntries.
begin()[Buckets[
H] - 1].first &&
607 for (
const auto &
I : Buckets)
611 for (
const auto &
I : Buckets)
615 for (
size_t I = 0;
I != ContributionOffsets.
size(); ++
I)
616 if (ContributionOffsets[
I])
630 {
"debug_info.dwo", {
DS_Info, DW_SECT_INFO}},
632 {
"debug_str_offsets.dwo", {
DS_StrOffsets, DW_SECT_STR_OFFSETS}},
635 {
"debug_line.dwo", {
DS_Line, DW_SECT_LINE}},
636 {
"debug_macro.dwo", {
DS_Macro, DW_SECT_MACRO}},
637 {
"debug_abbrev.dwo", {
DS_Abbrev, DW_SECT_ABBREV}},
638 {
"debug_loclists.dwo", {
DS_Loclists, DW_SECT_LOCLISTS}},
639 {
"debug_rnglists.dwo", {
DS_Rnglists, DW_SECT_RNGLISTS}},
647 const StringMap<std::pair<DWPSectionId, DWARFSectionKind>> &KnownSections,
652 std::vector<StringRef> &CurTypesSection,
653 std::vector<StringRef> &CurInfoSection,
StringRef &AbbrevSection,
659 if (Section.isVirtual())
676 Name = Name.substr(Name.find_first_not_of(
"._"));
678 auto SectionPair = KnownSections.find(Name);
679 if (SectionPair == KnownSections.end())
687 SectionLength.push_back(std::make_pair(
Kind, Contents.
size()));
688 if (
Kind == DW_SECT_ABBREV)
689 AbbrevSection = Contents;
694 CurStrOffsetSection = Contents;
697 CurStrSection = Contents;
700 CurTypesSection.push_back(Contents);
703 CurCUIndexSection = Contents;
706 CurTUIndexSection = Contents;
709 CurInfoSection.push_back(Contents);
729 uint32_t ContributionOffsets[8] = {};
733 bool AnySectionOverflow =
false;
740 std::deque<SmallString<32>> UncompressedSections;
742 bool MachineSet =
false;
744 for (
const auto &
Input : Inputs) {
748 [&](std::unique_ptr<ECError> EC) ->
Error {
749 return createFileError(Input, Error(std::move(EC)));
753 auto &Obj = *ErrOrObj->getBinary();
761 }
else if (Obj.isWasm()) {
771 std::vector<StringRef> CurTypesSection;
772 std::vector<StringRef> CurInfoSection;
782 for (
const auto &Section : Obj.sections())
784 KnownSections, Section, Out, UncompressedSections,
785 ContributionOffsets, CurEntry, CurStrSection, CurStrOffsetSection,
786 CurTypesSection, CurInfoSection, AbbrevSection, CurCUIndexSection,
787 CurTUIndexSection, SectionLength))
790 if (CurInfoSection.empty())
801 IndexVersion =
Version < 5 ? 2 : 5;
803 }
else if (
Version != Header.Version) {
805 "incompatible DWARF compile unit version: " +
Input +
" (version " +
806 utostr(Header.Version) +
") and " + FirstInput.
str() +
" (version " +
811 Header.Version, SectionLength, StrOffsetsOptValue,
814 for (
auto Pair : SectionLength) {
818 uint32_t OldOffset = ContributionOffsets[Index];
820 if (OldOffset > ContributionOffsets[Index]) {
822 for (
auto &Section : Obj.sections()) {
823 if (SectionIndex == Index) {
825 OldOffset, ContributionOffsets[Index], *Section.getName(),
826 OverflowOptValue, AnySectionOverflow))
831 if (AnySectionOverflow)
838 if (CurCUIndexSection.
empty()) {
839 bool FoundCUUnit =
false;
843 while (Info.size() > UnitOffset) {
853 C.setOffset(InfoSectionOffset);
854 C.setLength(Header.Length + 4);
856 if (std::numeric_limits<uint32_t>::max() - InfoSectionOffset <
859 InfoSectionOffset, InfoSectionOffset +
C.getLength32(),
860 "debug_info", OverflowOptValue, AnySectionOverflow))
862 if (AnySectionOverflow) {
868 UnitOffset +=
C.getLength32();
869 if (Header.Version < 5 ||
870 Header.UnitType == dwarf::DW_UT_split_compile) {
872 Header, AbbrevSection,
873 Info.
substr(UnitOffset -
C.getLength32(),
C.getLength32()),
874 CurStrOffsetSection, CurStrSection);
878 const auto &
ID = *EID;
879 auto P = IndexEntries.
insert(std::make_pair(
ID.Signature, Entry));
882 P.first->second.Name =
ID.Name;
883 P.first->second.DWOName =
ID.DWOName;
886 }
else if (Header.UnitType == dwarf::DW_UT_split_type) {
887 auto P = TypeIndexEntries.
insert(
888 std::make_pair(*Header.Signature, Entry));
893 Info.substr(UnitOffset -
C.getLength32(),
C.getLength32()));
894 InfoSectionOffset +=
C.getLength32();
896 if (AnySectionOverflow)
903 if (IndexVersion == 2) {
906 Out, TypeIndexEntries,
DS_Types, CurTypesSection, CurEntry,
908 OverflowOptValue, AnySectionOverflow))
911 if (AnySectionOverflow)
916 if (CurInfoSection.size() != 1)
918 "info section in a .dwp file");
919 StringRef DwpSingleInfoSection = CurInfoSection.front();
922 DataExtractor CUIndexData(CurCUIndexSection, Obj.isLittleEndian(), 0);
923 if (!CUIndex.
parse(CUIndexData))
928 " and expecting " +
utostr(IndexVersion));
932 auto *
I = E.getContributions();
935 auto P = IndexEntries.
insert(std::make_pair(E.getSignature(), CurEntry));
951 const auto &
ID = *EID;
954 auto &NewEntry =
P.first->second;
955 NewEntry.Name =
ID.Name;
956 NewEntry.DWOName =
ID.DWOName;
957 NewEntry.DWPName =
Input;
963 C.setOffset(
C.getOffset() +
I->getOffset());
964 C.setLength(
I->getLength());
968 auto &
C = NewEntry.Contributions[Index];
970 C.setOffset(InfoSectionOffset);
971 InfoSectionOffset +=
C.getLength32();
974 if (!CurTUIndexSection.
empty()) {
980 TUSectionKind = DW_SECT_INFO;
982 TypeInputSection = DwpSingleInfoSection;
985 if (CurTypesSection.size() != 1)
987 "multiple type unit sections in .dwp file");
991 TypeInputSection = CurTypesSection.front();
995 DataExtractor TUIndexData(CurTUIndexSection, Obj.isLittleEndian(), 0);
996 if (!TUIndex.
parse(TUIndexData))
1001 " and expecting " +
utostr(IndexVersion));
1003 unsigned TypesContributionIndex =
1006 Out, TypeIndexEntries, TUIndex, OutSection, TypeInputSection,
1007 CurEntry, ContributionOffsets[TypesContributionIndex],
1008 TypesContributionIndex, OverflowOptValue, AnySectionOverflow))
1011 if (AnySectionOverflow)
1019 ContributionOffsets[0] = 0;
1029 ContributionOffsets[0] = 1;
1037 return Out.
write(*OutputOS);
1050 struct SectionMeta {
1056 static constexpr SectionMeta Meta[] = {
1063 {
DS_Str,
".debug_str.dwo",
1073 struct OutputEntry {
1074 const SectionData *
Data;
1086 for (
const auto &M : Meta) {
1087 if (Sections[M.Id].empty())
1093 {&Sections[M.Id], M.Name, M.Flags, M.EntSize, NameOff, 0});
1098 Strtab.
append(
".strtab");
1101 Strtab.
append(
".symtab");
1114 constexpr uint64_t SymEntSize = 24;
1117 for (
auto &E : Entries) {
1119 Offset += E.Data->totalSize();
1126 Offset = SymtabOffset + SymEntSize;
1132 uint32_t SymtabIdx = StrtabIdx + 1;
1133 uint32_t NumSections = SymtabIdx + 1;
1137 0, SHTOffset, NumSections, StrtabIdx);
1140 for (
const auto &E : Entries)
1141 E.Data->writeTo(OS);
1151 uint64_t CurPos = SymtabOffset + SymEntSize;
1155 ELF::writeSectionHeader(Wr,
true, 0,
ELF::SHT_NULL, 0, 0, 0, 0, 0, 0, 0, 0);
1158 for (
const auto &E : Entries)
1160 0, E.FileOffset, E.Data->totalSize(), 0, 0, 1,
1165 StrtabOffset, Strtab.
size(), 0, 0, 1, 0);
1169 SymtabOffset, SymEntSize, StrtabIdx, 1, 8,
1181 static constexpr struct {
1186 {
DS_Loc,
".debug_loc.dwo"},
1191 {
DS_Str,
".debug_str.dwo"},
1200 OS.
write(
"\0asm", 4);
1205 for (
const auto &M : Meta) {
1206 const SectionData &SD = Sections[M.Id];
1210 size_t NameLen = strlen(M.Name);
1211 uint64_t PayloadSize = SD.totalSize();
1215 unsigned NameLenSize =
encodeULEB128(NameLen, NameLenEncoded);
1216 uint64_t SectionPayloadSize = NameLenSize + NameLen + PayloadSize;
1221 unsigned SizeLen =
encodeULEB128(SectionPayloadSize, SizeEncoded);
1222 OS.
write(
reinterpret_cast<const char *
>(SizeEncoded), SizeLen);
1225 OS.
write(
reinterpret_cast<const char *
>(NameLenEncoded), NameLenSize);
1226 OS.
write(M.Name, NameLen);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static unsigned getContributionIndex(DWARFSectionKind Kind, uint32_t IndexVersion)
static uint64_t getCUAbbrev(StringRef Abbrev, uint64_t AbbrCode)
static Error handleCompressedSection(std::deque< SmallString< 32 > > &UncompressedSections, SectionRef Sec, StringRef Name, StringRef &Contents)
static std::string buildDWODescription(StringRef Name, StringRef DWPName, StringRef DWOName)
static void writeNewOffsetsTo(DWPWriter &Out, DataExtractor &Data, DenseMap< uint64_t, uint64_t > &OffsetRemapping, uint64_t &Offset, const uint64_t Size, uint32_t OldOffsetSize, uint32_t NewOffsetSize)
static uint64_t debugStrOffsetsHeaderSize(DataExtractor StrOffsetsData, uint16_t DwarfVersion)
static Error addAllTypesFromTypesSection(DWPWriter &Out, MapVector< uint64_t, UnitIndexEntry > &TypeIndexEntries, DWPSectionId OutputSection, const std::vector< StringRef > &TypesSections, const UnitIndexEntry &CUEntry, uint32_t &TypesOffset, OnCuIndexOverflow OverflowOptValue, bool &AnySectionOverflow)
static Expected< const char * > getIndexedString(dwarf::Form Form, DataExtractor InfoData, uint64_t &InfoOffset, StringRef StrOffsets, StringRef Str, uint16_t Version)
static unsigned getOnDiskSectionId(unsigned Index)
static Expected< CompileUnitIdentifiers > getCUIdentifiers(InfoSectionUnitHeader &Header, StringRef Abbrev, StringRef Info, StringRef StrOffsets, StringRef Str)
static Error sectionOverflowErrorOrWarning(uint32_t PrevOffset, uint32_t OverflowedOffset, StringRef SectionName, OnCuIndexOverflow OverflowOptValue, bool &AnySectionOverflow)
static Error addAllTypesFromDWP(DWPWriter &Out, MapVector< uint64_t, UnitIndexEntry > &TypeIndexEntries, const DWARFUnitIndex &TUIndex, DWPSectionId OutputSection, StringRef Types, const UnitIndexEntry &TUEntry, uint32_t &TypesOffset, unsigned TypesContributionIndex, OnCuIndexOverflow OverflowOptValue, bool &AnySectionOverflow)
static StringRef getSubsection(StringRef Section, const DWARFUnitIndex::Entry &Entry, DWARFSectionKind Kind)
static bool isSupportedSectionKind(DWARFSectionKind Kind)
static Error buildDuplicateError(const std::pair< uint64_t, UnitIndexEntry > &PrevE, const CompileUnitIdentifiers &ID, StringRef DWPName)
OptimizedStructLayoutField Field
This file defines the SmallVector class.
static uint32_t getFlags(const Symbol *Sym)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
void setOffset(uint64_t Value)
void setLength(uint64_t Value)
uint32_t getLength32() const
uint64_t getOffset() const
uint32_t getVersion() const
LLVM_ABI bool parse(DataExtractor IndexData)
ArrayRef< DWARFSectionKind > getColumnKinds() const
ArrayRef< Entry > getRows() const
uint64_t getOffset(const char *Str, unsigned Length)
Direct ELF writer for DWP output, bypassing MCStreamer.
void switchSection(DWPSectionId Id)
Error write(raw_pwrite_stream &OS)
Error writeWASM(raw_pwrite_stream &OS)
void setMachine(uint16_t Machine)
Error writeELF(raw_pwrite_stream &OS)
void setOSABI(uint8_t OSABI)
void emitBytes(StringRef Data)
Zero-copy: stores a reference to the input data without copying.
void emitIntValue(uint64_t Value, unsigned Size)
SmallVectorImpl< char > & getSectionBuffer(DWPSectionId Id)
void reserve(size_type NumEntries)
Grow the densemap so that it can contain at least NumEntries items before resizing again.
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.
This class implements a map that also provides access to all stored values in a deterministic order.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
void append(StringRef RHS)
Append from a StringRef.
void reserve(size_type N)
void push_back(const T &Elt)
pointer data()
Return a pointer to the vector's buffer, even if empty().
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Represent a constant reference to a string, i.e.
std::string str() const
Get the contents as an std::string.
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
constexpr bool empty() const
Check if the string is empty.
char back() const
Get the last character in the string.
constexpr size_t size() const
Get the string size.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static LLVM_ABI void defaultWarningHandler(Error Warning)
Implement default handling for Warning.
static LLVM_ABI Expected< Decompressor > create(StringRef Name, StringRef Data, bool IsLE, bool Is64Bit)
Create decompressor object.
static Expected< OwningBinary< ObjectFile > > createObjectFile(StringRef ObjectPath)
This is a value type class that represents a single section in the list of sections in the object fil...
const ObjectFile * getObject() const
raw_ostream & write_zeros(unsigned NumZeros)
write_zeros - Insert 'NumZeros' nulls.
raw_ostream & write(unsigned char C)
An abstract base class for streams implementations that also support a pwrite operation.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ C
The default llvm calling convention, compatible with C.
void writeHeader(support::endian::Writer &W, bool Is64Bit, uint8_t OSABI, uint8_t ABIVersion, uint16_t EMachine, uint32_t EFlags, uint64_t SHOff, uint16_t SHNum, uint16_t SHStrNdx)
Write an ELF file header (Elf32_Ehdr or Elf64_Ehdr) for an ET_REL object.
void writeSectionHeader(support::endian::Writer &W, bool Is64Bit, uint32_t Name, uint32_t Type, uint64_t Flags, uint64_t Address, uint64_t Offset, uint64_t Size, uint32_t Link, uint32_t Info, uint64_t Alignment, uint64_t EntrySize)
Write a single ELF section header entry (Elf32_Shdr or Elf64_Shdr).
@ DW_LENGTH_DWARF64
Indicator of 64-bit DWARF format.
Error createError(const Twine &Err)
This is an optimization pass for GlobalISel generic memory operations.
Error createFileError(const Twine &F, Error E)
Concatenate a source file path and/or name with an Error.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Error handleErrors(Error E, HandlerTs &&... Hs)
Pass the ErrorInfo(s) contained in E to their respective handlers.
std::string utohexstr(uint64_t X, bool LowerCase=false, unsigned Width=0)
std::string utostr(uint64_t X, bool isNeg=false)
std::vector< std::pair< DWARFSectionKind, uint32_t > > SectionLengths
static void writeIndexTable(DWPWriter &Out, ArrayRef< unsigned > ContributionOffsets, const MapVector< uint64_t, UnitIndexEntry > &IndexEntries, const AccessField &Field)
DWARFSectionKind
The enum of section identifiers to be used in internal interfaces.
@ DW_SECT_EXT_unknown
Denotes a value read from an index section that does not correspond to any of the supported standards...
static void writeStringsAndOffsets(DWPWriter &Out, DWPStringPool &Strings, StringRef CurStrSection, StringRef CurStrOffsetSection, uint16_t Version, SectionLengths &SectionLength, const Dwarf64StrOffsetsPromotion StrOffsetsOptValue, bool SingleInput)
static Error handleSection(const StringMap< std::pair< DWPSectionId, DWARFSectionKind > > &KnownSections, const SectionRef &Section, DWPWriter &Out, std::deque< SmallString< 32 > > &UncompressedSections, uint32_t(&ContributionOffsets)[8], UnitIndexEntry &CurEntry, StringRef &CurStrSection, StringRef &CurStrOffsetSection, std::vector< StringRef > &CurTypesSection, std::vector< StringRef > &CurInfoSection, StringRef &AbbrevSection, StringRef &CurCUIndexSection, StringRef &CurTUIndexSection, SectionLengths &SectionLength)
LLVM_ABI uint32_t serializeSectionKind(DWARFSectionKind Kind, unsigned IndexVersion)
Convert the internal value for a section kind to an on-disk value.
FunctionAddr VTableAddr uintptr_t uintptr_t Version
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
static void writeIndex(DWPWriter &Out, DWPSectionId Section, ArrayRef< unsigned > ContributionOffsets, const MapVector< uint64_t, UnitIndexEntry > &IndexEntries, uint32_t IndexVersion)
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
std::string toString(const APInt &I, unsigned Radix, bool Signed, bool formatAsCLiteral=false, bool UpperCase=true, bool InsertSeparators=false)
LLVM_ABI Expected< InfoSectionUnitHeader > parseInfoSectionUnitHeader(StringRef Info)
unsigned encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a ULEB128 value to an output stream.
DWPSectionId
Section identifiers for DWP output.
static const StringMap< std::pair< DWPSectionId, DWARFSectionKind > > & getKnownSections()
Map input ELF section names to DWP section IDs and DWARF section kinds.
Dwarf64StrOffsetsPromotion
@ Always
Always emit .debug_str_offsets talbes as DWARF64 for testing.
@ Disabled
Don't do any conversion of .debug_str_offsets tables.
LLVM_ABI Error write(DWPWriter &Out, ArrayRef< std::string > Inputs, OnCuIndexOverflow OverflowOptValue, Dwarf64StrOffsetsPromotion StrOffsetsOptValue, raw_pwrite_stream *OS=nullptr)
constexpr uint64_t NextPowerOf2(uint64_t A)
Returns the next power of two (in 64-bits) that is strictly greater than A.
DWARFUnitIndex::Entry::SectionContribution Contributions[8]
Adapter to write values to a stream in a particular byte order.