Annotation of 42BSD/ucb/pascal/pdx/breakpoint/status.c, revision 1.1

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

unix.superglobalmegacorp.com

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