summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/XRay/InstrumentationMap.h6
-rw-r--r--llvm/lib/XRay/InstrumentationMap.cpp3
-rw-r--r--llvm/test/tools/llvm-xray/X86/Inputs/all-sleds.obin0 -> 2640 bytes
-rw-r--r--llvm/test/tools/llvm-xray/X86/extract-all-sledtypes.txt11
4 files changed, 18 insertions, 2 deletions
diff --git a/llvm/include/llvm/XRay/InstrumentationMap.h b/llvm/include/llvm/XRay/InstrumentationMap.h
index 0342da0a2f0..42bfca36a20 100644
--- a/llvm/include/llvm/XRay/InstrumentationMap.h
+++ b/llvm/include/llvm/XRay/InstrumentationMap.h
@@ -38,7 +38,7 @@ Expected<InstrumentationMap> loadInstrumentationMap(StringRef Filename);
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 ScalarEnumerationTraits<xray::SledEntry::FunctionKinds> {
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);
}
};
diff --git a/llvm/lib/XRay/InstrumentationMap.cpp b/llvm/lib/XRay/InstrumentationMap.cpp
index d9ce255bc68..a7d6600b0d8 100644
--- a/llvm/lib/XRay/InstrumentationMap.cpp
+++ b/llvm/lib/XRay/InstrumentationMap.cpp
@@ -104,7 +104,8 @@ loadELF64(StringRef Filename, object::OwningBinary<object::ObjectFile> &ObjFile,
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));
diff --git a/llvm/test/tools/llvm-xray/X86/Inputs/all-sleds.o b/llvm/test/tools/llvm-xray/X86/Inputs/all-sleds.o
new file mode 100644
index 00000000000..d36d2bb8226
--- /dev/null
+++ b/llvm/test/tools/llvm-xray/X86/Inputs/all-sleds.o
Binary files differ
diff --git a/llvm/test/tools/llvm-xray/X86/extract-all-sledtypes.txt b/llvm/test/tools/llvm-xray/X86/extract-all-sledtypes.txt
new file mode 100644
index 00000000000..a4ac925cbd6
--- /dev/null
+++ b/llvm/test/tools/llvm-xray/X86/extract-all-sledtypes.txt
@@ -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}}
OpenPOWER on IntegriCloud