doc/SystemTap_Beginners_Guide/testsuite/systemtap.bpf/asm_tests/printf.stp
raw| 1 | function foo:long (x:long) %{ /* bpf */ /* calls:exit */ |
| 2 | 0xb5, $x, -, _skip, 20; /* jle n, 20, _skip */ |
| 3 | call, -, printf, "x = %d causing exit\n", $x; /* like error() */ |
| 4 | call, -, exit; |
| 5 | label, _skip; |
| 6 | call, -, printf, "x = %d not causing exit\n", $x; |
| 7 | 0xb7, $$, -, -, 0x0; /* mov $$, 0 */ |
| 8 | %} |
| 9 | |
| 10 | probe begin { |
| 11 | printf("U 'x = 10' should print:\n"); foo(10) |
| 12 | } |
| 13 | |
| 14 | probe kernel.function("vfs_read") { |
| 15 | printf("K 'x = 25' should print:\n"); foo(25) |
| 16 | } |