35 if (DwarfVersion <= 4)
61 std::optional<int64_t> ImplicitConst;
66 " not found in abbrev section");
72 if (Form == dwarf::DW_FORM_string)
73 return InfoData.
getCStr(&InfoOffset);
76 case dwarf::DW_FORM_strx1:
77 StrIndex = InfoData.
getU8(&InfoOffset);
79 case dwarf::DW_FORM_strx2:
80 StrIndex = InfoData.
getU16(&InfoOffset);
82 case dwarf::DW_FORM_strx3:
83 StrIndex = InfoData.
getU24(&InfoOffset);
85 case dwarf::DW_FORM_strx4:
86 StrIndex = InfoData.
getU32(&InfoOffset);
88 case dwarf::DW_FORM_strx:
89 case dwarf::DW_FORM_GNU_str_index:
94 "string field must be encoded with one of the following: "
95 "DW_FORM_string, DW_FORM_strx, DW_FORM_strx1, DW_FORM_strx2, "
96 "DW_FORM_strx3, DW_FORM_strx4, or DW_FORM_GNU_str_index.");
99 uint64_t StrOffsetsOffset = 4 * StrIndex;
104 return StrData.
getCStr(&StrOffset);
112 if (Header.Version >= 5 && Header.UnitType != dwarf::DW_UT_split_compile)
114 std::string(
"unit type DW_UT_split_compile type not found in "
115 "debug_info header. Unexpected unit type 0x" +
116 utostr(Header.UnitType) +
" found"));
123 if (!AbbrevOffsetOrErr)
125 uint64_t AbbrevOffset = *AbbrevOffsetOrErr;
127 if (Tag != dwarf::DW_TAG_compile_unit)
130 AbbrevData.
getU8(&AbbrevOffset);
133 std::optional<int64_t> ImplicitConst;
137 case dwarf::DW_AT_name: {
139 Form, InfoData,
Offset, StrOffsets, Str, Header.Version);
145 case dwarf::DW_AT_GNU_dwo_name:
146 case dwarf::DW_AT_dwo_name: {
148 Form, InfoData,
Offset, StrOffsets, Str, Header.Version);
154 case dwarf::DW_AT_GNU_dwo_id:
155 Header.Signature = ImplicitConst ?
static_cast<uint64_t>(*ImplicitConst)
164 if (!Header.Signature)
166 ID.Signature = *Header.Signature;
185 return Index + DW_SECT_INFO;
191 const auto *Off = Entry.getContribution(
Kind);
194 return Section.substr(Off->getOffset(), Off->getLength());
201 bool &AnySectionOverflow) {
204 Twine(
" Section Contribution Offset overflow 4G. Previous Offset ") +
205 Twine(PrevOffset) +
Twine(
", After overflow offset ") +
212 AnySectionOverflow =
true;
224 bool &AnySectionOverflow) {
227 auto *
I =
E.getContributions();
230 auto P = TypeIndexEntries.
insert(std::make_pair(
E.getSignature(), TUEntry));
233 auto &Entry =
P.first->second;
235 Entry.Contributions[0] = {};
241 C.setOffset(
C.getOffset() +
I->getOffset());
242 C.setLength(
I->getLength());
245 auto &
C = Entry.Contributions[TypesContributionIndex];
250 C.setOffset(TypesOffset);
252 static_assert(
sizeof(OldOffset) ==
sizeof(TypesOffset));
253 TypesOffset +=
C.getLength();
254 if (OldOffset > TypesOffset) {
256 "Types", OverflowOptValue,
259 if (AnySectionOverflow) {
260 TypesOffset = OldOffset;
270 DWPSectionId OutputSection,
const std::vector<StringRef> &TypesSections,
282 C.setOffset(TypesOffset);
291 Offset = PrevOffset +
C.getLength32();
293 auto P = TypeIndexEntries.
insert(std::make_pair(Signature, Entry));
297 Out.
emitBytes(Types.substr(PrevOffset,
C.getLength32()));
299 TypesOffset +=
C.getLength32();
300 if (OldOffset > TypesOffset) {
302 "Types", OverflowOptValue,
305 if (AnySectionOverflow) {
306 TypesOffset = OldOffset;
317 std::string
Text =
"\'";
320 bool HasDWO = !DWOName.
empty();
321 bool HasDWP = !DWPName.
empty();
322 if (HasDWO || HasDWP) {
329 if (HasDWO && HasDWP)
331 if (!DWPName.
empty()) {
343 (
"failure while decompressing compressed section: '" + Name +
"', " +
363 UncompressedSections.emplace_back();
364 if (
Error E = Dec->resizeAndDecompress(UncompressedSections.back()))
367 Contents = UncompressedSections.
back();
375 std::string(
"duplicate DWO ID (") +
utohexstr(PrevE.first) +
") in " +
377 PrevE.second.DWOName) +
390 const uint64_t NewOffset = OffsetRemapping[OldOffset];
393 Out.
emitIntValue(NewOffset & NewOffsetMask, NewOffsetSize);
404 std::tie(Header.Length, Header.Format) =
412 "compile unit exceeds .debug_info section range: " +
422 if (Header.Version >= 5) {
425 MinHeaderLength = 16;
430 if (Header.Length < MinHeaderLength) {
432 utostr(MinHeaderLength) +
" got " +
433 utostr(Header.Length) +
".");
435 if (Header.Version >= 5) {
440 if (Header.UnitType == dwarf::DW_UT_split_type) {
442 MinHeaderLength += 4;
443 if (Header.Length < MinHeaderLength)
454 Header.HeaderSize =
Offset;
466 if (CurStrSection.
empty() || CurStrOffsetSection.
empty())
481 OffsetRemapping.
reserve(CurStrSection.
size() / 20);
495 while (
const char *S =
Data.getCStr(&LocalOffset)) {
497 OffsetRemapping[PrevOffset] = NewOffset;
500 NewOffset > UINT32_MAX) {
503 PrevOffset = LocalOffset;
516 "StrOffsetSection size is less than its header");
521 if (HeaderSize == 8) {
522 ContributionSize =
Data.getU32(&HeaderLengthOffset);
523 }
else if (HeaderSize == 16) {
525 HeaderLengthOffset += 4;
526 ContributionSize =
Data.getU64(&HeaderLengthOffset);
528 ContributionEnd = ContributionSize + HeaderLengthOffset;
531 if (OldOffsetSize == 4 && NewOffsetSize == 8) {
541 (ContributionSize - VersionPadSize) * 2 + VersionPadSize;
552 for (
auto &Pair : SectionLength) {
553 if (Pair.first == DW_SECT_STR_OFFSETS) {
554 Pair.second = NewLength + 12;
563 OldOffsetSize, NewOffsetSize);
567 assert(OldOffsetSize == NewOffsetSize);
579 for (
const auto &E : IndexEntries)
580 for (
size_t I = 0;
I != std::size(E.second.Contributions); ++
I)
581 if (ContributionOffsets[
I])
583 ? E.second.Contributions[
I].getOffset32()
584 : E.second.Contributions[
I].getLength32()),
592 if (IndexEntries.
empty())
595 unsigned Columns = 0;
596 for (
auto &
C : ContributionOffsets)
603 for (
const auto &
P : IndexEntries) {
606 auto HP = ((S >> 32) & Mask) | 1;
608 assert(S != IndexEntries.
begin()[Buckets[
H] - 1].first &&
623 for (
const auto &
I : Buckets)
627 for (
const auto &
I : Buckets)
631 for (
size_t I = 0;
I != ContributionOffsets.
size(); ++
I)
632 if (ContributionOffsets[
I])
646 {
"debug_info.dwo", {
DS_Info, DW_SECT_INFO}},
648 {
"debug_str_offsets.dwo", {
DS_StrOffsets, DW_SECT_STR_OFFSETS}},
651 {
"debug_line.dwo", {
DS_Line, DW_SECT_LINE}},
652 {
"debug_macro.dwo", {
DS_Macro, DW_SECT_MACRO}},
653 {
"debug_abbrev.dwo", {
DS_Abbrev, DW_SECT_ABBREV}},
654 {
"debug_loclists.dwo", {
DS_Loclists, DW_SECT_LOCLISTS}},
655 {
"debug_rnglists.dwo", {
DS_Rnglists, DW_SECT_RNGLISTS}},
663 const StringMap<std::pair<DWPSectionId, DWARFSectionKind>> &KnownSections,
668 std::vector<StringRef> &CurTypesSection,
669 std::vector<StringRef> &CurInfoSection,
StringRef &AbbrevSection,
675 if (Section.isVirtual())
692 Name = Name.substr(Name.find_first_not_of(
"._"));
694 auto SectionPair = KnownSections.find(Name);
695 if (SectionPair == KnownSections.end())
703 SectionLength.push_back(std::make_pair(
Kind, Contents.
size()));
704 if (
Kind == DW_SECT_ABBREV)
705 AbbrevSection = Contents;
710 CurStrOffsetSection = Contents;
713 CurStrSection = Contents;
716 CurTypesSection.push_back(Contents);
719 CurCUIndexSection = Contents;
722 CurTUIndexSection = Contents;
725 CurInfoSection.push_back(Contents);
745 uint32_t ContributionOffsets[8] = {};
749 bool AnySectionOverflow =
false;
756 std::deque<SmallString<32>> UncompressedSections;
758 bool MachineSet =
false;
760 for (
const auto &
Input : Inputs) {
764 [&](std::unique_ptr<ECError> EC) ->
Error {
765 return createFileError(Input, Error(std::move(EC)));
769 auto &Obj = *ErrOrObj->getBinary();
776 Out.
setOSABI(ELFObj->getEIdentOSABI());
777 }
else if (Obj.isWasm()) {
787 std::vector<StringRef> CurTypesSection;
788 std::vector<StringRef> CurInfoSection;
798 for (
const auto &Section : Obj.sections())
800 KnownSections, Section, Out, UncompressedSections,
801 ContributionOffsets, CurEntry, CurStrSection, CurStrOffsetSection,
802 CurTypesSection, CurInfoSection, AbbrevSection, CurCUIndexSection,
803 CurTUIndexSection, SectionLength))
806 if (CurInfoSection.empty())
817 IndexVersion =
Version < 5 ? 2 : 5;
819 }
else if (
Version != Header.Version) {
821 "incompatible DWARF compile unit version: " +
Input +
" (version " +
822 utostr(Header.Version) +
") and " + FirstInput.
str() +
" (version " +
827 Header.Version, SectionLength, StrOffsetsOptValue,
830 for (
auto Pair : SectionLength) {
834 uint32_t OldOffset = ContributionOffsets[Index];
836 if (OldOffset > ContributionOffsets[Index]) {
838 for (
auto &Section : Obj.sections()) {
839 if (SectionIndex == Index) {
841 OldOffset, ContributionOffsets[Index], *Section.getName(),
842 OverflowOptValue, AnySectionOverflow))
847 if (AnySectionOverflow)
854 if (CurCUIndexSection.
empty()) {
855 bool FoundCUUnit =
false;
859 while (Info.size() > UnitOffset) {
869 C.setOffset(InfoSectionOffset);
870 C.setLength(Header.Length + 4);
872 if (std::numeric_limits<uint32_t>::max() - InfoSectionOffset <
875 InfoSectionOffset, InfoSectionOffset +
C.getLength32(),
876 "debug_info", OverflowOptValue, AnySectionOverflow))
878 if (AnySectionOverflow) {
884 UnitOffset +=
C.getLength32();
885 if (Header.Version < 5 ||
886 Header.UnitType == dwarf::DW_UT_split_compile) {
888 Header, AbbrevSection,
889 Info.
substr(UnitOffset -
C.getLength32(),
C.getLength32()),
890 CurStrOffsetSection, CurStrSection);
894 const auto &
ID = *EID;
895 auto P = IndexEntries.
insert(std::make_pair(
ID.Signature, Entry));
898 P.first->second.Name =
ID.Name;
899 P.first->second.DWOName =
ID.DWOName;
902 }
else if (Header.UnitType == dwarf::DW_UT_split_type) {
903 auto P = TypeIndexEntries.
insert(
904 std::make_pair(*Header.Signature, Entry));
909 Info.substr(UnitOffset -
C.getLength32(),
C.getLength32()));
910 InfoSectionOffset +=
C.getLength32();
912 if (AnySectionOverflow)
919 if (IndexVersion == 2) {
922 Out, TypeIndexEntries,
DS_Types, CurTypesSection, CurEntry,
924 OverflowOptValue, AnySectionOverflow))
927 if (AnySectionOverflow)
932 if (CurInfoSection.size() != 1)
934 "info section in a .dwp file");
935 StringRef DwpSingleInfoSection = CurInfoSection.front();
938 DataExtractor CUIndexData(CurCUIndexSection, Obj.isLittleEndian());
939 if (!CUIndex.
parse(CUIndexData))
944 " and expecting " +
utostr(IndexVersion));
948 auto *
I = E.getContributions();
951 auto P = IndexEntries.
insert(std::make_pair(E.getSignature(), CurEntry));
967 const auto &
ID = *EID;
970 auto &NewEntry =
P.first->second;
971 NewEntry.Name =
ID.Name;
972 NewEntry.DWOName =
ID.DWOName;
973 NewEntry.DWPName =
Input;
979 C.setOffset(
C.getOffset() +
I->getOffset());
980 C.setLength(
I->getLength());
984 auto &
C = NewEntry.Contributions[Index];
986 C.setOffset(InfoSectionOffset);
987 InfoSectionOffset +=
C.getLength32();
990 if (!CurTUIndexSection.
empty()) {
996 TUSectionKind = DW_SECT_INFO;
998 TypeInputSection = DwpSingleInfoSection;
1001 if (CurTypesSection.size() != 1)
1003 "multiple type unit sections in .dwp file");
1007 TypeInputSection = CurTypesSection.front();
1011 DataExtractor TUIndexData(CurTUIndexSection, Obj.isLittleEndian());
1012 if (!TUIndex.
parse(TUIndexData))
1017 " and expecting " +
utostr(IndexVersion));
1019 unsigned TypesContributionIndex =
1022 Out, TypeIndexEntries, TUIndex, OutSection, TypeInputSection,
1023 CurEntry, ContributionOffsets[TypesContributionIndex],
1024 TypesContributionIndex, OverflowOptValue, AnySectionOverflow))
1027 if (AnySectionOverflow)
1035 ContributionOffsets[0] = 0;
1045 ContributionOffsets[0] = 1;
1053 return Out.
write(*OutputOS);
1066 struct SectionMeta {
1072 static constexpr SectionMeta Meta[] = {
1079 {
DS_Str,
".debug_str.dwo",
1089 struct OutputEntry {
1090 const SectionData *
Data;
1102 for (
const auto &M : Meta) {
1103 if (Sections[M.Id].empty())
1109 {&Sections[M.Id], M.Name, M.Flags, M.EntSize, NameOff, 0});
1114 Strtab.
append(
".strtab");
1117 Strtab.
append(
".symtab");
1130 constexpr uint64_t SymEntSize = 24;
1133 for (
auto &E : Entries) {
1135 Offset += E.Data->totalSize();
1142 Offset = SymtabOffset + SymEntSize;
1148 uint32_t SymtabIdx = StrtabIdx + 1;
1149 uint32_t NumSections = SymtabIdx + 1;
1153 0, SHTOffset, NumSections, StrtabIdx);
1156 for (
const auto &E : Entries)
1157 E.Data->writeTo(OS);
1167 uint64_t CurPos = SymtabOffset + SymEntSize;
1171 ELF::writeSectionHeader(Wr,
true, 0,
ELF::SHT_NULL, 0, 0, 0, 0, 0, 0, 0, 0);
1174 for (
const auto &E : Entries)
1176 0, E.FileOffset, E.Data->totalSize(), 0, 0, 1,
1181 StrtabOffset, Strtab.
size(), 0, 0, 1, 0);
1185 SymtabOffset, SymEntSize, StrtabIdx, 1, 8,
1197 static constexpr struct {
1202 {
DS_Loc,
".debug_loc.dwo"},
1207 {
DS_Str,
".debug_str.dwo"},
1216 OS.
write(
"\0asm", 4);
1221 for (
const auto &M : Meta) {
1222 const SectionData &SD = Sections[M.Id];
1226 size_t NameLen = strlen(M.Name);
1227 uint64_t PayloadSize = SD.totalSize();
1231 unsigned NameLenSize =
encodeULEB128(NameLen, NameLenEncoded);
1232 uint64_t SectionPayloadSize = NameLenSize + NameLen + PayloadSize;
1237 unsigned SizeLen =
encodeULEB128(SectionPayloadSize, SizeEncoded);
1238 OS.
write(
reinterpret_cast<const char *
>(SizeEncoded), SizeLen);
1241 OS.
write(
reinterpret_cast<const char *
>(NameLenEncoded), NameLenSize);
1242 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 Error handleCompressedSection(std::deque< SmallString< 32 > > &UncompressedSections, SectionRef Sec, StringRef Name, StringRef &Contents)
static std::string buildDWODescription(StringRef Name, StringRef DWPName, StringRef DWOName)
static Expected< uint64_t > getCUAbbrev(StringRef Abbrev, uint64_t AbbrCode)
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.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI bool readAbbrevAttribute(const DataExtractor &AbbrevData, uint64_t *Offset, dwarf::Attribute &Name, dwarf::Form &Form, std::optional< int64_t > &ImplicitConst)
Read the next (attribute, form) specification from an abbreviation declaration at Offset,...
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.
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.