1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  */
6 
7 #ifndef lint
8 static char sccsid[] = "@(#)printerror.c	5.2 (Berkeley) 04/07/87";
9 #endif not lint
10 
11 /*
12  * Print out an execution time error.
13  */
14 
15 #include "defs.h"
16 #include <signal.h>
17 #include "machine.h"
18 #include "sym.h"
19 #include "process.h"
20 #include "source.h"
21 #include "object.h"
22 #include "mappings.h"
23 #include "pxerrors.h"
24 #include "process/process.rep"
25 
26 #ifdef tahoe
27 BOOLEAN shouldrestart;
28 #endif
29 
30 printerror()
31 {
32     register PROCESS *p;
33 
34     p = process;
35     if (p->signo != ESIGNAL && p->signo != SIGINT) {
36 	error("signal %d at px pc %d, lc %d", p->signo, p->pc, pc);
37     }
38     curline = srcline(pc);
39     curfunc = whatblock(pc);
40     skimsource(srcfilename(pc));
41     if (p->signo == ESIGNAL) {
42 	printf("\nerror at ");
43 	printwhere(curline, cursource);
44         putchar('\n');
45         printlines(curline, curline);
46 #ifdef tahoe
47 	/*
48 	 * this px is no good; it is easier to kill it and start
49 	 * a new one than to make it recover...
50 	 * make runtime/callproc.c know it too.
51 	 */
52 	shouldrestart = TRUE;
53 #endif
54         erecover();
55     } else {
56 	printf("\n\ninterrupt at ");
57 	printwhere(curline, cursource);
58         putchar('\n');
59         printlines(curline, curline);
60         erecover();
61     }
62 }
63