148101Sbostic /*-
2*62133Sbostic  * Copyright (c) 1980, 1993
3*62133Sbostic  *	The Regents of the University of California.  All rights reserved.
448101Sbostic  *
548101Sbostic  * %sccs.include.redist.c%
622366Sdist  */
75480Slinton 
822366Sdist #ifndef lint
9*62133Sbostic static char sccsid[] = "@(#)printerror.c	8.1 (Berkeley) 06/06/93";
1048101Sbostic #endif /* not lint */
115480Slinton 
125480Slinton /*
135606Slinton  * Print out an execution time error.
145480Slinton  */
155480Slinton 
165480Slinton #include "defs.h"
175480Slinton #include <signal.h>
185480Slinton #include "machine.h"
195480Slinton #include "sym.h"
205480Slinton #include "process.h"
215480Slinton #include "source.h"
225480Slinton #include "object.h"
235480Slinton #include "mappings.h"
245480Slinton #include "pxerrors.h"
255480Slinton #include "process/process.rep"
265480Slinton 
2730845Smckusick #ifdef tahoe
2830845Smckusick BOOLEAN shouldrestart;
2930845Smckusick #endif
3030845Smckusick 
printerror()315480Slinton printerror()
325480Slinton {
335764Slinton     register PROCESS *p;
345480Slinton 
355764Slinton     p = process;
365764Slinton     if (p->signo != ESIGNAL && p->signo != SIGINT) {
375764Slinton 	error("signal %d at px pc %d, lc %d", p->signo, p->pc, pc);
385764Slinton     }
395764Slinton     curline = srcline(pc);
405764Slinton     curfunc = whatblock(pc);
415764Slinton     skimsource(srcfilename(pc));
425764Slinton     if (p->signo == ESIGNAL) {
435764Slinton 	printf("\nerror at ");
445764Slinton 	printwhere(curline, cursource);
4530845Smckusick         putchar('\n');
4630845Smckusick         printlines(curline, curline);
4730845Smckusick #ifdef tahoe
4830845Smckusick 	/*
4930845Smckusick 	 * this px is no good; it is easier to kill it and start
5030845Smckusick 	 * a new one than to make it recover...
5130845Smckusick 	 * make runtime/callproc.c know it too.
5230845Smckusick 	 */
5330845Smckusick 	shouldrestart = TRUE;
5430845Smckusick #endif
5530845Smckusick         erecover();
565764Slinton     } else {
575764Slinton 	printf("\n\ninterrupt at ");
585764Slinton 	printwhere(curline, cursource);
5930845Smckusick         putchar('\n');
6030845Smckusick         printlines(curline, curline);
6130845Smckusick         erecover();
625764Slinton     }
635480Slinton }
64