From b6657afbf2e4f85db5e0f27b359543c3577a8e23 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Fri, 5 May 2017 01:27:11 +0000 Subject: [XRay][compiler-rt] Add function id utilities for XRay Summary: This change allows us to provide users and implementers of XRay handlers a means of converting XRay function id's to addresses. This, in combination with the facilities provided in D32695, allows users to find out: - How many function id's there are defined in the current binary. - Get the address of the function associated with this function id. - Patch only specific functions according to their requirements. While we don't directly provide symbolization support in XRay, having the function's address lets users determine this information easily either during runtime, or offline with tools like 'addr2line'. Reviewers: dblaikie, echristo, pelikan Subscribers: kpw, llvm-commits Differential Revision: https://reviews.llvm.org/D32846 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302210 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/xray/xray_interface.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/xray/xray_interface.h b/include/xray/xray_interface.h index 469bfffe5..c90025e38 100644 --- a/include/xray/xray_interface.h +++ b/include/xray/xray_interface.h @@ -15,6 +15,7 @@ #define XRAY_XRAY_INTERFACE_H #include +#include extern "C" { @@ -86,6 +87,14 @@ extern XRayPatchingStatus __xray_patch_function(int32_t FuncId); /// result values. extern XRayPatchingStatus __xray_unpatch_function(int32_t FuncId); +/// This function returns the address of the function provided a valid function +/// id. We return 0 if we encounter any error, even if 0 may be a valid function +/// address. +extern uintptr_t __xray_function_address(int32_t FuncId); + +/// This function returns the maximum valid function id. Returns 0 if we +/// encounter errors (when there are no instrumented functions, etc.). +extern size_t __xray_max_function_id(); } -- cgit v1.2.3