| 1 |
// stapbpf string manipulation -- store string in global from kernel space |
| 2 |
// XXX: the 'locking' scheme here is kind of dumb but it seems to work |
| 3 |
|
| 4 |
global counter = 0 |
| 5 |
global var |
| 6 |
global tab1 |
| 7 |
global tab2 |
| 8 |
|
| 9 |
@define test_print |
| 10 |
%( |
| 11 |
/* PR23816 Test even more %s in one printf */ |
| 12 |
printf("[%s%s%s%s]", "str0", var, tab1[17], tab2["key"]) |
| 13 |
%) |
| 14 |
|
| 15 |
probe begin { |
| 16 |
printf("BEGIN") |
| 17 |
} |
| 18 |
|
| 19 |
probe kernel.function("vfs_read") { |
| 20 |
if (counter == 0) { |
| 21 |
var = "str1" |
| 22 |
tab1[17] = "str2" |
| 23 |
tab2["key"] = "str3" |
| 24 |
printf("probe0") |
| 25 |
@test_print |
| 26 |
counter = 1 |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
probe kernel.function("vfs_read") { |
| 31 |
if (counter == 1) { |
| 32 |
printf("probe1") |
| 33 |
@test_print |
| 34 |
exit() |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
probe end { |
| 39 |
printf("end") |
| 40 |
@test_print |
| 41 |
printf("END\n") |
| 42 |
} |