1 /* Copyright (c) 1982 Regents of the University of California */
2 
3 static char sccsid[] = "@(#)fixbps.c 1.1 01/18/82";
4 
5 /*
6  * fix up breakpoint information before continuing execution
7  *
8  * It's necessary to destroy breakpoints that were created temporarily
9  * and still exist because the program terminated abnormally.
10  */
11 
12 #include "defs.h"
13 #include "breakpoint.h"
14 #include "bp.rep"
15 
16 fixbps()
17 {
18 	register BPINFO *p, *last, *next;
19 
20 	last = NIL;
21 	p = bphead;
22 	while (p != NIL) {
23 		next = p->bpnext;
24 		switch(p->bptype) {
25 			case ALL_OFF:
26 				if (p->bpline >= 0) {
27 					--tracing;
28 				} else {
29 					--inst_tracing;
30 				}
31 				if (p->bpcond != NIL) {
32 					delcond(TRPRINT, p->bpcond);
33 				}
34 				goto delete;
35 
36 			case STOP_OFF:
37 				var_tracing--;
38 				delcond(TRSTOP, p->bpcond);
39 				goto delete;
40 
41 			case TERM_OFF:
42 				--var_tracing;
43 				delvar(TRPRINT, p->bpnode, p->bpcond);
44 				goto delete;
45 
46 			case CALL:
47 			case RETURN:
48 			case BLOCK_OFF:
49 			case CALLPROC:
50 			case END_BP:
51 
52 			delete:
53 				if (last == NIL) {
54 					bphead = next;
55 				} else {
56 					last->bpnext = next;
57 				}
58 				dispose(p);
59 				break;
60 
61 			default:
62 				last = p;
63 				break;
64 		}
65 		p = next;
66 	}
67 	tracing = 0;
68 	var_tracing = 0;
69 	inst_tracing = 0;
70 	trfree();
71 	condfree();
72 }
73