Annotation of 3BSD/cmd/sdb/pcs.c, revision 1.1

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

unix.superglobalmegacorp.com

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