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);
480 while (
const char *S =
Data.getCStr(&LocalOffset)) {
482 OffsetRemapping[PrevOffset] = NewOffset;
485 NewOffset > UINT32_MAX) {
488 PrevOffset = LocalOffset;
501 "StrOffsetSection size is less than its header");
506 if (HeaderSize == 8) {
507 ContributionSize =
Data.getU32(&HeaderLengthOffset);
508 }
else if (HeaderSize == 16) {
510 HeaderLengthOffset += 4;
511 ContributionSize =
Data.getU64(&HeaderLengthOffset);
513 ContributionEnd = ContributionSize + HeaderLengthOffset;
516 if (OldOffsetSize == 4 && NewOffsetSize == 8) {
526 (ContributionSize - VersionPadSize) * 2 + VersionPadSize;
537 for (
auto &Pair : SectionLength) {
538 if (Pair.first == DW_SECT_STR_OFFSETS) {
539 Pair.second = NewLength + 12;
548 OldOffsetSize, NewOffsetSize);
552 assert(OldOffsetSize == NewOffsetSize);
564 for (
const auto &E : IndexEntries)
565 for (
size_t I = 0;
I != std::size(E.second.Contributions); ++
I)
566 if (ContributionOffsets[
I])
568 ? E.second.Contributions[
I].getOffset32()
569 : E.second.Contributions[
I].getLength32()),
577 if (IndexEntries.
empty())
580 unsigned Columns = 0;
581 for (
auto &
C : ContributionOffsets)
588 for (
const auto &
P : IndexEntries) {
591 auto HP = ((S >> 32) & Mask) | 1;
593 assert(S != IndexEntries.
begin()[Buckets[
H] - 1].first &&
608 for (
const auto &
I : Buckets)
612 for (
const auto &
I : Buckets)
616 for (
size_t I = 0;
I != ContributionOffsets.
size(); ++
I)
617 if (ContributionOffsets[
I])
631 {
"debug_info.dwo", {
DS_Info, DW_SECT_INFO}},
633 {
"debug_str_offsets.dwo", {
DS_StrOffsets, DW_SECT_STR_OFFSETS}},
636 {
"debug_line.dwo", {
DS_Line, DW_SECT_LINE}},
637 {
"debug_macro.dwo", {
DS_Macro, DW_SECT_MACRO}},
638 {
"debug_abbrev.dwo", {
DS_Abbrev, DW_SECT_ABBREV}},
639 {
"debug_loclists.dwo", {
DS_Loclists, DW_SECT_LOCLISTS}},
640 {
"debug_rnglists.dwo", {
DS_Rnglists, DW_SECT_RNGLISTS}},
648 const StringMap<std::pair<DWPSectionId, DWARFSectionKind>> &KnownSections,
653 std::vector<StringRef> &CurTypesSection,
654 std::vector<StringRef> &CurInfoSection,
StringRef &AbbrevSection,
660 if (Section.isVirtual())
677 Name = Name.substr(Name.find_first_not_of(
"._"));
679 auto SectionPair = KnownSections.find(Name);
680 if (SectionPair == KnownSections.end())
688 SectionLength.push_back(std::make_pair(
Kind, Contents.
size()));
689 if (
Kind == DW_SECT_ABBREV)
690 AbbrevSection = Contents;
695 CurStrOffsetSection = Contents;
698 CurStrSection = Contents;
701 CurTypesSection.push_back(Contents);
704 CurCUIndexSection = Contents;
707 CurTUIndexSection = Contents;
710 CurInfoSection.push_back(Contents);
730 uint32_t ContributionOffsets[8] = {};
734 bool AnySectionOverflow =
false;
741 std::deque<SmallString<32>> UncompressedSections;
743 bool MachineSet =
false;
745 for (
const auto &
Input : Inputs) {
749 [&](std::unique_ptr<ECError> EC) ->
Error {
750 return createFileError(Input, Error(std::move(EC)));
754 auto &Obj = *ErrOrObj->getBinary();
761 Out.
setOSABI(ELFObj->getEIdentOSABI());
762 }
else if (Obj.isWasm()) {
772 std::vector<StringRef> CurTypesSection;
773 std::vector<StringRef> CurInfoSection;
783 for (
const auto &Section : Obj.sections())
785 KnownSections, Section, Out, UncompressedSections,
786 ContributionOffsets, CurEntry, CurStrSection, CurStrOffsetSection,
787 CurTypesSection, CurInfoSection, AbbrevSection, CurCUIndexSection,
788 CurTUIndexSection, SectionLength))
791 if (CurInfoSection.empty())
802 IndexVersion =
Version < 5 ? 2 : 5;
804 }
else if (
Version != Header.Version) {
806 "incompatible DWARF compile unit version: " +
Input +
" (version " +
807 utostr(Header.Version) +
") and " + FirstInput.
str() +
" (version " +
812 Header.Version, SectionLength, StrOffsetsOptValue,
815 for (
auto Pair : SectionLength) {
819 uint32_t OldOffset = ContributionOffsets[Index];
821 if (OldOffset > ContributionOffsets[Index]) {
823 for (
auto &Section : Obj.sections()) {
824 if (SectionIndex == Index) {
826 OldOffset, ContributionOffsets[Index], *Section.getName(),
827 OverflowOptValue, AnySectionOverflow))
832 if (AnySectionOverflow)
839 if (CurCUIndexSection.
empty()) {
840 bool FoundCUUnit =
false;
844 while (Info.size() > UnitOffset) {
854 C.setOffset(InfoSectionOffset);
855 C.setLength(Header.Length + 4);
857 if (std::numeric_limits<uint32_t>::max() - InfoSectionOffset <
860 InfoSectionOffset, InfoSectionOffset +
C.getLength32(),
861 "debug_info", OverflowOptValue, AnySectionOverflow))
863 if (AnySectionOverflow) {
869 UnitOffset +=
C.getLength32();
870 if (Header.Version < 5 ||
871 Header.UnitType == dwarf::DW_UT_split_compile) {
873 Header, AbbrevSection,
874 Info.
substr(UnitOffset -
C.getLength32(),
C.getLength32()),
875 CurStrOffsetSection, CurStrSection);
879 const auto &
ID = *EID;
880 auto P = IndexEntries.
insert(std::make_pair(
ID.Signature, Entry));
883 P.first->second.Name =
ID.Name;
884 P.first->second.DWOName =
ID.DWOName;
887 }
else if (Header.UnitType == dwarf::DW_UT_split_type) {
888 auto P = TypeIndexEntries.
insert(
889 std::make_pair(*Header.Signature, Entry));
894 Info.substr(UnitOffset -
C.getLength32(),
C.getLength32()));
895 InfoSectionOffset +=
C.getLength32();
897 if (AnySectionOverflow)
904 if (IndexVersion == 2) {
907 Out, TypeIndexEntries,
DS_Types, CurTypesSection, CurEntry,
909 OverflowOptValue, AnySectionOverflow))
912 if (AnySectionOverflow)
917 if (CurInfoSection.size() != 1)
919 "info section in a .dwp file");
920 StringRef DwpSingleInfoSection = CurInfoSection.front();
923 DataExtractor CUIndexData(CurCUIndexSection, Obj.isLittleEndian(), 0);
924 if (!CUIndex.
parse(CUIndexData))
929 " and expecting " +
utostr(IndexVersion));
933 auto *
I = E.getContributions();
936 auto P = IndexEntries.
insert(std::make_pair(E.getSignature(), CurEntry));
952 const auto &
ID = *EID;
955 auto &NewEntry =
P.first->second;
956 NewEntry.Name =
ID.Name;
957 NewEntry.DWOName =
ID.DWOName;
958 NewEntry.DWPName =
Input;
964 C.setOffset(
C.getOffset() +
I->getOffset());
965 C.setLength(
I->getLength());
969 auto &
C = NewEntry.Contributions[Index];
971 C.setOffset(InfoSectionOffset);
972 InfoSectionOffset +=
C.getLength32();
975 if (!CurTUIndexSection.
empty()) {
981 TUSectionKind = DW_SECT_INFO;
983 TypeInputSection = DwpSingleInfoSection;
986 if (CurTypesSection.size() != 1)
988 "multiple type unit sections in .dwp file");
992 TypeInputSection = CurTypesSection.front();
996 DataExtractor TUIndexData(CurTUIndexSection, Obj.isLittleEndian(), 0);
997 if (!TUIndex.
parse(TUIndexData))
1002 " and expecting " +
utostr(IndexVersion));
1004 unsigned TypesContributionIndex =
1007 Out, TypeIndexEntries, TUIndex, OutSection, TypeInputSection,
1008 CurEntry, ContributionOffsets[TypesContributionIndex],
1009 TypesContributionIndex, OverflowOptValue, AnySectionOverflow))
1012 if (AnySectionOverflow)
1020 ContributionOffsets[0] = 0;
1030 ContributionOffsets[0] = 1;
1038 return Out.
write(*OutputOS);
1051 struct SectionMeta {
1057 static constexpr SectionMeta Meta[] = {
1064 {
DS_Str,
".debug_str.dwo",
1074 struct OutputEntry {
1075 const SectionData *
Data;
1087 for (
const auto &M : Meta) {
1088 if (Sections[M.Id].empty())
1094 {&Sections[M.Id], M.Name, M.Flags, M.EntSize, NameOff, 0});
1099 Strtab.
append(
".strtab");
1102 Strtab.
append(
".symtab");
1115 constexpr uint64_t SymEntSize = 24;
1118 for (
auto &E : Entries) {
1120 Offset += E.Data->totalSize();
1127 Offset = SymtabOffset + SymEntSize;
1133 uint32_t SymtabIdx = StrtabIdx + 1;
1134 uint32_t NumSections = SymtabIdx + 1;
1138 0, SHTOffset, NumSections, StrtabIdx);
1141 for (
const auto &E : Entries)
1142 E.Data->writeTo(OS);
1152 uint64_t CurPos = SymtabOffset + SymEntSize;
1156 ELF::writeSectionHeader(Wr,
true, 0,
ELF::SHT_NULL, 0, 0, 0, 0, 0, 0, 0, 0);
1159 for (
const auto &E : Entries)
1161 0, E.FileOffset, E.Data->totalSize(), 0, 0, 1,
1166 StrtabOffset, Strtab.
size(), 0, 0, 1, 0);
1170 SymtabOffset, SymEntSize, StrtabIdx, 1, 8,
1182 static constexpr struct {
1187 {
DS_Loc,
".debug_loc.dwo"},
1192 {
DS_Str,
".debug_str.dwo"},
1201 OS.
write(
"\0asm", 4);
1206 for (
const auto &M : Meta) {
1207 const SectionData &SD = Sections[M.Id];
1211 size_t NameLen = strlen(M.Name);
1212 uint64_t PayloadSize = SD.totalSize();
1216 unsigned NameLenSize =
encodeULEB128(NameLen, NameLenEncoded);
1217 uint64_t SectionPayloadSize = NameLenSize + NameLen + PayloadSize;
1222 unsigned SizeLen =
encodeULEB128(SectionPayloadSize, SizeEncoded);
1223 OS.
write(
reinterpret_cast<const char *
>(SizeEncoded), SizeLen);
1226 OS.
write(
reinterpret_cast<const char *
>(NameLenEncoded), NameLenSize);
1227 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)
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
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.
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)
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.