122366Sdist /*
222366Sdist  * Copyright (c) 1980 Regents of the University of California.
322366Sdist  * All rights reserved.  The Berkeley software License Agreement
422366Sdist  * specifies the terms and conditions for redistribution.
522366Sdist  */
65480Slinton 
722366Sdist #ifndef lint
8*30845Smckusick static char sccsid[] = "@(#)printerror.c	5.2 (Berkeley) 04/07/87";
922366Sdist #endif not lint
105480Slinton 
115480Slinton /*
125606Slinton  * Print out an execution time error.
135480Slinton  */
145480Slinton 
155480Slinton #include "defs.h"
165480Slinton #include <signal.h>
175480Slinton #include "machine.h"
185480Slinton #include "sym.h"
195480Slinton #include "process.h"
205480Slinton #include "source.h"
215480Slinton #include "object.h"
225480Slinton #include "mappings.h"
235480Slinton #include "pxerrors.h"
245480Slinton #include "process/process.rep"
255480Slinton 
26*30845Smckusick #ifdef tahoe
27*30845Smckusick BOOLEAN shouldrestart;
28*30845Smckusick #endif
29*30845Smckusick 
305480Slinton printerror()
315480Slinton {
325764Slinton     register PROCESS *p;
335480Slinton 
345764Slinton     p = process;
355764Slinton     if (p->signo != ESIGNAL && p->signo != SIGINT) {
365764Slinton 	error("signal %d at px pc %d, lc %d", p->signo, p->pc, pc);
375764Slinton     }
385764Slinton     curline = srcline(pc);
395764Slinton     curfunc = whatblock(pc);
405764Slinton     skimsource(srcfilename(pc));
415764Slinton     if (p->signo == ESIGNAL) {
425764Slinton 	printf("\nerror at ");
435764Slinton 	printwhere(curline, cursource);
44*30845Smckusick         putchar('\n');
45*30845Smckusick         printlines(curline, curline);
46*30845Smckusick #ifdef tahoe
47*30845Smckusick 	/*
48*30845Smckusick 	 * this px is no good; it is easier to kill it and start
49*30845Smckusick 	 * a new one than to make it recover...
50*30845Smckusick 	 * make runtime/callproc.c know it too.
51*30845Smckusick 	 */
52*30845Smckusick 	shouldrestart = TRUE;
53*30845Smckusick #endif
54*30845Smckusick         erecover();
555764Slinton     } else {
565764Slinton 	printf("\n\ninterrupt at ");
575764Slinton 	printwhere(curline, cursource);
58*30845Smckusick         putchar('\n');
59*30845Smckusick         printlines(curline, curline);
60*30845Smckusick         erecover();
615764Slinton     }
625480Slinton }
63