From 14b2769a07473f9eca6ea1bc7f57bbefe1db46f4 Mon Sep 17 00:00:00 2001 From: Jie Yu Date: Mon, 9 Mar 2015 00:50:44 -0400 Subject: [PATCH] Supported the API change on PIN_CallApplicationFunction. --- pin.mk | 4 ++++ src/core/wrapper.hpp | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/pin.mk b/pin.mk index 6ba58717..5396251e 100644 --- a/pin.mk +++ b/pin.mk @@ -10,6 +10,10 @@ CONFIG_ROOT := $(PIN_ROOT)/source/tools/Config include $(CONFIG_ROOT)/makefile.config #include $(TOOLS_ROOT)/Config/makefile.default.rules +PIN_REVISION := $(shell $(PIN_ROOT)/pin -version | grep Rev | cut -d ' ' -f 3) +CFLAGS += -DCONFIG_PIN_REVISION=$(PIN_REVISION) +CXXFLAGS += -DCONFIG_PIN_REVISION=$(PIN_REVISION) + # Check if this is a PinPlay kit. ifneq ($(wildcard $(PIN_HOME)/extras/pinplay),) $(info *** Building with PinPlay kit ***) diff --git a/src/core/wrapper.hpp b/src/core/wrapper.hpp index 035388d0..059de901 100644 --- a/src/core/wrapper.hpp +++ b/src/core/wrapper.hpp @@ -146,6 +146,13 @@ class WrapperBase { #define ACCESSORS_NORET(NUM_ARGS) \ ARG_ACCESSORS(NUM_ARGS) +// NOTE: The API PIN_CallApplicationFunction changed from Rev 71293. +#if CONFIG_PIN_REVISION >= 71293 +#define CALL_ORIGINAL_PARAM NULL, +#else +#define CALL_ORIGINAL_PARAM +#endif + #define CALL_ORIGINAL(R, NUM_ARGS) \ void CallOriginal() { \ assert(ori_funptr_); \ @@ -154,6 +161,7 @@ class WrapperBase { tid_, \ CALLINGSTD_DEFAULT, \ ori_funptr_, \ + CALL_ORIGINAL_PARAM \ PIN_PARG(R), &ret_val_, \ PARGS(NUM_ARGS) \ PIN_PARG_END()); \ @@ -167,6 +175,7 @@ class WrapperBase { tid_, \ CALLINGSTD_DEFAULT, \ ori_funptr_, \ + CALL_ORIGINAL_PARAM \ PIN_PARG(void), \ PARGS(NUM_ARGS) \ PIN_PARG_END()); \