1 // RUN: %clangxx -O1 %s -o %t && %env_tool_opts=handle_sigtrap=1 %run %t 2>&1 | FileCheck %s
3 // __builtin_debugtrap() does not raise SIGTRAP on these platforms.
4 // UNSUPPORTED: target=s390{{.*}}
13 void handler(int signo
, siginfo_t
*info
, void *uctx
) {
14 fprintf(stderr
, "in_handler: %d\n", in_handler
);
16 // CHECK: in_handler: 1
21 struct sigaction a
= {}, old
= {};
22 a
.sa_sigaction
= handler
;
23 a
.sa_flags
= SA_SIGINFO
;
24 sigaction(SIGTRAP
, &a
, &old
);
27 sigaction(SIGTRAP
, 0, &a
);
28 assert(a
.sa_sigaction
== handler
);
29 assert(a
.sa_flags
& SA_SIGINFO
);
32 // Check that signal handler is not postponed by sanitizer.
33 // Don't use raise here as it calls any signal handler immediately.
34 __builtin_debugtrap();
37 fprintf(stderr
, "UNREACHABLE\n");