LLVM: lib/DWP/DWP.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

21#include

22

23using namespace llvm;

25

27

28

31 if (DwarfVersion <= 4)

32 return 0;

36 return 16;

37 return 8;

38}

39

54

58 if (Form == dwarf::DW_FORM_string)

59 return InfoData.getCStr(&InfoOffset);

61 switch (Form) {

62 case dwarf::DW_FORM_strx1:

63 StrIndex = InfoData.getU8(&InfoOffset);

64 break;

65 case dwarf::DW_FORM_strx2:

66 StrIndex = InfoData.getU16(&InfoOffset);

67 break;

68 case dwarf::DW_FORM_strx3:

69 StrIndex = InfoData.getU24(&InfoOffset);

70 break;

71 case dwarf::DW_FORM_strx4:

72 StrIndex = InfoData.getU32(&InfoOffset);

73 break;

74 case dwarf::DW_FORM_strx:

75 case dwarf::DW_FORM_GNU_str_index:

76 StrIndex = InfoData.getULEB128(&InfoOffset);

77 break;

78 default:

80 "string field must be encoded with one of the following: "

81 "DW_FORM_string, DW_FORM_strx, DW_FORM_strx1, DW_FORM_strx2, "

82 "DW_FORM_strx3, DW_FORM_strx4, or DW_FORM_GNU_str_index.");

83 }

84 DataExtractor StrOffsetsData(StrOffsets, true, 0);

85 uint64_t StrOffsetsOffset = 4 * StrIndex;

87

88 uint64_t StrOffset = StrOffsetsData.getU32(&StrOffsetsOffset);

90 return StrData.getCStr(&StrOffset);

91}

92

98 if (Header.Version >= 5 && Header.UnitType != dwarf::DW_UT_split_compile)

100 std::string("unit type DW_UT_split_compile type not found in "

101 "debug_info header. Unexpected unit type 0x" +

102 utostr(Header.UnitType) + " found"));

103

105

110 if (Tag != dwarf::DW_TAG_compile_unit)

112

113 AbbrevData.getU8(&AbbrevOffset);

116 while ((Name = AbbrevData.getULEB128(&AbbrevOffset)) |

118 AbbrevData.getULEB128(&AbbrevOffset))) &&

119 (Name != 0 || Form != 0)) {

120 switch (Name) {

121 case dwarf::DW_AT_name: {

123 Form, InfoData, Offset, StrOffsets, Str, Header.Version);

124 if (!EName)

126 ID.Name = *EName;

127 break;

128 }

129 case dwarf::DW_AT_GNU_dwo_name:

130 case dwarf::DW_AT_dwo_name: {

132 Form, InfoData, Offset, StrOffsets, Str, Header.Version);

133 if (!EName)

135 ID.DWOName = *EName;

136 break;

137 }

138 case dwarf::DW_AT_GNU_dwo_id:

140 break;

141 default:

143 Form, InfoData, &Offset,

144 dwarf::FormParams({Header.Version, Header.AddrSize, Header.Format}));

145 }

146 }

147 if (!Header.Signature)

149 ID.Signature = *Header.Signature;

150 return ID;

151}

152

156

157

158

164

165

166

168 return Index + DW_SECT_INFO;

169}

170

174 const auto *Off = Entry.getContribution(Kind);

175 if (!Off)

177 return Section.substr(Off->getOffset(), Off->getLength());

178}

179

184 bool &AnySectionOverflow) {

185 std::string Msg =

187 Twine(" Section Contribution Offset overflow 4G. Previous Offset ") +

188 Twine(PrevOffset) + Twine(", After overflow offset ") +

189 Twine(OverflowedOffset) + Twine("."))

190 .str();

195 AnySectionOverflow = true;

198 }

200}

201

206 unsigned TypesContributionIndex, OnCuIndexOverflow OverflowOptValue,

207 bool &AnySectionOverflow) {

210 auto *I = E.getContributions();

211 if (I)

212 continue;

213 auto P = TypeIndexEntries.insert(std::make_pair(E.getSignature(), TUEntry));

214 if (P.second)

215 continue;

216 auto &Entry = P.first->second;

217

218 Entry.Contributions[0] = {};

221 continue;

222 auto &C =

224 C.setOffset(C.getOffset() + I->getOffset());

225 C.setLength(I->getLength());

226 ++I;

227 }

228 auto &C = Entry.Contributions[TypesContributionIndex];

230 C.getOffset() -

232 C.getLength()));

233 C.setOffset(TypesOffset);

234 uint32_t OldOffset = TypesOffset;

235 static_assert(sizeof(OldOffset) == sizeof(TypesOffset));

236 TypesOffset += C.getLength();

237 if (OldOffset > TypesOffset) {

239 "Types", OverflowOptValue,

240 AnySectionOverflow))

241 return Err;

242 if (AnySectionOverflow) {

243 TypesOffset = OldOffset;

245 }

246 }

247 }

249}

250

253 MCSection *OutputTypes, const std::vector &TypesSections,

256 for (StringRef Types : TypesSections) {

262

265 C.setOffset(TypesOffset);

266 auto PrevOffset = Offset;

267

269

271 Data.getU32(&Offset);

273 auto Signature = Data.getU64(&Offset);

274 Offset = PrevOffset + C.getLength32();

275

276 auto P = TypeIndexEntries.insert(std::make_pair(Signature, Entry));

277 if (P.second)

278 continue;

279

280 Out.emitBytes(Types.substr(PrevOffset, C.getLength32()));

281 uint32_t OldOffset = TypesOffset;

282 TypesOffset += C.getLength32();

283 if (OldOffset > TypesOffset) {

285 "Types", OverflowOptValue,

286 AnySectionOverflow))

287 return Err;

288 if (AnySectionOverflow) {

289 TypesOffset = OldOffset;

291 }

292 }

293 }

294 }

296}

297

300 std::string Text = "\'";

301 Text += Name;

302 Text += '\'';

303 bool HasDWO = !DWOName.empty();

304 bool HasDWP = !DWPName.empty();

305 if (HasDWO || HasDWP) {

306 Text += " (from ";

307 if (HasDWO) {

308 Text += '\'';

309 Text += DWOName;

310 Text += '\'';

311 }

312 if (HasDWO && HasDWP)

313 Text += " in ";

314 if (!DWPName.empty()) {

315 Text += '\'';

316 Text += DWPName;

317 Text += '\'';

318 }

319 Text += ")";

320 }

321 return Text;

322}

323

326 ("failure while decompressing compressed section: '" + Name + "', " +

328 .str());

329}

330

335 if (!Obj ||

343 if (!Dec)

345

346 UncompressedSections.emplace_back();

347 if (Error E = Dec->resizeAndDecompress(UncompressedSections.back()))

349

350 Contents = UncompressedSections.back();

352}

353

354namespace llvm {

355

361 std::tie(Header.Length, Header.Format) =

363 if (Err)

366

369 "compile unit exceeds .debug_info section range: " +

371 }

372

373 Header.Version = InfoData.getU16(&Offset, &Err);

374 if (Err)

377

379 if (Header.Version >= 5) {

380

381

382 MinHeaderLength = 16;

383 } else {

384

385 MinHeaderLength = 7;

386 }

387 if (Header.Length < MinHeaderLength) {

389 utostr(MinHeaderLength) + " got " +

390 utostr(Header.Length) + ".");

391 }

392 if (Header.Version >= 5) {

393 Header.UnitType = InfoData.getU8(&Offset);

394 Header.AddrSize = InfoData.getU8(&Offset);

395 Header.DebugAbbrevOffset = InfoData.getU32(&Offset);

397 if (Header.UnitType == dwarf::DW_UT_split_type) {

398

399 MinHeaderLength += 4;

400 if (Header.Length < MinHeaderLength)

403 }

404 } else {

405

406

407 Header.DebugAbbrevOffset = InfoData.getU32(&Offset);

408 Header.AddrSize = InfoData.getU8(&Offset);

409 }

410

411 Header.HeaderSize = Offset;

412 return Header;

413}

414

419

420

421 const uint64_t NewOffsetMask = NewOffsetSize == 8 ? UINT64_MAX : UINT32_MAX;

424 const uint64_t NewOffset = OffsetRemapping[OldOffset];

425

426

427 Out.emitIntValue(NewOffset & NewOffsetMask, NewOffsetSize);

428 }

429}

430

436

437

438 if (CurStrSection.empty() || CurStrOffsetSection.empty())

439 return;

440

442

446

447

448

449

450

454 while (const char *S = Data.getCStr(&LocalOffset)) {

455 uint64_t NewOffset = Strings.getOffset(S, LocalOffset - PrevOffset);

456 OffsetRemapping[PrevOffset] = NewOffset;

457

459 NewOffset > UINT32_MAX) {

460 NewOffsetSize = 8;

461 }

462 PrevOffset = LocalOffset;

463 }

464

466

468

475 "StrOffsetSection size is less than its header");

476

477 uint64_t ContributionEnd = 0;

478 uint64_t ContributionSize = 0;

480 if (HeaderSize == 8) {

481 ContributionSize = Data.getU32(&HeaderLengthOffset);

482 } else if (HeaderSize == 16) {

483 OldOffsetSize = 8;

484 HeaderLengthOffset += 4;

485 ContributionSize = Data.getU64(&HeaderLengthOffset);

486 }

487 ContributionEnd = ContributionSize + HeaderLengthOffset;

488

490 if (OldOffsetSize == 4 && NewOffsetSize == 8) {

491

492

493

494

495

496

497

498 const uint64_t VersionPadSize = 4;

500 (ContributionSize - VersionPadSize) * 2 + VersionPadSize;

501

502

505

507

509

510

511 for (auto &Pair : SectionLength) {

512 if (Pair.first == DW_SECT_STR_OFFSETS) {

513 Pair.second = NewLength + 12;

514 break;

515 }

516 }

517 } else {

518

520 }

522 OldOffsetSize, NewOffsetSize);

523 }

524

525 } else {

526 assert(OldOffsetSize == NewOffsetSize);

528 NewOffsetSize);

529 }

530}

531

536 for (const auto &E : IndexEntries)

537 for (size_t I = 0; I != std::size(E.second.Contributions); ++I)

538 if (ContributionOffsets[I])

540 ? E.second.Contributions[I].getOffset32()

541 : E.second.Contributions[I].getLength32()),

542 4);

543}

544

549 if (IndexEntries.empty())

550 return;

551

552 unsigned Columns = 0;

553 for (auto &C : ContributionOffsets)

554 if (C)

555 ++Columns;

556

557 std::vector Buckets(NextPowerOf2(3 * IndexEntries.size() / 2));

558 uint64_t Mask = Buckets.size() - 1;

559 size_t I = 0;

560 for (const auto &P : IndexEntries) {

561 auto S = P.first;

562 auto H = S & Mask;

563 auto HP = ((S >> 32) & Mask) | 1;

564 while (Buckets[H]) {

565 assert(S != IndexEntries.begin()[Buckets[H] - 1].first &&

566 "Duplicate unit");

567 H = (H + HP) & Mask;

568 }

569 Buckets[H] = I + 1;

570 ++I;

571 }

572

574 Out.emitIntValue(IndexVersion, 4);

577 Out.emitIntValue(Buckets.size(), 4);

578

579

580 for (const auto &I : Buckets)

582

583

584 for (const auto &I : Buckets)

586

587

588 for (size_t I = 0; I != ContributionOffsets.size(); ++I)

589 if (ContributionOffsets[I])

591

592

594

595

597}

598

602 std::string("duplicate DWO ID (") + utohexstr(PrevE.first) + ") in " +

604 PrevE.second.DWOName) +

606}

607

609 const StringMap<std::pair<MCSection *, DWARFSectionKind>> &KnownSections,

617 std::vector &CurTypesSection,

618 std::vector &CurInfoSection, StringRef &AbbrevSection,

621 if (Section.isBSS())

623

624 if (Section.isVirtual())

626

628 if (!NameOrErr)

631

633 if (!ContentsOrErr)

634 return ContentsOrErr.takeError();

635 StringRef Contents = *ContentsOrErr;

636

638 Contents))

639 return Err;

640

641 Name = Name.substr(Name.find_first_not_of("._"));

642

643 auto SectionPair = KnownSections.find(Name);

644 if (SectionPair == KnownSections.end())

646

649 SectionLength.push_back(std::make_pair(Kind, Contents.size()));

650 }

651

652 if (Kind == DW_SECT_ABBREV) {

653 AbbrevSection = Contents;

654 }

655 }

656

657 MCSection *OutSection = SectionPair->second.first;

658 if (OutSection == StrOffsetSection)

659 CurStrOffsetSection = Contents;

660 else if (OutSection == StrSection)

661 CurStrSection = Contents;

662 else if (OutSection == TypesSection)

663 CurTypesSection.push_back(Contents);

664 else if (OutSection == CUIndexSection)

665 CurCUIndexSection = Contents;

666 else if (OutSection == TUIndexSection)

667 CurTUIndexSection = Contents;

668 else if (OutSection == InfoSection)

669 CurInfoSection.push_back(Contents);

670 else {

673 }

675}

676

681 MCSection *const StrSection = MCOFI.getDwarfStrDWOSection();

682 MCSection *const StrOffsetSection = MCOFI.getDwarfStrOffDWOSection();

683 MCSection *const TypesSection = MCOFI.getDwarfTypesDWOSection();

684 MCSection *const CUIndexSection = MCOFI.getDwarfCUIndexSection();

685 MCSection *const TUIndexSection = MCOFI.getDwarfTUIndexSection();

686 MCSection *const InfoSection = MCOFI.getDwarfInfoDWOSection();

688 {"debug_info.dwo", {InfoSection, DW_SECT_INFO}},

689 {"debug_types.dwo", {MCOFI.getDwarfTypesDWOSection(), DW_SECT_EXT_TYPES}},

690 {"debug_str_offsets.dwo", {StrOffsetSection, DW_SECT_STR_OFFSETS}},

691 {"debug_str.dwo", {StrSection, static_cast<DWARFSectionKind>(0)}},

692 {"debug_loc.dwo", {MCOFI.getDwarfLocDWOSection(), DW_SECT_EXT_LOC}},

693 {"debug_line.dwo", {MCOFI.getDwarfLineDWOSection(), DW_SECT_LINE}},

694 {"debug_macro.dwo", {MCOFI.getDwarfMacroDWOSection(), DW_SECT_MACRO}},

695 {"debug_abbrev.dwo", {MCOFI.getDwarfAbbrevDWOSection(), DW_SECT_ABBREV}},

696 {"debug_loclists.dwo",

697 {MCOFI.getDwarfLoclistsDWOSection(), DW_SECT_LOCLISTS}},

698 {"debug_rnglists.dwo",

699 {MCOFI.getDwarfRnglistsDWOSection(), DW_SECT_RNGLISTS}},

700 {"debug_cu_index", {CUIndexSection, static_cast<DWARFSectionKind>(0)}},

701 {"debug_tu_index", {TUIndexSection, static_cast<DWARFSectionKind>(0)}}};

702

705

706 uint32_t ContributionOffsets[8] = {};

710 bool AnySectionOverflow = false;

711

713

716

717 std::deque<SmallString<32>> UncompressedSections;

718

719 for (const auto &Input : Inputs) {

721 if (!ErrOrObj) {

723 [&](std::unique_ptr EC) -> Error {

724 return createFileError(Input, Error(std::move(EC)));

725 });

726 }

727

728 auto &Obj = *ErrOrObj->getBinary();

729 Objects.push_back(std::move(*ErrOrObj));

730

732

735 std::vector CurTypesSection;

736 std::vector CurInfoSection;

740

741

742

743

745

746 for (const auto &Section : Obj.sections())

748 KnownSections, StrSection, StrOffsetSection, TypesSection,

749 CUIndexSection, TUIndexSection, InfoSection, Section, Out,

750 UncompressedSections, ContributionOffsets, CurEntry,

751 CurStrSection, CurStrOffsetSection, CurTypesSection,

752 CurInfoSection, AbbrevSection, CurCUIndexSection,

753 CurTUIndexSection, SectionLength))

754 return Err;

755

756 if (CurInfoSection.empty())

757 continue;

758

761 if (!HeaderOrErr)

764

766 Version = Header.Version;

767 IndexVersion = Version < 5 ? 2 : 5;

768 FirstInput = Input;

769 } else if (Version != Header.Version) {

771 "incompatible DWARF compile unit version: " + Input + " (version " +

772 utostr(Header.Version) + ") and " + FirstInput.str() + " (version " +

774 }

775

777 CurStrOffsetSection, Header.Version, SectionLength,

778 StrOffsetsOptValue);

779

780 for (auto Pair : SectionLength) {

784 uint32_t OldOffset = ContributionOffsets[Index];

786 if (OldOffset > ContributionOffsets[Index]) {

788 for (auto &Section : Obj.sections()) {

789 if (SectionIndex == Index) {

791 OldOffset, ContributionOffsets[Index], *Section.getName(),

792 OverflowOptValue, AnySectionOverflow))

793 return Err;

794 }

795 ++SectionIndex;

796 }

797 if (AnySectionOverflow)

798 break;

799 }

800 }

801

802 uint32_t &InfoSectionOffset =

804 if (CurCUIndexSection.empty()) {

805 bool FoundCUUnit = false;

807 for (StringRef Info : CurInfoSection) {

809 while (Info.size() > UnitOffset) {

812 if (!HeaderOrError)

813 return HeaderOrError.takeError();

815

818 IndexVersion)];

819 C.setOffset(InfoSectionOffset);

820 C.setLength(Header.Length + 4);

821

822 if (std::numeric_limits<uint32_t>::max() - InfoSectionOffset <

823 C.getLength32()) {

825 InfoSectionOffset, InfoSectionOffset + C.getLength32(),

826 "debug_info", OverflowOptValue, AnySectionOverflow))

827 return Err;

828 if (AnySectionOverflow) {

829 FoundCUUnit = true;

830 break;

831 }

832 }

833

834 UnitOffset += C.getLength32();

835 if (Header.Version < 5 ||

836 Header.UnitType == dwarf::DW_UT_split_compile) {

838 Header, AbbrevSection,

839 Info.substr(UnitOffset - C.getLength32(), C.getLength32()),

840 CurStrOffsetSection, CurStrSection);

841

842 if (!EID)

844 const auto &ID = *EID;

845 auto P = IndexEntries.insert(std::make_pair(ID.Signature, Entry));

846 if (P.second)

848 P.first->second.Name = ID.Name;

849 P.first->second.DWOName = ID.DWOName;

850

851 FoundCUUnit = true;

852 } else if (Header.UnitType == dwarf::DW_UT_split_type) {

853 auto P = TypeIndexEntries.insert(

854 std::make_pair(*Header.Signature, Entry));

855 if (P.second)

856 continue;

857 }

859 Info.substr(UnitOffset - C.getLength32(), C.getLength32()));

860 InfoSectionOffset += C.getLength32();

861 }

862 if (AnySectionOverflow)

863 break;

864 }

865

866 if (!FoundCUUnit)

868

869 if (IndexVersion == 2) {

870

872 Out, TypeIndexEntries, TypesSection, CurTypesSection, CurEntry,

874 OverflowOptValue, AnySectionOverflow))

875 return Err;

876 }

877 if (AnySectionOverflow)

878 break;

879 continue;

880 }

881

882 if (CurInfoSection.size() != 1)

884 "info section in a .dwp file");

885 StringRef DwpSingleInfoSection = CurInfoSection.front();

886

888 DataExtractor CUIndexData(CurCUIndexSection, Obj.isLittleEndian(), 0);

889 if (!CUIndex.parse(CUIndexData))

891 if (CUIndex.getVersion() != IndexVersion)

894 " and expecting " + utostr(IndexVersion));

895

898 auto *I = E.getContributions();

899 if (I)

900 continue;

901 auto P = IndexEntries.insert(std::make_pair(E.getSignature(), CurEntry));

903 getSubsection(DwpSingleInfoSection, E, DW_SECT_INFO);

906 if (!HeaderOrError)

907 return HeaderOrError.takeError();

909

911 Header, getSubsection(AbbrevSection, E, DW_SECT_ABBREV),

912 CUInfoSection,

913 getSubsection(CurStrOffsetSection, E, DW_SECT_STR_OFFSETS),

914 CurStrSection);

915 if (!EID)

917 const auto &ID = *EID;

918 if (P.second)

920 auto &NewEntry = P.first->second;

921 NewEntry.Name = ID.Name;

922 NewEntry.DWOName = ID.DWOName;

923 NewEntry.DWPName = Input;

926 continue;

927 auto &C =

929 C.setOffset(C.getOffset() + I->getOffset());

930 C.setLength(I->getLength());

931 ++I;

932 }

934 auto &C = NewEntry.Contributions[Index];

936 C.setOffset(InfoSectionOffset);

937 InfoSectionOffset += C.getLength32();

938 }

939

940 if (!CurTUIndexSection.empty()) {

944

946 TUSectionKind = DW_SECT_INFO;

947 OutSection = InfoSection;

948 TypeInputSection = DwpSingleInfoSection;

949 } else {

950

951 if (CurTypesSection.size() != 1)

953 "multiple type unit sections in .dwp file");

954

956 OutSection = TypesSection;

957 TypeInputSection = CurTypesSection.front();

958 }

959

961 DataExtractor TUIndexData(CurTUIndexSection, Obj.isLittleEndian(), 0);

962 if (!TUIndex.parse(TUIndexData))

964 if (TUIndex.getVersion() != IndexVersion)

967 " and expecting " + utostr(IndexVersion));

968

969 unsigned TypesContributionIndex =

972 Out, TypeIndexEntries, TUIndex, OutSection, TypeInputSection,

973 CurEntry, ContributionOffsets[TypesContributionIndex],

974 TypesContributionIndex, OverflowOptValue, AnySectionOverflow))

975 return Err;

976 }

977 if (AnySectionOverflow)

978 break;

979 }

980

982

983

984

985 ContributionOffsets[0] = 0;

986 }

987 writeIndex(Out, MCOFI.getDwarfTUIndexSection(), ContributionOffsets,

988 TypeIndexEntries, IndexVersion);

989

991

992

994

995 ContributionOffsets[0] = 1;

996 }

997

998 writeIndex(Out, MCOFI.getDwarfCUIndexSection(), ContributionOffsets,

999 IndexEntries, IndexVersion);

1000

1002}

1003}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

Analysis containing CSE Info

static unsigned getContributionIndex(DWARFSectionKind Kind, uint32_t IndexVersion)

Definition DWP.cpp:159

static uint64_t getCUAbbrev(StringRef Abbrev, uint64_t AbbrCode)

Definition DWP.cpp:40

static Error handleCompressedSection(std::deque< SmallString< 32 > > &UncompressedSections, SectionRef Sec, StringRef Name, StringRef &Contents)

Definition DWP.cpp:332

static std::string buildDWODescription(StringRef Name, StringRef DWPName, StringRef DWOName)

Definition DWP.cpp:298

static uint64_t debugStrOffsetsHeaderSize(DataExtractor StrOffsetsData, uint16_t DwarfVersion)

Definition DWP.cpp:29

static Expected< const char * > getIndexedString(dwarf::Form Form, DataExtractor InfoData, uint64_t &InfoOffset, StringRef StrOffsets, StringRef Str, uint16_t Version)

Definition DWP.cpp:56

static Error addAllTypesFromTypesSection(MCStreamer &Out, MapVector< uint64_t, UnitIndexEntry > &TypeIndexEntries, MCSection *OutputTypes, const std::vector< StringRef > &TypesSections, const UnitIndexEntry &CUEntry, uint32_t &TypesOffset, OnCuIndexOverflow OverflowOptValue, bool &AnySectionOverflow)

Definition DWP.cpp:251

static unsigned getOnDiskSectionId(unsigned Index)

Definition DWP.cpp:167

static Expected< CompileUnitIdentifiers > getCUIdentifiers(InfoSectionUnitHeader &Header, StringRef Abbrev, StringRef Info, StringRef StrOffsets, StringRef Str)

Definition DWP.cpp:94

static Error sectionOverflowErrorOrWarning(uint32_t PrevOffset, uint32_t OverflowedOffset, StringRef SectionName, OnCuIndexOverflow OverflowOptValue, bool &AnySectionOverflow)

Definition DWP.cpp:180

static mc::RegisterMCTargetOptionsFlags MCTargetOptionsFlags

Definition DWP.cpp:26

static StringRef getSubsection(StringRef Section, const DWARFUnitIndex::Entry &Entry, DWARFSectionKind Kind)

Definition DWP.cpp:171

static bool isSupportedSectionKind(DWARFSectionKind Kind)

Definition DWP.cpp:153

static Error addAllTypesFromDWP(MCStreamer &Out, MapVector< uint64_t, UnitIndexEntry > &TypeIndexEntries, const DWARFUnitIndex &TUIndex, MCSection *OutputTypes, StringRef Types, const UnitIndexEntry &TUEntry, uint32_t &TypesOffset, unsigned TypesContributionIndex, OnCuIndexOverflow OverflowOptValue, bool &AnySectionOverflow)

Definition DWP.cpp:202

OptimizedStructLayoutField Field

static uint32_t getFlags(const Symbol *Sym)

The Input class is used to parse a yaml document into in-memory structs and vectors.

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

size_t size() const

size - Get the array size.

bool skipValue(DataExtractor DebugInfoData, uint64_t *OffsetPtr, const dwarf::FormParams Params) const

Skip a form's value in DebugInfoData at the offset specified by OffsetPtr.

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)

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.

const MCObjectFileInfo * getObjectFileInfo() const

Instances of this class represent a uniqued identifier for a section in the current translation unit.

Streaming machine code generation interface.

MCContext & getContext() const

virtual void emitIntValue(uint64_t Value, unsigned Size)

Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers.

virtual void switchSection(MCSection *Section, uint32_t Subsec=0)

Set the current section where code is being emitted to Section.

virtual void emitBytes(StringRef Data)

Emit the bytes in Data into the output.

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 reserve(size_type N)

void push_back(const T &Elt)

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",...

StringRef - Represent a constant reference to a string, i.e.

std::string str() const

str - 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

empty - Check if the string is empty.

char back() const

back - Get the last character in the string.

constexpr size_t size() const

size - 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

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

@ C

The default llvm calling convention, compatible with C.

@ DW_LENGTH_DWARF64

Indicator of 64-bit DWARF format.

Error createError(const Twine &Err)

This is an optimization pass for GlobalISel generic memory operations.

AccessField

Definition DWP.cpp:532

@ Offset

Definition DWP.cpp:532

@ Length

Definition DWP.cpp:532

Error createFileError(const Twine &F, Error E)

Concatenate a source file path and/or name with an Error.

LLVM_ABI Error buildDuplicateError(const std::pair< uint64_t, UnitIndexEntry > &PrevE, const CompileUnitIdentifiers &ID, StringRef DWPName)

Definition DWP.cpp:599

decltype(auto) dyn_cast(const From &Val)

dyn_cast - Return the argument parameter cast to the specified type.

LLVM_ABI void writeIndex(MCStreamer &Out, MCSection *Section, ArrayRef< unsigned > ContributionOffsets, const MapVector< uint64_t, UnitIndexEntry > &IndexEntries, uint32_t IndexVersion)

Definition DWP.cpp:545

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)

LLVM_ABI void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings, MCSection *StrOffsetSection, StringRef CurStrSection, StringRef CurStrOffsetSection, uint16_t Version)

std::string utostr(uint64_t X, bool isNeg=false)

std::vector< std::pair< DWARFSectionKind, uint32_t > > SectionLengths

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...

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

static void writeNewOffsetsTo(MCStreamer &Out, DataExtractor &Data, DenseMap< uint64_t, uint64_t > &OffsetRemapping, uint64_t &Offset, const uint64_t Size, uint32_t OldOffsetSize, uint32_t NewOffsetSize)

Definition DWP.cpp:415

bool isa(const From &Val)

isa - Return true if the parameter to the template is an instance of one of the template type argu...

LLVM_ABI Error handleSection(const StringMap< std::pair< MCSection *, DWARFSectionKind > > &KnownSections, const MCSection *StrSection, const MCSection *StrOffsetSection, const MCSection *TypesSection, const MCSection *CUIndexSection, const MCSection *TUIndexSection, const MCSection *InfoSection, const object::SectionRef &Section, MCStreamer &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)

Definition DWP.cpp:608

Error make_error(ArgTs &&... Args)

Make a Error instance representing failure using the given error info type.

FunctionAddr VTableAddr uintptr_t uintptr_t Data

void writeIndexTable(MCStreamer &Out, ArrayRef< unsigned > ContributionOffsets, const MapVector< uint64_t, UnitIndexEntry > &IndexEntries, const AccessField &Field)

Definition DWP.cpp:533

std::string toString(const APInt &I, unsigned Radix, bool Signed, bool formatAsCLiteral=false, bool UpperCase=true, bool InsertSeparators=false)

LLVM_ABI Error write(MCStreamer &Out, ArrayRef< std::string > Inputs, OnCuIndexOverflow OverflowOptValue, Dwarf64StrOffsetsPromotion StrOffsetsOptValue)

Definition DWP.cpp:677

LLVM_ABI Expected< InfoSectionUnitHeader > parseInfoSectionUnitHeader(StringRef Info)

Definition DWP.cpp:356

Dwarf64StrOffsetsPromotion

@ Always

Always emit .debug_str_offsets talbes as DWARF64 for testing.

@ Disabled

Don't do any conversion of .debug_str_offsets tables.

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]

A helper struct providing information about the byte size of DW_FORM values that vary in size dependi...

Create this object with static storage to register mc-related command line options.