mirror of
https://github.com/golang/go
synced 2024-11-20 07:54:39 -07:00
gc: graceful exit on seg fault
R=ken2 CC=golang-dev https://golang.org/cl/1882043
This commit is contained in:
parent
a59e113fcb
commit
b49561d884
@ -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 = "\"\"";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user