mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 06:53:33 +00:00
Make crash reports reliable in multithreaded case
This commit is contained in:
parent
3b0ea2db4d
commit
bf3531de81
3 changed files with 10 additions and 6 deletions
|
@ -192,6 +192,8 @@ void ShowCrashReportHook(int, int, int, struct siginfo *, ucontext_t *);
|
|||
|
||||
static relegated void ShowCrashReport(int err, int sig, struct siginfo *si,
|
||||
ucontext_t *ctx) {
|
||||
if (sig != SIGTRAP && sig != SIGQUIT)
|
||||
sigaddset(&ctx->uc_sigmask, sig);
|
||||
#pragma GCC push_options
|
||||
#pragma GCC diagnostic ignored "-Walloca-larger-than="
|
||||
long size = __get_safe_size(8192, 4096);
|
||||
|
|
|
@ -191,6 +191,8 @@ static relegated char *GetSymbolName(struct SymbolTable *st, int symbol) {
|
|||
|
||||
static relegated void __oncrash_impl(int sig, struct siginfo *si,
|
||||
ucontext_t *ctx) {
|
||||
if (sig != SIGTRAP && sig != SIGQUIT)
|
||||
sigaddset(&ctx->uc_sigmask, sig);
|
||||
#pragma GCC push_options
|
||||
#pragma GCC diagnostic ignored "-Walloca-larger-than="
|
||||
long size = __get_safe_size(10000, 4096);
|
||||
|
|
|
@ -85,13 +85,13 @@ void ShowCrashReports(void) {
|
|||
#ifdef __x86_64__
|
||||
InstallCrashHandler(SIGTRAP, 0);
|
||||
#else
|
||||
InstallCrashHandler(SIGTRAP, SA_RESETHAND);
|
||||
InstallCrashHandler(SIGTRAP, 0);
|
||||
#endif
|
||||
InstallCrashHandler(SIGFPE, SA_RESETHAND);
|
||||
InstallCrashHandler(SIGILL, SA_RESETHAND);
|
||||
InstallCrashHandler(SIGBUS, SA_RESETHAND);
|
||||
InstallCrashHandler(SIGABRT, SA_RESETHAND);
|
||||
InstallCrashHandler(SIGSEGV, SA_RESETHAND | SA_ONSTACK);
|
||||
InstallCrashHandler(SIGFPE, 0);
|
||||
InstallCrashHandler(SIGILL, 0);
|
||||
InstallCrashHandler(SIGBUS, 0);
|
||||
InstallCrashHandler(SIGABRT, 0);
|
||||
InstallCrashHandler(SIGSEGV, SA_ONSTACK);
|
||||
}
|
||||
|
||||
IGNORE_LEAKS(ShowCrashReports)
|
||||
|
|
Loading…
Reference in a new issue