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