Annotation of 43BSDTahoe/ucb/pascal/pdx/breakpoint/status.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1980 Regents of the University of California.
                      3:  * All rights reserved.  The Berkeley software License Agreement
                      4:  * specifies the terms and conditions for redistribution.
                      5:  */
                      6: 
                      7: #ifndef lint
                      8: static char sccsid[] = "@(#)status.c   5.1 (Berkeley) 6/5/85";
                      9: #endif not lint
                     10: /*
                     11:  * Print out what's currently being traced by looking at
                     12:  * the currently active breakpoints.
                     13:  *
                     14:  * The list is in LIFO order, we print it FIFO by going recursive.
                     15:  */
                     16: 
                     17: #include "defs.h"
                     18: #include "breakpoint.h"
                     19: #include "tree.h"
                     20: #include "sym.h"
                     21: #include "source.h"
                     22: #include "object.h"
                     23: #include "mappings.h"
                     24: #include "bp.rep"
                     25: 
                     26: #define printnum(id)   if (!isredirected()) printf("(%d) ", id)
                     27: 
                     28: status()
                     29: {
                     30:        if (bphead == NIL) {
                     31:                if (!isredirected()) {
                     32:                        printf("no trace's or stop's active\n");
                     33:                }
                     34:        } else {
                     35:                bpstatus(bphead);
                     36:        }
                     37: }
                     38: 
                     39: LOCAL bpstatus(bp)
                     40: BPINFO *bp;
                     41: {
                     42:        register BPINFO *p;
                     43:        LINENO n;
                     44:        SYM *s;
                     45:        NODE *t;
                     46:        char *trname, *stname;
                     47: 
                     48:        p = bp;
                     49:        if (p->bpnext != NIL) {
                     50:                bpstatus(p->bpnext);
                     51:        }
                     52:        t = p->bpnode;
                     53:        if (p->bpline >= 0) {
                     54:                n = linelookup(p->bpaddr);
                     55:                trname = "trace";
                     56:                stname = "stop";
                     57:        } else {
                     58:                n = p->bpaddr;
                     59:                trname = "tracei";
                     60:                stname = "stopi";
                     61:        }
                     62:        switch(p->bptype) {
                     63:                case INST:
                     64:                        printnum(p->bpid);
                     65:                        printf("%s %d", trname, n);
                     66:                        break;
                     67: 
                     68:                case ALL_ON:
                     69:                        printnum(p->bpid);
                     70:                        printf("%s", trname);
                     71:                        s = p->bpblock;
                     72:                        if (s != program) {
                     73:                                printf(" in ");
                     74:                                printname(s);
                     75:                        }
                     76:                        break;
                     77: 
                     78:                case STOP_ON:
                     79:                        printnum(p->bpid);
                     80:                        printf("%s", stname);
                     81:                        if (t != NIL) {
                     82:                                printf(" ");
                     83:                                prtree(t);
                     84:                        }
                     85:                        s = p->bpblock;
                     86:                        if (s != program) {
                     87:                                printf(" in ");
                     88:                                printname(s);
                     89:                        }
                     90:                        break;
                     91: 
                     92:                case BLOCK_ON:
                     93:                case TERM_ON:
                     94:                        s = p->bpblock;
                     95:                        printnum(p->bpid);
                     96:                        printf("%s ", trname);
                     97:                        prtree(t);
                     98:                        if (s != program) {
                     99:                                printf(" in ");
                    100:                                printname(s);
                    101:                        }
                    102:                        break;
                    103: 
                    104:                case AT_BP:
                    105:                        printnum(p->bpid);
                    106:                        printf("%s ", trname);
                    107:                        prtree(t);
                    108:                        printf(" at %d", p->bpline);
                    109:                        break;
                    110: 
                    111:                case STOP_BP:
                    112:                        printnum(p->bpid);
                    113:                        printf("%s", stname);
                    114:                        if (t != NIL) {
                    115:                                printf(" ");
                    116:                                prtree(t);
                    117:                        } else if ((s = p->bpblock) != NIL) {
                    118:                                printf(" in ");
                    119:                                printname(s);
                    120:                        } else if (p->bpline > 0) {
                    121:                                printf(" at %d", p->bpline);
                    122:                        } else {
                    123:                                printf(" at %d", p->bpaddr);
                    124:                        }
                    125:                        break;
                    126: 
                    127:                /*
                    128:                 * Temporary breakpoints;
                    129:                 * return rather than break to avoid printing newline.
                    130:                 */
                    131:                case ALL_OFF:
                    132:                case CALL:
                    133:                case RETURN:
                    134:                case CALLPROC:
                    135:                case STOP_OFF:
                    136:                case BLOCK_OFF:
                    137:                case TERM_OFF:
                    138:                case END_BP:
                    139:                        return;
                    140: 
                    141:                default:
                    142:                        panic("bptype %d in bplist", p->bptype);
                    143:        }
                    144:        if (p->bpcond != NIL) {
                    145:                printf(" if ");
                    146:                prtree(p->bpcond);
                    147:        }
                    148:        printf("\n");
                    149: }
                    150: 
                    151: /*
                    152:  * Print the name of a symbol unambigously.
                    153:  */
                    154: 
                    155: LOCAL printname(s)
                    156: SYM *s;
                    157: {
                    158:        if (isambiguous(s)) {
                    159:                printwhich(s);
                    160:        } else {
                    161:                printf("%s", name(s));
                    162:        }
                    163: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.