modifications for centralizing the printing of a source line
authorMark Linton <linton@ucbvax.Berkeley.EDU>
Fri, 12 Feb 1982 15:51:54 +0000 (07:51 -0800)
committerMark Linton <linton@ucbvax.Berkeley.EDU>
Fri, 12 Feb 1982 15:51:54 +0000 (07:51 -0800)
and file

SCCS-vsn: usr.bin/pascal/pdx/breakpoint/printnews.c 1.2
SCCS-vsn: usr.bin/pascal/pdx/breakpoint/trinfo.c 1.2

usr/src/usr.bin/pascal/pdx/breakpoint/printnews.c
usr/src/usr.bin/pascal/pdx/breakpoint/trinfo.c

index 4a99c6e..0f8228c 100644 (file)
@@ -1,9 +1,9 @@
 /* Copyright (c) 1982 Regents of the University of California */
 
 /* Copyright (c) 1982 Regents of the University of California */
 
-static char sccsid[] = "@(#)printnews.c 1.1 %G%";
+static char sccsid[] = "@(#)printnews.c 1.2 %G%";
 
 /*
 
 /*
- * print out news during single step tracing
+ * Print out news during single step tracing.
  *
  * We have to handle all the single stepping possibilities,
  * including combinations.  A combination of single stepping
  *
  * We have to handle all the single stepping possibilities,
  * including combinations.  A combination of single stepping
@@ -21,34 +21,24 @@ static char sccsid[] = "@(#)printnews.c 1.1 %G%";
 
 printnews()
 {
 
 printnews()
 {
-       if (ss_variables) {
-               prvarnews();
+    if (ss_variables) {
+       prvarnews();
+    }
+    if (trcond()) {
+       if (ss_lines && curline > 0) {
+           skimsource(srcfilename(pc));
+           printf("trace:  ");
+           printlines(curline, curline);
        }
        }
-       if (trcond()) {
-               if (ss_lines && curline > 0) {
-                       printf("trace:  ");
-                       printlines(curline, curline);
-               }
-               if (ss_instructions) {
-                       printf("inst trace:     ");
-                       printinst(pc, pc);
-               }
+       if (ss_instructions) {
+           printf("inst trace: ");
+           printinst(pc, pc);
        }
        }
-       bpact();
-       if (stopcond()) {
-               isstopped = TRUE;
-               getsrcinfo();
-               printstatus();
-       }
-}
-
-getsrcinfo()
-{
-       char *filename;
-
+    }
+    bpact();
+    if (stopcond()) {
+       isstopped = TRUE;
        curline = srcline(pc);
        curline = srcline(pc);
-       filename = srcfilename(pc);
-       if (filename != cursource) {
-               skimsource(filename);
-       }
+       printstatus();
+    }
 }
 }
index 03ac07e..0fc07d8 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1982 Regents of the University of California */
 
 /* Copyright (c) 1982 Regents of the University of California */
 
-static char sccsid[] = "@(#)trinfo.c 1.1 %G%";
+static char sccsid[] = "@(#)trinfo.c 1.2 %G%";
 
 /*
  * Trace information management.
 
 /*
  * Trace information management.
@@ -33,13 +33,13 @@ static char sccsid[] = "@(#)trinfo.c 1.1 %G%";
  */
 
 typedef struct trinfo {
  */
 
 typedef struct trinfo {
-       TRTYPE trtype;
-       ADDRESS traddr;
-       SYM *trblock;
-       NODE *trvar;
-       NODE *trcond;
-       char *trvalue;
-       struct trinfo *trnext;
+    TRTYPE trtype;
+    ADDRESS traddr;
+    SYM *trblock;
+    NODE *trvar;
+    NODE *trcond;
+    char *trvalue;
+    struct trinfo *trnext;
 } TRINFO;
 
 LOCAL TRINFO *trhead;
 } TRINFO;
 
 LOCAL TRINFO *trhead;
@@ -53,17 +53,17 @@ TRTYPE trtype;
 NODE *node;
 NODE *cond;
 {
 NODE *node;
 NODE *cond;
 {
-       register TRINFO *tp;
-
-       tp = alloc(1, TRINFO);
-       tp->trtype = trtype;
-       tp->traddr = (ADDRESS) -1;
-       tp->trblock = curfunc;
-       tp->trvar = node;
-       tp->trcond = cond;
-       tp->trvalue = NIL;
-       tp->trnext = trhead;
-       trhead = tp;
+    register TRINFO *tp;
+
+    tp = alloc(1, TRINFO);
+    tp->trtype = trtype;
+    tp->traddr = (ADDRESS) -1;
+    tp->trblock = curfunc;
+    tp->trvar = node;
+    tp->trcond = cond;
+    tp->trvalue = NIL;
+    tp->trnext = trhead;
+    trhead = tp;
 }
 
 /*
 }
 
 /*
@@ -75,28 +75,28 @@ TRTYPE trtype;
 NODE *node;
 NODE *cond;
 {
 NODE *node;
 NODE *cond;
 {
-       register TRINFO *tp, *last;
-
-       last = NIL;
-       for (tp = trhead; tp != NIL; tp = tp->trnext) {
-               if (tp->trtype == trtype &&
-                   tr_equal(tp->trvar, node) &&
-                   tr_equal(tp->trcond, cond)) {
-                       break;
-               }
+    register TRINFO *tp, *last;
+
+    last = NIL;
+    for (tp = trhead; tp != NIL; tp = tp->trnext) {
+       if (tp->trtype == trtype &&
+           tr_equal(tp->trvar, node) &&
+           tr_equal(tp->trcond, cond)) {
+           break;
        }
        }
-       if (tp == NIL) {
-               trerror("can't delete term %t", node);
-       }
-       if (last == NIL) {
-               trhead = tp->trnext;
-       } else {
-               last->trnext = tp->trnext;
-       }
-       if (tp->trvalue != NIL) {
-               free(tp->trvalue);
-       }
-       free(tp);
+    }
+    if (tp == NIL) {
+       trerror("can't delete term %t", node);
+    }
+    if (last == NIL) {
+       trhead = tp->trnext;
+    } else {
+       last->trnext = tp->trnext;
+    }
+    if (tp->trvalue != NIL) {
+       free(tp->trvalue);
+    }
+    free(tp);
 }
 
 /*
 }
 
 /*
@@ -106,59 +106,63 @@ NODE *cond;
 
 prvarnews()
 {
 
 prvarnews()
 {
-       register TRINFO *tp;
-       register NODE *p;
-       register int n;
-       SYM *s;
-       char buff[MAXTRSIZE];
-       static LINENO prevline;
-
-       for (tp = trhead; tp != NIL; tp = tp->trnext) {
-               if (tp->trcond != NIL && !cond(tp->trcond)) {
-                       continue;
-               }
-               s = curfunc;
-               while (s != NIL && s != tp->trblock) {
-                       s = container(s);
-               }
-               if (s == NIL) {
-                       continue;
-               }
-               p = tp->trvar;
-               if (tp->traddr == (ADDRESS) -1) {
-                       tp->traddr = lval(p->left);
-               }
-               n = size(p->nodetype);
-               dread(buff, tp->traddr, n);
-               if (tp->trvalue == NIL) {
-                       tp->trvalue = alloc(n, char);
-                       mov(buff, tp->trvalue, n);
-                       mov(buff, sp, n);
-                       sp += n;
-                       if (tp->trtype == TRPRINT) {
-                               printf("initially (at line %d):\t", curline);
-                               prtree(p);
-                               printf(" = ");
-                               printval(p->nodetype);
-                               putchar('\n');
-                       }
-               } else if (cmp(tp->trvalue, buff, n) != 0) {
-                       mov(buff, tp->trvalue, n);
-                       mov(buff, sp, n);
-                       sp += n;
-                       printf("after line %d:\t", prevline);
-                       prtree(p);
-                       printf(" = ");
-                       printval(p->nodetype);
-                       putchar('\n');
-                       if (tp->trtype == TRSTOP) {
-                               isstopped = TRUE;
-                               getsrcinfo();
-                               printstatus();
-                       }
-               }
+    register TRINFO *tp;
+    register NODE *p;
+    register int n;
+    SYM *s;
+    char buff[MAXTRSIZE];
+    static LINENO prevline;
+
+    for (tp = trhead; tp != NIL; tp = tp->trnext) {
+       if (tp->trcond != NIL && !cond(tp->trcond)) {
+           continue;
+       }
+       s = curfunc;
+       while (s != NIL && s != tp->trblock) {
+           s = container(s);
        }
        }
-       prevline = curline;
+       if (s == NIL) {
+           continue;
+       }
+       p = tp->trvar;
+       if (tp->traddr == (ADDRESS) -1) {
+           tp->traddr = lval(p->left);
+       }
+       n = size(p->nodetype);
+       dread(buff, tp->traddr, n);
+       if (tp->trvalue == NIL) {
+           tp->trvalue = alloc(n, char);
+           mov(buff, tp->trvalue, n);
+           mov(buff, sp, n);
+           sp += n;
+           if (tp->trtype == TRPRINT) {
+               printf("initially (at ");
+               printwhere(curline, srcfilename(pc));
+               printf("):\t");
+               prtree(p);
+               printf(" = ");
+               printval(p->nodetype);
+               putchar('\n');
+           }
+       } else if (cmp(tp->trvalue, buff, n) != 0) {
+           mov(buff, tp->trvalue, n);
+           mov(buff, sp, n);
+           sp += n;
+           printf("after ");
+           printwhere(prevline, srcfilename(pc));
+           printf(":\t");
+           prtree(p);
+           printf(" = ");
+           printval(p->nodetype);
+           putchar('\n');
+           if (tp->trtype == TRSTOP) {
+               isstopped = TRUE;
+               curline = srcline(pc);
+               printstatus();
+           }
+       }
+    }
+    prevline = curline;
 }
 
 /*
 }
 
 /*
@@ -169,14 +173,14 @@ prvarnews()
 
 trfree()
 {
 
 trfree()
 {
-       register TRINFO *tp, *next;
-
-       for (tp = trhead; tp != NIL; tp = next) {
-               next = tp->trnext;
-               if (tp->trvalue != NIL) {
-                       free(tp->trvalue);
-               }
-               free(tp);
+    register TRINFO *tp, *next;
+
+    for (tp = trhead; tp != NIL; tp = next) {
+       next = tp->trnext;
+       if (tp->trvalue != NIL) {
+           free(tp->trvalue);
        }
        }
-       trhead = NIL;
+       free(tp);
+    }
+    trhead = NIL;
 }
 }