wrap1.c revision d68ac3e974d25f88492774f6baa491999afde9f9
1 2#include <stdio.h> 3#include "valgrind.h" 4 5/* The simplest possible wrapping test: just call a wrapped function 6 and check we run the wrapper instead. */ 7 8/* The "original" function */ 9__attribute__((noinline)) 10void actual ( void ) 11{ 12 printf("in actual\n"); 13} 14 15/* The wrapper. Since this executable won't have a soname, we have to 16 use "NONE", since V treats any executable/.so which lacks a soname 17 as if its soname was "NONE". */ 18void I_WRAP_SONAME_FNNAME_ZU(NONE,actual) ( void ) 19{ 20 OrigFn orig; 21 VALGRIND_GET_ORIG_FN(orig); 22 printf("wrapper-pre\n"); 23 CALL_FN_v_v(orig); 24 printf("wrapper-post\n"); 25} 26 27/* --------------- */ 28 29int main ( void ) 30{ 31 printf("starting\n"); 32 actual(); 33 return 0; 34} 35