aboutsummaryrefslogtreecommitdiff
path: root/lib/XRay/InstrumentationMap.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-10-23 17:51:42 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-10-23 17:51:42 +0000
commit1d5ae1026e831016fc29fd927877c86af904481f (patch)
tree2cdfd12620fcfa5d9e4a0389f85368e8e36f63f9 /lib/XRay/InstrumentationMap.cpp
parente6d1592492a3a379186bfb02bd0f4eda0669c0d5 (diff)
Notes
Diffstat (limited to 'lib/XRay/InstrumentationMap.cpp')
-rw-r--r--lib/XRay/InstrumentationMap.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/XRay/InstrumentationMap.cpp b/lib/XRay/InstrumentationMap.cpp
index fe5e941f7ea6..7453613c7038 100644
--- a/lib/XRay/InstrumentationMap.cpp
+++ b/lib/XRay/InstrumentationMap.cpp
@@ -67,10 +67,11 @@ loadObj(StringRef Filename, object::OwningBinary<object::ObjectFile> &ObjFile,
StringRef Contents = "";
const auto &Sections = ObjFile.getBinary()->sections();
auto I = llvm::find_if(Sections, [&](object::SectionRef Section) {
- StringRef Name = "";
- if (Section.getName(Name))
- return false;
- return Name == "xray_instr_map";
+ Expected<StringRef> NameOrErr = Section.getName();
+ if (NameOrErr)
+ return *NameOrErr == "xray_instr_map";
+ consumeError(NameOrErr.takeError());
+ return false;
});
if (I == Sections.end())
@@ -118,7 +119,7 @@ loadObj(StringRef Filename, object::OwningBinary<object::ObjectFile> &ObjFile,
"an XRay sled entry in ELF64."),
std::make_error_code(std::errc::executable_format_error));
- auto RelocateOrElse = [&](uint32_t Offset, uint64_t Address) {
+ auto RelocateOrElse = [&](uint64_t Offset, uint64_t Address) {
if (!Address) {
uint64_t A = I->getAddress() + C - Contents.bytes_begin() + Offset;
RelocMap::const_iterator R = Relocs.find(A);
@@ -136,10 +137,10 @@ loadObj(StringRef Filename, object::OwningBinary<object::ObjectFile> &ObjFile,
8);
Sleds.push_back({});
auto &Entry = Sleds.back();
- uint32_t OffsetPtr = 0;
- uint32_t AddrOff = OffsetPtr;
+ uint64_t OffsetPtr = 0;
+ uint64_t AddrOff = OffsetPtr;
Entry.Address = RelocateOrElse(AddrOff, Extractor.getU64(&OffsetPtr));
- uint32_t FuncOff = OffsetPtr;
+ uint64_t FuncOff = OffsetPtr;
Entry.Function = RelocateOrElse(FuncOff, Extractor.getU64(&OffsetPtr));
auto Kind = Extractor.getU8(&OffsetPtr);
static constexpr SledEntry::FunctionKinds Kinds[] = {