[PATCH] D36819: [XRay][tools] Support new kinds of instrumentation map entries
Dean Michael Berris via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 16 23:22:01 PDT 2017
dberris created this revision.
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).
https://reviews.llvm.org/D36819
Files:
include/llvm/XRay/InstrumentationMap.h
lib/XRay/InstrumentationMap.cpp
test/tools/llvm-xray/X86/Inputs/all-sleds.o
test/tools/llvm-xray/X86/extract-all-sledtypes.txt
Index: test/tools/llvm-xray/X86/extract-all-sledtypes.txt
===================================================================
--- /dev/null
+++ test/tools/llvm-xray/X86/extract-all-sledtypes.txt
@@ -0,0 +1,6 @@
+# Test that we can extract all the sled types we know about.
+# 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}}
Index: lib/XRay/InstrumentationMap.cpp
===================================================================
--- lib/XRay/InstrumentationMap.cpp
+++ lib/XRay/InstrumentationMap.cpp
@@ -104,7 +104,8 @@
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));
Index: include/llvm/XRay/InstrumentationMap.h
===================================================================
--- include/llvm/XRay/InstrumentationMap.h
+++ include/llvm/XRay/InstrumentationMap.h
@@ -38,7 +38,7 @@
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 @@
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);
}
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36819.111468.patch
Type: text/x-patch
Size: 2103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170817/c4fcc878/attachment.bin>
More information about the llvm-commits
mailing list