| 1 |
function foo:long (x:long) %{ /* bpf */ /* pure */ |
| 2 |
/* if x <= 10 then 50 else 100 */ |
| 3 |
0xd5, $x, -, _bar, 10; /* jsle $x, 10, _bar */ |
| 4 |
0xb7, $$, -, -, 100; /* mov $$, 100 */ |
| 5 |
florb, -, -, _done, -; /* TRIGGER ERROR */ |
| 6 |
label, _bar; |
| 7 |
0xb7, $$, -, -, 50; /* mov $$, 50 */ |
| 8 |
label, _done; |
| 9 |
/* 0xbf, $$, $$, -, -; /* dummy op */ |
| 10 |
%} |
| 11 |
|
| 12 |
function bar:long (x:long) { |
| 13 |
if (x <= 10) return 50 else return 100 |
| 14 |
} |
| 15 |
|
| 16 |
probe begin { |
| 17 |
printf("foo(1)=%d should be %d\n", foo(1), bar(1)) |
| 18 |
printf("foo(8)=%d should be %d\n", foo(8), bar(8)) |
| 19 |
printf("foo(15)=%d should be %d\n", foo(15), bar(15)) |
| 20 |
exit() |
| 21 |
} |