#! stap # Usage: set $1 to supply test address; -DMAXERRORS= # # Note that each test has to be in a separate probe, since an error # aborts the current probe, but others will continue. global hits @define fire_once(probeno, body) %( probe perf.sw.cpu_clock { probeno = @probeno if (hits[probeno] == 0) { hits[probeno] = 1 @body } } %) @define unreachable %( printf("REACHED_UNREACHABLE(%p,%d) at %s\n", $1, probeno, pp()); %) # Call after lines that should continue execution @define noerr %( printf("NOERR(%p) at %s\n", $1, pp()); %) @fire_once(0, println (kernel_string ($1)); @unreachable) @fire_once(1, println (kernel_long ($1)); @noerr) @fire_once(2, println (kernel_int($1)); @noerr) @fire_once(3, println (kernel_short ($1)); @noerr) @fire_once(4, println (kernel_char ($1)); @noerr) @fire_once(7, printf ("%m\n", $1); @unreachable) @fire_once(8, str = sprintf("%m", $1); printf ("%s\n", str); @unreachable) @fire_once(9, printf ("%M\n", $1); @unreachable) @fire_once(10, str = sprintf("%M", $1); printf ("%s\n", str); @unreachable) @fire_once(11, println (user_string ($1)); @noerr) @fire_once(12, println (user_string ($1,"")); @noerr) @fire_once(13, println (user_string_warn ($1)); @noerr) @fire_once(14, println (user_string_warn ($1, "")); @noerr) @fire_once(15, println (user_string_quoted ($1)); @noerr) @fire_once(16, println (user_string_n ($1, 5)); @unreachable) @fire_once(17, println (user_string_n ($1, 5, "")); @noerr) @fire_once(18, println (user_string_n_warn ($1, 5)); @noerr) @fire_once(19, println (user_string_n_warn ($1, 5, "")); @noerr) @fire_once(20, println (user_string_n_quoted ($1, 5)); @noerr) @fire_once(21, println (user_short ($1)); @noerr) @fire_once(22, println (user_short_warn ($1)); @noerr) @fire_once(23, println (user_int ($1)); @noerr) @fire_once(24, println (user_int_warn ($1)); @noerr) @fire_once(25, println (user_long ($1)); @noerr) @fire_once(26, println (user_long_warn ($1)); @noerr) @fire_once(27, println (user_char ($1)); @noerr) @fire_once(28, println (user_char_warn ($1)); @noerr) @fire_once(29, println (kernel_buffer_quoted($1, 5, 20)); @noerr) @fire_once(30, println (kernel_buffer_quoted_error($1, 5, 20)); @unreachable) @fire_once(33, println (user_buffer_quoted($1, 5, 20)); @noerr) @fire_once(34, println (user_buffer_quoted_error($1, 5, 20)); @unreachable) # Assume that by 3 seconds, all the above probes have been hit. probe timer.s(3) { print ("\n") exit () }