| extern "C" { | |
| /* register() is useless on Windows, because only SIGSEGV, SIGABRT and | |
| SIGILL can be handled by the process, and these signals can only be used | |
| with enable(), not using register() */ | |
| /* Using an alternative stack requires sigaltstack() | |
| and sigaction() SA_ONSTACK */ | |
| typedef struct sigaction _Py_sighandler_t; | |
| typedef PyOS_sighandler_t _Py_sighandler_t; | |
| struct faulthandler_user_signal { | |
| int enabled; | |
| PyObject *file; | |
| int fd; | |
| int all_threads; | |
| int chain; | |
| _Py_sighandler_t previous; | |
| PyInterpreterState *interp; | |
| }; | |
| struct _faulthandler_runtime_state { | |
| struct { | |
| int enabled; | |
| PyObject *file; | |
| int fd; | |
| int all_threads; | |
| PyInterpreterState *interp; | |
| void *exc_handler; | |
| } fatal_error; | |
| struct { | |
| PyObject *file; | |
| int fd; | |
| PY_TIMEOUT_T timeout_us; /* timeout in microseconds */ | |
| int repeat; | |
| PyInterpreterState *interp; | |
| int exit; | |
| char *header; | |
| size_t header_len; | |
| /* The main thread always holds this lock. It is only released when | |
| faulthandler_thread() is interrupted before this thread exits, or at | |
| Python exit. */ | |
| PyThread_type_lock cancel_event; | |
| /* released by child thread when joined */ | |
| PyThread_type_lock running; | |
| } thread; | |
| struct faulthandler_user_signal *user_signals; | |
| stack_t stack; | |
| stack_t old_stack; | |
| }; | |
| } | |