| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# -g Guru mode. Enable parsing of unsafe expert-level constructs |
| 4 |
# like embedded C. |
| 5 |
# |
| 6 |
# -D NAME=VALUE |
| 7 |
# Add the given C preprocessor directive to the module Makefile. |
| 8 |
|
| 9 |
# Test '-g' and '-D'. The code below will give an error at |
| 10 |
# compilation stage unless 'FOO' is defined. |
| 11 |
|
| 12 |
stap $@ -g -p4 -DFOO=1 - <<EOF |
| 13 |
|
| 14 |
function footest:string() |
| 15 |
%{ |
| 16 |
#ifdef FOO |
| 17 |
strlcpy(STAP_RETVALUE, "footest called", MAXSTRINGLEN); |
| 18 |
#else |
| 19 |
#error undefined FOO |
| 20 |
#endif |
| 21 |
%} |
| 22 |
|
| 23 |
probe begin { |
| 24 |
printf("%s\n", footest()) |
| 25 |
exit() |
| 26 |
} |
| 27 |
|
| 28 |
EOF |