LLVM: lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

17#include

18

19using namespace llvm;

20using namespace dwarf;

21

25 this->GnuStyle = GnuStyle;

26 Sets.clear();

30 Sets.push_back({});

31 Set &NewSet = Sets.back();

32

34 std::tie(NewSet.Length, NewSet.Format) = Data.getInitialLength(C);

35 if (C) {

36

37

38 Sets.pop_back();

41 "name lookup table at offset 0x%" PRIx64 " parsing failed: %s",

42 SetOffset, toString(C.takeError()).c_str()));

43 return;

44 }

45

49

53

54 if (C) {

55

56

57 RecoverableErrorHandler(

59 "name lookup table at offset 0x%" PRIx64

60 " does not have a complete header: %s",

61 SetOffset, toString(C.takeError()).c_str()));

62 continue;

63 }

64

65 while (C) {

67 if (DieRef == 0)

68 break;

69 uint8_t IndexEntryValue = GnuStyle ? SetData.getU8(C) : 0;

71 if (C)

74 }

75

76 if (C) {

79 "name lookup table at offset 0x%" PRIx64 " parsing failed: %s",

80 SetOffset, toString(C.takeError()).c_str()));

81 continue;

82 }

86 "name lookup table at offset 0x%" PRIx64

87 " has a terminator at offset 0x%" PRIx64

88 " before the expected end at 0x%" PRIx64,

89 SetOffset, C.tell() - OffsetSize, Offset - OffsetSize));

90 }

91}

92

94 for (const Set &S : Sets) {

96 OS << "length = " << format("0x%0*" PRIx64, OffsetDumpWidth, S.Length);

98 OS << ", version = " << format("0x%04x", S.Version);

99 OS << ", unit_offset = "

100 << format("0x%0*" PRIx64, OffsetDumpWidth, S.Offset);

101 OS << ", unit_size = " << format("0x%0*" PRIx64, OffsetDumpWidth, S.Size)

102 << '\n';

103 OS << (GnuStyle ? "Offset Linkage Kind Name\n"

104 : "Offset Name\n");

105

106 for (const Entry &E : S.Entries) {

108 if (GnuStyle) {

112 OS << format("%-8s", EntryLinkage.data()) << ' '

113 << format("%-8s", EntryKind.data()) << ' ';

114 }

115 OS << '\"' << E.Name << "\"\n";

116 }

117 }

118}

This file contains constants used for implementing Dwarf debug support.

void extract(DWARFDataExtractor Data, bool GnuStyle, function_ref< void(Error)> RecoverableErrorHandler)

void dump(raw_ostream &OS) const

Lightweight error class with error context and mandatory checking.

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

constexpr const char * data() const

data - Get a pointer to the start of the string (which may not be null terminated).

An efficient, type-erasing, non-owning reference to a callable.

This class implements an extremely fast bulk output stream that can only output to a stream.

StringRef GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage)

StringRef FormatString(DwarfFormat Format)

StringRef GDBIndexEntryKindString(GDBIndexEntryKind Kind)

@ C

The default llvm calling convention, compatible with C.

uint8_t getDwarfOffsetByteSize(DwarfFormat Format)

The size of a reference determined by the DWARF 32/64-bit format.

This is an optimization pass for GlobalISel generic memory operations.

Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)

Create formatted StringError object.

format_object< Ts... > format(const char *Fmt, const Ts &... Vals)

These are helper functions used to produce formatted output.

const char * toString(DWARFSectionKind Kind)

uint64_t SecOffset

Section offset from the beginning of the compilation unit.

StringRef Name

The name of the object as given by the DW_AT_name attribute of the referenced DIE.

dwarf::PubIndexEntryDescriptor Descriptor

An entry of the various gnu_pub* debug sections.

Each table consists of sets of variable length entries.

uint64_t Length

The total length of the entries for that set, not including the length field itself.

uint64_t Offset

The offset from the beginning of the .debug_info section of the compilation unit header referenced by...

dwarf::DwarfFormat Format

The DWARF format of the set.

std::vector< Entry > Entries

uint64_t Size

The size in bytes of the contents of the .debug_info section generated to represent that compilation ...

uint16_t Version

This number is specific to the name lookup table and is independent of the DWARF version number.

Describes an entry of the various gnu_pub* debug sections.

GDBIndexEntryLinkage Linkage