LLVM: lib/DebugInfo/GSYM/ObjectFileTransformer.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

14

18

19using namespace llvm;

20using namespace gsym;

21

23

25

26 std::vector<uint8_t> UUID;

29 if (!MachUUID.empty())

30 UUID.assign(MachUUID.data(), MachUUID.data() + MachUUID.size());

32 const StringRef GNUBuildID(".note.gnu.build-id");

35 if (!SectNameOrErr) {

37 continue;

38 }

39 StringRef SectName(*SectNameOrErr);

40 if (SectName != GNUBuildID)

41 continue;

44 if (E)

45 BuildIDData = *E;

46 else {

48 continue;

49 }

50 DataExtractor Decoder(BuildIDData, Obj.makeTriple().isLittleEndian(), 8);

59 if (!UUIDBytes.empty()) {

60 auto Ptr = reinterpret_cast<const uint8_t *>(UUIDBytes.data());

61 UUID.assign(Ptr, Ptr + UUIDBytes.size());

62 }

63 }

64 }

65 }

67}

68

73

76

77

79

80

84 if (!SymType) {

86 continue;

87 }

89 if (!AddrOrErr)

90

92

95 continue;

96

97 constexpr bool NoCopy = false;

100 if (!Name) {

103 "ObjectFileTransformer: ");

104 else

106 continue;

107 }

108

109

110 if (IsMachO)

111 Name->consume_front("_");

114 }

117 *Out.GetOS() << "Loaded " << FunctionsAddedCount

118 << " functions from symbol table.\n";

120}

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

static std::vector< uint8_t > getUUID(const object::ObjectFile &Obj)

Definition ObjectFileTransformer.cpp:24

constexpr uint32_t NT_GNU_BUILD_ID_TAG

Definition ObjectFileTransformer.cpp:22

std::pair< llvm::MachO::Target, std::string > UUID

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 empty() const

empty - Check if the array is empty.

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.

reference get()

Returns a reference to the stored T value.

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

constexpr bool empty() const

empty - Check if the string is empty.

constexpr size_t size() const

size - Get the string size.

constexpr const char * data() const

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

GsymCreator is used to emit GSYM data to a stand alone file or section within a file.

LLVM_ABI void addFunctionInfo(FunctionInfo &&FI)

Add a function info to this GSYM creator.

LLVM_ABI uint32_t insertString(StringRef S, bool Copy=true)

Insert a string into the GSYM string table.

void setUUID(llvm::ArrayRef< uint8_t > UUIDBytes)

Set the UUID value.

LLVM_ABI size_t getNumFunctionInfos() const

Get the current number of FunctionInfo objects contained in this object.

LLVM_ABI bool IsValidTextAddress(uint64_t Addr) const

Check if an address is a valid code address.

static LLVM_ABI llvm::Error convert(const object::ObjectFile &Obj, OutputAggregator &Output, GsymCreator &Gsym)

Extract any object file data that is needed by the GsymCreator.

Definition ObjectFileTransformer.cpp:69

raw_ostream * GetOS() const

This class is the base class for all object file types.

This is a value type class that represents a single section in the list of sections in the object fil...

This is a value type class that represents a single symbol in the list of symbols in the object file.

constexpr size_t NameSize

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner={})

Log all errors (if any) in E to OS.

auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)

Get the size of a range.

decltype(auto) dyn_cast(const From &Val)

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

bool isa(const From &Val)

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

uint64_t alignTo(uint64_t Size, Align A)

Returns a multiple of A needed to store Size bytes.

void consumeError(Error Err)

Consume a Error without doing anything.

Function information in GSYM files encodes information for one contiguous address range.