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