doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/const_value.c
raw| 1 | #include "sys/sdt.h" |
| 2 | |
| 3 | struct foo |
| 4 | { |
| 5 | const int i; |
| 6 | const long j; |
| 7 | }; |
| 8 | |
| 9 | typedef struct foo fooer; |
| 10 | |
| 11 | static int |
| 12 | bar (const int i, const long j) |
| 13 | { |
| 14 | return i * j; |
| 15 | } |
| 16 | |
| 17 | static int |
| 18 | func (int (*f) (const int, const long)) |
| 19 | { |
| 20 | const int a[] = { 17, 23 }; |
| 21 | const fooer baz = { .i = 2, .j = 21 }; |
| 22 | STAP_PROBE (test, constvalues); |
| 23 | return f(baz.i, baz.j); |
| 24 | } |
| 25 | |
| 26 | int |
| 27 | main (int argc, char *argv[], char *envp[]) |
| 28 | { |
| 29 | return func (&bar) - 42; |
| 30 | } |