date and time created 82/01/18 19:19:56 by linton
authorMark Linton <linton@ucbvax.Berkeley.EDU>
Tue, 19 Jan 1982 11:19:56 +0000 (03:19 -0800)
committerMark Linton <linton@ucbvax.Berkeley.EDU>
Tue, 19 Jan 1982 11:19:56 +0000 (03:19 -0800)
SCCS-vsn: usr.bin/pascal/pdx/breakpoint/fixbps.c 1.1

usr/src/usr.bin/pascal/pdx/breakpoint/fixbps.c [new file with mode: 0644]

diff --git a/usr/src/usr.bin/pascal/pdx/breakpoint/fixbps.c b/usr/src/usr.bin/pascal/pdx/breakpoint/fixbps.c
new file mode 100644 (file)
index 0000000..2489a16
--- /dev/null
@@ -0,0 +1,72 @@
+/* Copyright (c) 1982 Regents of the University of California */
+
+static char sccsid[] = "@(#)fixbps.c 1.1 %G%";
+
+/*
+ * fix up breakpoint information before continuing execution
+ *
+ * It's necessary to destroy breakpoints that were created temporarily
+ * and still exist because the program terminated abnormally.
+ */
+
+#include "defs.h"
+#include "breakpoint.h"
+#include "bp.rep"
+
+fixbps()
+{
+       register BPINFO *p, *last, *next;
+
+       last = NIL;
+       p = bphead;
+       while (p != NIL) {
+               next = p->bpnext;
+               switch(p->bptype) {
+                       case ALL_OFF:
+                               if (p->bpline >= 0) {
+                                       --tracing;
+                               } else {
+                                       --inst_tracing;
+                               }
+                               if (p->bpcond != NIL) {
+                                       delcond(TRPRINT, p->bpcond);
+                               }
+                               goto delete;
+
+                       case STOP_OFF:
+                               var_tracing--;
+                               delcond(TRSTOP, p->bpcond);
+                               goto delete;
+
+                       case TERM_OFF:
+                               --var_tracing;
+                               delvar(TRPRINT, p->bpnode, p->bpcond);
+                               goto delete;
+
+                       case CALL:
+                       case RETURN:
+                       case BLOCK_OFF:
+                       case CALLPROC:
+                       case END_BP:
+
+                       delete:
+                               if (last == NIL) {
+                                       bphead = next;
+                               } else {
+                                       last->bpnext = next;
+                               }
+                               dispose(p);
+                               break;
+
+                       default:
+                               last = p;
+                               break;
+               }
+               p = next;
+       }
+       tracing = 0;
+       var_tracing = 0;
+       inst_tracing = 0;
+       trfree();
+       condfree();
+}