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