Cygwin: Treat api_fatal() similarly to a core-dumping signal
Provide the same debugging opportunities for api_fatal() as we do for a core-dumping signal: 1) Break into any attached debugger 2) Start JIT debugger (if configured) (keeping these under DEBUGGING doesn't seem helpful) 3) Write a coredump (if rlim_core > 1MB) 4) Write a stackdump (if that failed, or 0 < rlim_core <= 1MB)
This commit is contained in:
parent
a83b93e662
commit
aa8224826c
|
@ -1250,11 +1250,7 @@ vapi_fatal (const char *fmt, va_list ap)
|
|||
__small_vsprintf (buf + n, fmt, ap);
|
||||
va_end (ap);
|
||||
strace.prntf (_STRACE_SYSTEM, NULL, "%s", buf);
|
||||
|
||||
#ifdef DEBUGGING
|
||||
try_to_debug ();
|
||||
#endif
|
||||
cygwin_stackdump ();
|
||||
api_fatal_debug();
|
||||
myself.exit (__api_fatal_exit_val);
|
||||
}
|
||||
|
||||
|
|
|
@ -1396,6 +1396,24 @@ signal_exit (int sig, siginfo_t *si, void *)
|
|||
}
|
||||
} /* extern "C" */
|
||||
|
||||
/* As above, but before exiting due to api_fatal */
|
||||
extern "C"
|
||||
void
|
||||
api_fatal_debug ()
|
||||
{
|
||||
if (try_to_debug ())
|
||||
return;
|
||||
|
||||
if (cygheap->rlim_core == 0Ul)
|
||||
return;
|
||||
|
||||
if (cygheap->rlim_core > 1024*1024)
|
||||
if (exec_prepared_command (dumper_command))
|
||||
return;
|
||||
|
||||
cygwin_stackdump();
|
||||
}
|
||||
|
||||
/* Attempt to carefully handle SIGCONT when we are stopped. */
|
||||
void
|
||||
_cygtls::handle_SIGCONT ()
|
||||
|
|
|
@ -181,6 +181,7 @@ void close_all_files (bool = false);
|
|||
extern "C" void error_start_init (const char*);
|
||||
extern "C" void dumper_init (void);
|
||||
extern "C" int try_to_debug ();
|
||||
extern "C" void api_fatal_debug ();
|
||||
|
||||
void ld_preload ();
|
||||
void fixup_hooks_after_fork ();
|
||||
|
|
Loading…
Reference in New Issue