diff options
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r-- | gcc/toplev.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c index a4cd1df..38cff5b 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -113,6 +113,7 @@ static void finalize PARAMS ((void)); static void set_target_switch PARAMS ((const char *)); static void crash_signal PARAMS ((int)) ATTRIBUTE_NORETURN; +static void setup_core_dumping PARAMS ((void)); static void compile_file PARAMS ((void)); static void display_help PARAMS ((void)); static void display_target_options PARAMS ((void)); @@ -1693,6 +1694,29 @@ crash_signal (signo) internal_error ("%s", strsignal (signo)); } +/* Arrange to dump core on error. (The regular error message is still + printed first, except in the case of abort().) */ + +static void +setup_core_dumping () +{ +#ifdef SIGABRT + signal (SIGABRT, SIG_DFL); +#endif +#if defined(HAVE_SETRLIMIT) + { + struct rlimit rlim; + if (getrlimit (RLIMIT_CORE, &rlim) != 0) + fatal_io_error ("getting core file size maximum limit"); + rlim.rlim_cur = rlim.rlim_max; + if (setrlimit (RLIMIT_CORE, &rlim) != 0) + fatal_io_error ("setting core file size limit to maximum"); + } +#endif + diagnostic_abort_on_error (global_dc); +} + + /* Strip off a legitimate source ending from the input string NAME of length LEN. Rather than having to know the names used by all of our front ends, we strip off an ending of a period followed by @@ -3953,6 +3977,9 @@ decode_d_option (arg) case 'D': /* These are handled by the preprocessor. */ case 'I': break; + case 'H': + setup_core_dumping(); + break; default: matched = 0; |