[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:13:38 PDT 2017


dberris updated this revision to Diff 111915.
dberris added a comment.

Update comment in test on how the input is generated.


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,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: 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.111915.patch
Type: text/x-patch
Size: 2340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170821/df7c1bce/attachment.bin>


More information about the llvm-commits mailing list