sewardj | 134d1aa | 2006-01-20 14:21:28 +0000 | [diff] [blame] | 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. Except: the wrapped |
| 7 | function is in a different shared object. This causes some |
| 8 | additional complications on ppc64-linux, hence another test. */ |
| 9 | |
| 10 | extern void actual ( void ); |
| 11 | |
| 12 | /* The wrapper. The function being wrapped is in a .so with soname |
| 13 | "wrap7so.so". */ |
| 14 | void I_WRAP_SONAME_FNNAME_ZU(wrap7soZdso,actual) ( void ) |
| 15 | { |
sewardj | 5a6d7e4 | 2006-01-20 16:47:20 +0000 | [diff] [blame] | 16 | OrigFn fn; |
| 17 | VALGRIND_GET_ORIG_FN(fn); |
sewardj | 134d1aa | 2006-01-20 14:21:28 +0000 | [diff] [blame] | 18 | printf("wrapper-pre\n"); |
sewardj | 5a6d7e4 | 2006-01-20 16:47:20 +0000 | [diff] [blame] | 19 | CALL_FN_v_v(fn); |
sewardj | 134d1aa | 2006-01-20 14:21:28 +0000 | [diff] [blame] | 20 | printf("wrapper-post\n"); |
| 21 | } |
| 22 | |
| 23 | /* --------------- */ |
| 24 | |
| 25 | int main ( void ) |
| 26 | { |
| 27 | printf("starting\n"); |
| 28 | actual(); |
| 29 | return 0; |
| 30 | } |