doc/SystemTap_Beginners_Guide/testsuite/systemtap.bpf/asm_tests/unreachable.stp
raw| 1 | /* testcase for an early bug that would generate duplicate jump */ |
| 2 | function foo:long (x:long) %{ /* bpf */ |
| 3 | /* the code in the middle is unreachable */ |
| 4 | 0xd5, $x, -, _bar, 20; /* jsle $x, 20, _done */ |
| 5 | 0xb7, $$, -, -, 100; /* mov $$, 100 */ |
| 6 | 0x05, -, -, _done, -; |
| 7 | label, _bar; |
| 8 | 0xb7, $$, -, -, 50; /* mov $$, 50 */ |
| 9 | label, _done; |
| 10 | %} |
| 11 | |
| 12 | probe kernel.function("vfs_read") { |
| 13 | x = 10 |
| 14 | if (x > 12) printf("unreachable\n") |
| 15 | printf ("got %d (should be 50)\n", foo(x)) |
| 16 | exit() |
| 17 | } |