[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
Sun Aug 20 17:15:06 PDT 2017


This revision was automatically updated to reflect the committed changes.
dberris marked an inline comment as done.
Closed by commit rL311305: [XRay][tools] Support new kinds of instrumentation map entries (authored by dberris).

Repository:
  rL LLVM

https://reviews.llvm.org/D36819

Files:
  llvm/trunk/include/llvm/XRay/InstrumentationMap.h
  llvm/trunk/lib/XRay/InstrumentationMap.cpp
  llvm/trunk/test/tools/llvm-xray/X86/Inputs/all-sleds.o
  llvm/trunk/test/tools/llvm-xray/X86/extract-all-sledtypes.txt


Index: llvm/trunk/include/llvm/XRay/InstrumentationMap.h
===================================================================
--- llvm/trunk/include/llvm/XRay/InstrumentationMap.h
+++ llvm/trunk/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);
   }
 };
 
Index: llvm/trunk/test/tools/llvm-xray/X86/extract-all-sledtypes.txt
===================================================================
--- llvm/trunk/test/tools/llvm-xray/X86/extract-all-sledtypes.txt
+++ llvm/trunk/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}}
Index: llvm/trunk/lib/XRay/InstrumentationMap.cpp
===================================================================
--- llvm/trunk/lib/XRay/InstrumentationMap.cpp
+++ llvm/trunk/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));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36819.111916.patch
Type: text/x-patch
Size: 2480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170821/d3a822cb/attachment.bin>


More information about the llvm-commits mailing list