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

Defined functions

subpcs defined in line 34; used 8 times

Defined variables

sccsid defined in line 1; never used
u defined in line 22; never used
Last modified: 1982-10-04
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 625
Valid CSS Valid XHTML 1.0 Strict