Commit | Line | Data |
---|---|---|
505bf312 KB |
1 | /*- |
2 | * Copyright (c) 1980 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * %sccs.include.redist.c% | |
f644bb55 | 6 | */ |
7c008f5a | 7 | |
f644bb55 | 8 | #ifndef lint |
505bf312 KB |
9 | static char sccsid[] = "@(#)pstatus.c 5.3 (Berkeley) %G%"; |
10 | #endif /* not lint */ | |
11 | ||
7c008f5a ML |
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 | { | |
cc7a61ee ML |
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); | |
7c008f5a | 45 | } |
cc7a61ee ML |
46 | erecover(); |
47 | } else { | |
48 | isstopped = FALSE; | |
49 | fixbps(); | |
50 | fixintr(); | |
51 | if (process->status == FINISHED) { | |
52 | quit(0); | |
7c008f5a | 53 | } else { |
cc7a61ee ML |
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); | |
7c008f5a | 73 | } |
cc7a61ee | 74 | } else { |
cc7a61ee | 75 | printf("location %d\n", pc); |
cc7a61ee | 76 | } |
7c008f5a ML |
77 | } |
78 | ||
79 | /* | |
80 | * Return TRUE if the process is finished. | |
81 | */ | |
82 | ||
83 | BOOLEAN isfinished(p) | |
84 | PROCESS *p; | |
85 | { | |
cc7a61ee | 86 | return(p->status == FINISHED); |
7c008f5a | 87 | } |