| 1 |
#! stap |
| 2 |
# Usage: set $1 to supply test address; -DMAXERRORS=<many> |
| 3 |
# |
| 4 |
# Runs via testsuite/systemtap.stress/conversions.exp to check all these |
| 5 |
# statements with a variety of invalid address arguments. |
| 6 |
# |
| 7 |
# These are all expected to raise an ERROR or WARNING, or return |
| 8 |
# a dummy or placeholder value. |
| 9 |
# |
| 10 |
|
| 11 |
@define fire_once(probeno, body) %( |
| 12 |
probe begin { |
| 13 |
probeno = @probeno |
| 14 |
@body |
| 15 |
} |
| 16 |
%) |
| 17 |
|
| 18 |
# call after checks that should abort the probe |
| 19 |
@define unreachable %( |
| 20 |
printf("REACHED_UNREACHABLE(%p,%d) at %s\n", $1, probeno, pp()); |
| 21 |
%) |
| 22 |
|
| 23 |
# Call after lines that should continue execution |
| 24 |
@define noerr %( |
| 25 |
printf("NOERR(%p,%d) at %s\n", $1, probeno, pp()); |
| 26 |
%) |
| 27 |
|
| 28 |
probe begin(-1) { print ("\n") } |
| 29 |
@fire_once(0, println (kernel_string ($1)); @unreachable) |
| 30 |
@fire_once(1, println (kernel_long ($1)); @noerr) |
| 31 |
@fire_once(2, println (kernel_int($1)); @noerr) |
| 32 |
@fire_once(3, println (kernel_short ($1)); @noerr) |
| 33 |
@fire_once(4, println (kernel_char ($1)); @noerr) |
| 34 |
@fire_once(7, printf ("%m\n", $1); @unreachable) |
| 35 |
@fire_once(8, str = sprintf("%m", $1); printf ("%s\n", str); @unreachable) |
| 36 |
@fire_once(9, printf ("%M\n", $1); @unreachable) |
| 37 |
@fire_once(10, str = sprintf("%M", $1); printf ("%s\n", str); @unreachable) |
| 38 |
@fire_once(11, println (user_string ($1)); @noerr) |
| 39 |
@fire_once(12, println (user_string ($1,"<only suspected, not known>")); @noerr) |
| 40 |
@fire_once(13, println (user_string_warn ($1)); @noerr) |
| 41 |
@fire_once(14, println (user_string_warn ($1, "<only suspected, not known>")); @noerr) |
| 42 |
@fire_once(15, println (user_string_quoted ($1)); @noerr) |
| 43 |
@fire_once(16, println (user_string_n ($1, 5)); @unreachable) |
| 44 |
@fire_once(17, println (user_string_n ($1, 5, "<only suspected, not known>")); @noerr) |
| 45 |
@fire_once(18, println (user_string_n_warn ($1, 5)); @noerr) |
| 46 |
@fire_once(19, println (user_string_n_warn ($1, 5, "<only suspected, not known>")); @noerr) |
| 47 |
@fire_once(20, println (user_string_n_quoted ($1, 5)); @noerr) |
| 48 |
@fire_once(21, println (user_short ($1)); @noerr) |
| 49 |
@fire_once(22, println (user_short_warn ($1)); @noerr) |
| 50 |
@fire_once(23, println (user_int ($1)); @noerr) |
| 51 |
@fire_once(24, println (user_int_warn ($1)); @noerr) |
| 52 |
@fire_once(25, println (user_long ($1)); @noerr) |
| 53 |
@fire_once(26, println (user_long_warn ($1)); @noerr) |
| 54 |
@fire_once(27, println (user_char ($1)); @noerr) |
| 55 |
@fire_once(28, println (user_char_warn ($1)); @noerr) |
| 56 |
@fire_once(29, println (kernel_buffer_quoted($1, 5, 20)); @noerr) |
| 57 |
@fire_once(30, println (kernel_buffer_quoted_error($1, 5, 20)); @unreachable) |
| 58 |
@fire_once(33, println (user_buffer_quoted($1, 5, 20)); @noerr) |
| 59 |
@fire_once(34, println (user_buffer_quoted_error($1, 5, 20)); @unreachable) |
| 60 |
probe begin(1) { exit() } |