llvm.org GIT mirror llvm / 5a082a4
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311305 91177308-0d34-0410-b5e6-96231b3b80d8 Dean Michael Berris 2 years ago
4 changed file(s) with 18 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
3737 struct SledEntry {
3838 /// Each entry here represents the kinds of supported instrumentation map
3939 /// entries.
40 enum class FunctionKinds { ENTRY, EXIT, TAIL };
40 enum class FunctionKinds { ENTRY, EXIT, TAIL, LOG_ARGS_ENTER, CUSTOM_EVENT };
4141
4242 /// The address of the sled.
4343 uint64_t Address;
105105 IO.enumCase(Kind, "function-enter", xray::SledEntry::FunctionKinds::ENTRY);
106106 IO.enumCase(Kind, "function-exit", xray::SledEntry::FunctionKinds::EXIT);
107107 IO.enumCase(Kind, "tail-exit", xray::SledEntry::FunctionKinds::TAIL);
108 IO.enumCase(Kind, "log-args-enter",
109 xray::SledEntry::FunctionKinds::LOG_ARGS_ENTER);
110 IO.enumCase(Kind, "custom-event",
111 xray::SledEntry::FunctionKinds::CUSTOM_EVENT);
108112 }
109113 };
110114
103103 static constexpr SledEntry::FunctionKinds Kinds[] = {
104104 SledEntry::FunctionKinds::ENTRY, SledEntry::FunctionKinds::EXIT,
105105 SledEntry::FunctionKinds::TAIL,
106 };
106 SledEntry::FunctionKinds::LOG_ARGS_ENTER,
107 SledEntry::FunctionKinds::CUSTOM_EVENT};
107108 if (Kind >= sizeof(Kinds))
108109 return errorCodeToError(
109110 std::make_error_code(std::errc::executable_format_error));
0 # Test that we can extract all the sled types we know about. This is built with
1 # a a file with functions always instrumented, and using the built-ins and
2 # intrinsics supported by clang. Those are built with:
3 #
4 # clang++ -c all-sleds.cc -o all-sleds.o -fpic -std=c++11 -fxray-instrument
5 #
6 # RUN: llvm-xray extract %S/Inputs/all-sleds.o -s | FileCheck %s
7 # CHECK-DAG: {{kind:.function-enter}}
8 # CHECK-DAG: {{kind:.function-exit}}
9 # CHECK-DAG: {{kind:.custom-event}}
10 # CHECK-DAG: {{kind:.log-args-enter}}