1: #include "defs.h"
   2: 
   3:     MSG NOBKPT;
   4:     MSG SZBKPT;
   5:     MSG EXBKPT;
   6:     MSG NOPCS;
   7:     MSG BADMOD;
   8: 
   9: /* breakpoints */
  10:     BKPTR   bkpthead;
  11: 
  12:     char    *lp;
  13:     char    lastc;
  14:     u_int   corhdr[ctob(USIZE)/sizeof(u_int)];
  15:     MAP txtmap;
  16:     int signo;
  17:     long    dot;
  18:     int pid;
  19:     long    cntval;
  20:     long    loopcnt;
  21:     int overlay;
  22:     char    curov, symov;
  23: 
  24: /* sub process control */
  25: 
  26: subpcs(modif)
  27: {
  28:     register int check;
  29:     int execsig, runmode;
  30:     register BKPTR  bkptr;
  31:     char    *comptr;
  32: 
  33:     execsig=0; loopcnt=cntval;
  34: 
  35:     switch(modif) {
  36: 
  37:         /* delete breakpoint */
  38:         case 'd': case 'D':
  39:         if (symov && symov!=curov)
  40:             setovmap(symov);
  41:         IF (bkptr=scanbkpt(shorten(dot)))
  42:         THEN bkptr->flag=0;
  43:              if (pid) del1bp(bkptr);
  44:              return;
  45:         ELSE error(NOBKPT);
  46:         FI
  47: 
  48:         /* set breakpoint */
  49:         case 'b': case 'B':
  50:         if (symov && symov!=curov)
  51:             setovmap(symov);
  52:         IF (bkptr=scanbkpt(shorten(dot)))
  53:         THEN bkptr->flag=0;
  54:              if (pid) del1bp(bkptr);
  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)malloc(sizeof *bkptr)) == (BKPTR)NULL
  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:         if (overlay && dot>txtmap.bo)
  72:             bkptr->ovly = symov ? symov : curov;
  73:         else bkptr->ovly = 0;       /* base seg */
  74:         check=MAXCOM-1; comptr=bkptr->comm; rdc(); lp--;
  75:         REP *comptr++ = readchar();
  76:         PER check-- ANDF lastc!=EOR DONE
  77:         *comptr=0; lp--;
  78:         IF check
  79:         THEN if (pid) set1bp(bkptr);
  80:              return;
  81:         ELSE error(EXBKPT);
  82:         FI
  83: 
  84:         /* exit */
  85:         case 'k' :case 'K':
  86:         IF pid
  87:         THEN printf("%d: killed", pid); endpcs(); return;
  88:         FI
  89:         error(NOPCS);
  90: 
  91:         /* run program */
  92:         case 'r': case 'R':
  93:         endpcs();
  94:         setup();
  95:         setbp();
  96:         runmode=PT_CONTINUE;
  97:         break;
  98: 
  99:         /* single step */
 100:         case 's': case 'S':
 101:         runmode=PT_STEP;
 102:         IF pid
 103:         THEN execsig=getsig(signo);
 104:         ELSE setup(); loopcnt--;
 105:         FI
 106:         break;
 107: 
 108:         /* continue with optional signal */
 109:         case 'c': case 'C': case 0:
 110:         IF pid==0 THEN error(NOPCS); FI
 111:         runmode=PT_CONTINUE;
 112:         execsig=getsig(signo);
 113:         break;
 114: 
 115:         default: error(BADMOD);
 116:     }
 117: 
 118:     IF loopcnt>0 ANDF runpcs(runmode, execsig)
 119:     THEN printf("breakpoint%16t");
 120:     ELSE printf("stopped at%16t");
 121:     FI
 122:     printpc();
 123: }

Defined functions

subpcs defined in line 26; used 1 times

Defined variables

BADMOD defined in line 7; used 1 times
EXBKPT defined in line 5; used 1 times
  • in line 81
NOBKPT defined in line 3; used 1 times
  • in line 45
NOPCS defined in line 6; used 2 times
SZBKPT defined in line 4; used 1 times
  • in line 63
bkpthead defined in line 10; used 3 times
cntval defined in line 19; used 2 times
corhdr defined in line 14; never used
curov defined in line 22; used 3 times
dot defined in line 17; used 4 times
lastc defined in line 13; used 1 times
  • in line 76
loopcnt defined in line 20; used 3 times
lp defined in line 12; used 2 times
overlay defined in line 21; used 1 times
  • in line 71
pid defined in line 18; used 7 times
signo defined in line 16; used 2 times
symov defined in line 22; used 8 times
txtmap defined in line 15; used 1 times
  • in line 71
Last modified: 1998-04-22
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2793
Valid CSS Valid XHTML 1.0 Strict