[llvm] r311305 - [XRay][tools] Support new kinds of instrumentation map entries
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 20 17:14:06 PDT 2017
Author: dberris
Date: Sun Aug 20 17:14:06 2017
New Revision: 311305
URL: http://llvm.org/viewvc/llvm-project?rev=311305&view=rev
Log:
[XRay][tools] Support new kinds of instrumentation map entries
Summary:
When extracting the instrumentation map from a binary, we should be able
to recognize the new kinds of instrumentation sleds we've been emitting
with the compiler using -fxray-instrument. This change adds a test for
all the kinds of sleds we currently support (sans the tail-call sled,
which is a bit harder to force in a simple prebuilt input).
Reviewers: kpw, dblaikie
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36819
Added:
llvm/trunk/test/tools/llvm-xray/X86/Inputs/all-sleds.o
llvm/trunk/test/tools/llvm-xray/X86/extract-all-sledtypes.txt
Modified:
llvm/trunk/include/llvm/XRay/InstrumentationMap.h
llvm/trunk/lib/XRay/InstrumentationMap.cpp
Modified: llvm/trunk/include/llvm/XRay/InstrumentationMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/XRay/InstrumentationMap.h?rev=311305&r1=311304&r2=311305&view=diff
==============================================================================
--- llvm/trunk/include/llvm/XRay/InstrumentationMap.h (original)
+++ llvm/trunk/include/llvm/XRay/InstrumentationMap.h Sun Aug 20 17:14:06 2017
@@ -38,7 +38,7 @@ Expected<InstrumentationMap> loadInstrum
struct SledEntry {
/// Each entry here represents the kinds of supported instrumentation map
/// entries.
- enum class FunctionKinds { ENTRY, EXIT, TAIL };
+ enum class FunctionKinds { ENTRY, EXIT, TAIL, LOG_ARGS_ENTER, CUSTOM_EVENT };
/// The address of the sled.
uint64_t Address;
@@ -106,6 +106,10 @@ template <> struct ScalarEnumerationTrai
IO.enumCase(Kind, "function-enter", xray::SledEntry::FunctionKinds::ENTRY);
IO.enumCase(Kind, "function-exit", xray::SledEntry::FunctionKinds::EXIT);
IO.enumCase(Kind, "tail-exit", xray::SledEntry::FunctionKinds::TAIL);
+ IO.enumCase(Kind, "log-args-enter",
+ xray::SledEntry::FunctionKinds::LOG_ARGS_ENTER);
+ IO.enumCase(Kind, "custom-event",
+ xray::SledEntry::FunctionKinds::CUSTOM_EVENT);
}
};
Modified: llvm/trunk/lib/XRay/InstrumentationMap.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/XRay/InstrumentationMap.cpp?rev=311305&r1=311304&r2=311305&view=diff
==============================================================================
--- llvm/trunk/lib/XRay/InstrumentationMap.cpp (original)
+++ llvm/trunk/lib/XRay/InstrumentationMap.cpp Sun Aug 20 17:14:06 2017
@@ -104,7 +104,8 @@ loadELF64(StringRef Filename, object::Ow
static constexpr SledEntry::FunctionKinds Kinds[] = {
SledEntry::FunctionKinds::ENTRY, SledEntry::FunctionKinds::EXIT,
SledEntry::FunctionKinds::TAIL,
- };
+ SledEntry::FunctionKinds::LOG_ARGS_ENTER,
+ SledEntry::FunctionKinds::CUSTOM_EVENT};
if (Kind >= sizeof(Kinds))
return errorCodeToError(
std::make_error_code(std::errc::executable_format_error));
Added: llvm/trunk/test/tools/llvm-xray/X86/Inputs/all-sleds.o
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-xray/X86/Inputs/all-sleds.o?rev=311305&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/llvm-xray/X86/Inputs/all-sleds.o (added) and llvm/trunk/test/tools/llvm-xray/X86/Inputs/all-sleds.o Sun Aug 20 17:14:06 2017 differ
Added: llvm/trunk/test/tools/llvm-xray/X86/extract-all-sledtypes.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-xray/X86/extract-all-sledtypes.txt?rev=311305&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-xray/X86/extract-all-sledtypes.txt (added)
+++ llvm/trunk/test/tools/llvm-xray/X86/extract-all-sledtypes.txt Sun Aug 20 17:14:06 2017
@@ -0,0 +1,11 @@
+# Test that we can extract all the sled types we know about. This is built with
+# a a file with functions always instrumented, and using the built-ins and
+# intrinsics supported by clang. Those are built with:
+#
+# clang++ -c all-sleds.cc -o all-sleds.o -fpic -std=c++11 -fxray-instrument
+#
+# RUN: llvm-xray extract %S/Inputs/all-sleds.o -s | FileCheck %s
+# CHECK-DAG: {{kind:.function-enter}}
+# CHECK-DAG: {{kind:.function-exit}}
+# CHECK-DAG: {{kind:.custom-event}}
+# CHECK-DAG: {{kind:.log-args-enter}}
More information about the llvm-commits
mailing list