public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] don't confuse user when OOM happens
@ 2017-08-14 16:56 Nathan Sidwell
  2017-08-15 12:41 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Sidwell @ 2017-08-14 16:56 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 436 bytes --]

The thread at https://gcc.gnu.org/ml/gcc/2017-08/msg00090.html discusses 
the driver behaviour when OOM kills cc1plus or whatever.

This patch changes the driver so that if the inferior dies via INT, 
TERM, QUIT or KILL signals,  it emits a clearer message about what happened.

We've been using this patch inside Facebook for a while, and it's cut 
down on OOM-related bug reports.  So works for me :)

ok?

nathan

-- 
Nathan Sidwell

[-- Attachment #2: oom.diff --]
[-- Type: text/x-patch, Size: 1239 bytes --]

2017-08-14  Nathan Sidwell  <nathan@acm.org>

	* gcc.c (execute): Emit friendlier message if inferior is killed
	by an external cause.

Index: gcc.c
===================================================================
--- gcc.c	(revision 251093)
+++ gcc.c	(working copy)
@@ -3151,9 +3151,27 @@ execute (void)
 	      }
 	    else
 #endif
-	      internal_error_no_backtrace ("%s (program %s)",
-					   strsignal (WTERMSIG (status)),
-					   commands[i].prog);
+	      switch (WTERMSIG (status))
+		{
+		case SIGINT:
+		case SIGQUIT:
+		case SIGKILL:
+		case SIGTERM:
+		  /* The user (or environment) did something to the
+		     inferior.  Making this an ICE confuses the user
+		     into thinking there's a compiler bug.  Much more
+		     likely is the user or OOM killer nuked it.  */
+		  fatal_error (input_location,
+			       "%s signal terminated program %s",
+			       strsignal (WTERMSIG (status)),
+			       commands[i].prog);
+		  break;
+		default:
+		  /* The inferior failed to catch the signal.  */
+		  internal_error_no_backtrace ("%s (program %s)",
+					       strsignal (WTERMSIG (status)),
+					       commands[i].prog);
+		}
 	  }
 	else if (WIFEXITED (status)
 		 && WEXITSTATUS (status) >= MIN_FATAL_STATUS)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] don't confuse user when OOM happens
  2017-08-14 16:56 [PATCH] don't confuse user when OOM happens Nathan Sidwell
@ 2017-08-15 12:41 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2017-08-15 12:41 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: GCC Patches

On Mon, Aug 14, 2017 at 5:56 PM, Nathan Sidwell <nathan@acm.org> wrote:
> The thread at https://gcc.gnu.org/ml/gcc/2017-08/msg00090.html discusses the
> driver behaviour when OOM kills cc1plus or whatever.
>
> This patch changes the driver so that if the inferior dies via INT, TERM,
> QUIT or KILL signals,  it emits a clearer message about what happened.
>
> We've been using this patch inside Facebook for a while, and it's cut down
> on OOM-related bug reports.  So works for me :)
>
> ok?

Ok.

Thanks,
Richard.

> nathan
>
> --
> Nathan Sidwell

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-15 11:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-14 16:56 [PATCH] don't confuse user when OOM happens Nathan Sidwell
2017-08-15 12:41 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).