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