mirror of
https://github.com/golang/go
synced 2024-11-21 19:34:46 -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,12 +90,27 @@ 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[])
|
||||
{
|
||||
int i, c;
|
||||
NodeList *l;
|
||||
char *p;
|
||||
|
||||
signal(SIGBUS, fault);
|
||||
signal(SIGSEGV, fault);
|
||||
|
||||
localpkg = mkpkg(strlit(""));
|
||||
localpkg->prefix = "\"\"";
|
||||
|
Loading…
Reference in New Issue
Block a user