1 /*- 2 * Copyright (c) 1980, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)pstatus.c 8.1 (Berkeley) 06/06/93"; 10 #endif /* not lint */ 11 12 /* 13 * process status routines 14 */ 15 16 #include "defs.h" 17 #include <signal.h> 18 #include "process.h" 19 #include "machine.h" 20 #include "breakpoint.h" 21 #include "source.h" 22 #include "object.h" 23 #include "process.rep" 24 25 /* 26 * Print the status of the process. 27 * This routine does not return. 28 */ 29 30 printstatus() 31 { 32 if (process->signo == SIGINT) { 33 isstopped = TRUE; 34 printerror(); 35 } 36 if (isbperr() && isstopped) { 37 skimsource(srcfilename(pc)); 38 printf("stopped at "); 39 printwhere(curline, cursource); 40 putchar('\n'); 41 if (curline > 0) { 42 printlines(curline, curline); 43 } else { 44 printinst(pc, pc); 45 } 46 erecover(); 47 } else { 48 isstopped = FALSE; 49 fixbps(); 50 fixintr(); 51 if (process->status == FINISHED) { 52 quit(0); 53 } else { 54 printerror(); 55 } 56 } 57 } 58 59 60 /* 61 * Print out the "line N [in file F]" information that accompanies 62 * messages in various places. 63 */ 64 65 printwhere(lineno, filename) 66 LINENO lineno; 67 char *filename; 68 { 69 if (lineno > 0) { 70 printf("line %d", lineno); 71 if (nlhdr.nfiles > 1) { 72 printf(" in file %s", filename); 73 } 74 } else { 75 printf("location %d\n", pc); 76 } 77 } 78 79 /* 80 * Return TRUE if the process is finished. 81 */ 82 83 BOOLEAN isfinished(p) 84 PROCESS *p; 85 { 86 return(p->status == FINISHED); 87 } 88