1
0
mirror of https://github.com/golang/go synced 2024-11-22 01:54:42 -07:00

gc: graceful exit on seg fault

R=ken2
CC=golang-dev
https://golang.org/cl/1882043
This commit is contained in:
Russ Cox 2010-07-26 16:52:51 -07:00
parent a59e113fcb
commit b49561d884

View File

@ -90,6 +90,18 @@ usage(void)
exit(0);
}
void
fault(int s)
{
// If we've already complained about things
// in the program, don't bother complaining
// about the seg fault too; let the user clean up
// the code and try again.
if(nerrors > 0)
errorexit();
fatal("fault");
}
int
main(int argc, char *argv[])
{
@ -97,6 +109,9 @@ main(int argc, char *argv[])
NodeList *l;
char *p;
signal(SIGBUS, fault);
signal(SIGSEGV, fault);
localpkg = mkpkg(strlit(""));
localpkg->prefix = "\"\"";