[PATCH] D51758: [Xray] tooling allow MachO format support
David CARLIER via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 9 22:02:02 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL341772: [Xray] tooling allow MachO format support (authored by devnexen, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D51758?vs=164601&id=164603#toc
Repository:
rL LLVM
https://reviews.llvm.org/D51758
Files:
llvm/trunk/lib/XRay/InstrumentationMap.cpp
llvm/trunk/test/tools/llvm-xray/X86/Inputs/instr-map-mach.o
llvm/trunk/test/tools/llvm-xray/X86/extract-instrmap-macho.ll
Index: llvm/trunk/test/tools/llvm-xray/X86/extract-instrmap-macho.ll
===================================================================
--- llvm/trunk/test/tools/llvm-xray/X86/extract-instrmap-macho.ll
+++ llvm/trunk/test/tools/llvm-xray/X86/extract-instrmap-macho.ll
@@ -0,0 +1,9 @@
+; This test makes sure we can extract the instrumentation map from an
+; XRay-instrumented object file.
+;
+; RUN: llvm-xray extract %S/Inputs/instr-map-mach.o -s | FileCheck %s
+
+; CHECK: ---
+; CHECK-NEXT: - { id: 1, address: 0x0000000000000000, function: 0x0000000000000000, kind: function-enter, always-instrument: true, function-name: 'task(void*)' }
+; CHECK-NEXT: - { id: 1, address: 0x0000000000000162, function: 0x0000000000000000, kind: function-exit, always-instrument: true, function-name: 'task(void*)' }
+; CHECK-NEXT: ...
Index: llvm/trunk/lib/XRay/InstrumentationMap.cpp
===================================================================
--- llvm/trunk/lib/XRay/InstrumentationMap.cpp
+++ llvm/trunk/lib/XRay/InstrumentationMap.cpp
@@ -47,18 +47,18 @@
}
static Error
-loadELF64(StringRef Filename, object::OwningBinary<object::ObjectFile> &ObjFile,
+loadObj(StringRef Filename, object::OwningBinary<object::ObjectFile> &ObjFile,
InstrumentationMap::SledContainer &Sleds,
InstrumentationMap::FunctionAddressMap &FunctionAddresses,
InstrumentationMap::FunctionAddressReverseMap &FunctionIds) {
InstrumentationMap Map;
// Find the section named "xray_instr_map".
- if (!ObjFile.getBinary()->isELF() ||
+ if ((!ObjFile.getBinary()->isELF() && !ObjFile.getBinary()->isMachO()) ||
!(ObjFile.getBinary()->getArch() == Triple::x86_64 ||
ObjFile.getBinary()->getArch() == Triple::ppc64le))
return make_error<StringError>(
- "File format not supported (only does ELF little endian 64-bit).",
+ "File format not supported (only does ELF and Mach-O little endian 64-bit).",
std::make_error_code(std::errc::not_supported));
StringRef Contents = "";
@@ -191,7 +191,7 @@
if (auto E = loadYAML(Fd, FileSize, Filename, Map.Sleds,
Map.FunctionAddresses, Map.FunctionIds))
return std::move(E);
- } else if (auto E = loadELF64(Filename, *ObjectFileOrError, Map.Sleds,
+ } else if (auto E = loadObj(Filename, *ObjectFileOrError, Map.Sleds,
Map.FunctionAddresses, Map.FunctionIds)) {
return std::move(E);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51758.164603.patch
Type: text/x-patch
Size: 2472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180910/c3a3ff87/attachment.bin>
More information about the llvm-commits
mailing list