Annotation of 43BSDTahoe/bin/adb/adb.tahoe/pcs.c, revision 1.1

1.1     ! root        1: #ifndef lint
        !             2: static char sccsid[] = "@(#)pcs.c      1.1 (Berkeley) 2/25/86";
        !             3: #endif
        !             4: 
        !             5: /*
        !             6:  *
        !             7:  *     UNIX debugger
        !             8:  *
        !             9:  */
        !            10: 
        !            11: #include "defs.h"
        !            12: 
        !            13: 
        !            14: MSG            NOBKPT;
        !            15: MSG            SZBKPT;
        !            16: MSG            EXBKPT;
        !            17: MSG            NOPCS;
        !            18: MSG            BADMOD;
        !            19: 
        !            20: /* breakpoints */
        !            21: BKPTR          bkpthead;
        !            22: 
        !            23: CHAR           *lp;
        !            24: CHAR           lastc;
        !            25: 
        !            26: INT            signo;
        !            27: L_INT          dot;
        !            28: L_INT          pid;
        !            29: L_INT          cntval;
        !            30: L_INT          loopcnt;
        !            31: 
        !            32: L_INT          entrypt;
        !            33: INT            adrflg;
        !            34: 
        !            35: 
        !            36: 
        !            37: /* sub process control */
        !            38: 
        !            39: subpcs(modif)
        !            40: {
        !            41:        REG             check;
        !            42:        REG             execsig,runmode;
        !            43:        REG BKPTR       bkptr;
        !            44:        REG     STRING  comptr;
        !            45:        execsig=0; loopcnt=cntval;
        !            46: 
        !            47:        switch (modif) {
        !            48: 
        !            49:            /* delete breakpoint */
        !            50:            case 'd': case 'D':
        !            51:                IF (bkptr=scanbkpt(dot))
        !            52:                THEN bkptr->flag=0; return;
        !            53:                ELSE error(NOBKPT);
        !            54:                FI
        !            55: 
        !            56:            /* set breakpoint */
        !            57:            case 'b': case 'B':
        !            58:                IF (bkptr=scanbkpt(dot))
        !            59:                THEN bkptr->flag=0;
        !            60:                FI
        !            61:                FOR bkptr=bkpthead; bkptr; bkptr=bkptr->nxtbkpt
        !            62:                DO IF bkptr->flag == 0
        !            63:                   THEN break;
        !            64:                   FI
        !            65:                OD
        !            66:                IF bkptr==0
        !            67:                THEN IF (bkptr=(BKPTR)sbrk(sizeof *bkptr)) == (BKPTR)-1
        !            68:                     THEN error(SZBKPT);
        !            69:                     ELSE bkptr->nxtbkpt=bkpthead;
        !            70:                          bkpthead=bkptr;
        !            71:                     FI
        !            72:                FI
        !            73:                bkptr->loc = dot;
        !            74:                bkptr->initcnt = bkptr->count = cntval;
        !            75:                bkptr->flag = BKPTSET;
        !            76:                check=MAXCOM-1; comptr=bkptr->comm; rdc(); lp--;
        !            77:                REP *comptr++ = readchar();
        !            78:                PER check-- ANDF lastc!=EOR DONE
        !            79:                *comptr=0; lp--;
        !            80:                IF check
        !            81:                THEN return;
        !            82:                ELSE error(EXBKPT);
        !            83:                FI
        !            84: 
        !            85:            /* exit */
        !            86:            case 'k' :case 'K':
        !            87:                IF pid
        !            88:                THEN printf("%d: killed", pid); endpcs(); return;
        !            89:                FI
        !            90:                error(NOPCS);
        !            91: 
        !            92:            /* run program */
        !            93:            case 'r': case 'R':
        !            94:                endpcs();
        !            95:                setup(); runmode=CONTIN;
        !            96: /*
        !            97:                IF adrflg 
        !            98:                THEN IF !scanbkpt(dot) THEN loopcnt++; FI
        !            99:                ELSE IF !scanbkpt(entrypt+2) THEN loopcnt++; FI
        !           100:                FI
        !           101: */
        !           102:                break;
        !           103: 
        !           104:            /* single step */
        !           105:            case 's': case 'S':
        !           106:                IF pid
        !           107:                THEN
        !           108:                        runmode=SINGLE; execsig=getsig(signo);
        !           109:                ELSE setup(); loopcnt--;
        !           110:                FI
        !           111:                break;
        !           112: 
        !           113:            /* continue with optional signal */
        !           114:            case 'c': case 'C': case 0:
        !           115:                IF pid==0 THEN error(NOPCS); FI
        !           116:                runmode=CONTIN; execsig=getsig(signo);
        !           117:                break;
        !           118: 
        !           119:            default: error(BADMOD);
        !           120:        }
        !           121: 
        !           122:        IF loopcnt>0 ANDF runpcs(runmode,execsig)
        !           123:        THEN printf("breakpoint%16t");
        !           124:        ELSE printf("stopped at%16t");
        !           125:        FI
        !           126:        delbp();
        !           127:        printpc();
        !           128: }
        !           129: 

unix.superglobalmegacorp.com

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