| static void sigsegv_handler(int sig __maybe_unused) |
| pr_debug("SIGSEGV is observed as expected, try to recover.\n"); |
| signal(SIGSEGV, SIG_DFL); |
| static void the_hook(void *_hook_flags) |
| int *hook_flags = _hook_flags; |
| /* Generate a segfault, test perf_hooks__recover */ |
| int test__perf_hooks(int subtest __maybe_unused) |
| signal(SIGSEGV, sigsegv_handler); |
| perf_hooks__set_hook("test", the_hook, &hook_flags); |
| perf_hooks__invoke_test(); |
| if (hook_flags != 1234) { |
| pr_debug("Setting failed: %d (%p)\n", hook_flags, &hook_flags); |
| /* the buggy hook is removed? */ |
| if (perf_hooks__get_hook("test")) |