136
[darwin-xtools.git] / ld64 / unit-tests / test-cases / data-in-code / main.c
blob811449a764ca065cfdb4f91f3f40708ad8006f81
2 #include <stdio.h>
4 #define DTRACE_STRINGIFY(s) #s
5 #define DTRACE_TOSTRING(s) DTRACE_STRINGIFY(s)
7 #define DTRACE_NOPS \
8 "nop" "\n\t" \
9 "nop" "\n\t" \
10 "nop" "\n\t"
13 #define DTRACE_LAB(p, n) \
14 "__dtrace_probe$" DTRACE_TOSTRING(%=__LINE__) DTRACE_STRINGIFY(_##p##___##n)
16 #define DTRACE_LABEL(p, n) \
17 ".section __DATA, __data\n\t" \
18 ".globl " DTRACE_LAB(p, n) "\n\t" \
19 DTRACE_LAB(p, n) ":\n\t" ".long 1f""\n\t" \
20 ".text" "\n\t" \
21 "1:"
23 #define DTRACE_CALL(p,n) \
24 DTRACE_LABEL(p,n) \
25 DTRACE_NOPS
27 #define DTRACE_CALL0ARGS(provider, name) \
28 __asm volatile ( \
29 DTRACE_CALL(provider, name) \
30 : \
31 : \
34 int deadwood()
36 DTRACE_CALL0ARGS(__foo__, test2)
37 return 0;
41 int main() {
42 int a = 1;
44 while(a) {
45 DTRACE_CALL0ARGS(__foo__, test1)
48 return 0;