1: static  char sccsid[] = "@(#)main.c 4.2 8/17/82";
   2: #
   3: /*
   4:  *
   5:  *	UNIX debugger
   6:  *
   7:  */
   8: 
   9: #include    "head.h"
  10: #include    <signal.h>
  11: #include    <stdio.h>
  12: #include    <sys/stat.h>
  13: 
  14: INT     mkfault;
  15: INT     executing;
  16: CHAR        *lp;
  17: L_INT       maxoff;
  18: L_INT       maxpos;
  19: ADDR        sigint;
  20: ADDR        sigqit;
  21: INT     wtflag;
  22: L_INT       maxfile;
  23: L_INT       maxstor;
  24: L_INT       txtsiz;
  25: L_INT       datsiz;
  26: L_INT       datbas;
  27: L_INT       stksiz;
  28: STRING      errflg;
  29: INT     magic;
  30: L_INT       entrypt;
  31: 
  32: CHAR        lastc;
  33: 
  34: STRING      symfil;
  35: STRING      corfil;
  36: INT         argcount;
  37: ADDR        userpc;
  38: int fpe();
  39: 
  40: main(argc, argv)
  41: REG STRING  *argv;
  42: REG INT     argc;
  43: {
  44:     register char *p;
  45:     struct stat stbuf;
  46: 
  47:     userpc = 1;
  48:     symfil = "a.out";
  49:     corfil = "core";
  50:     maxfile=1L<<24; maxstor=1L<<31;
  51: #ifndef STD
  52: #ifndef VAX135
  53:     maxstor -= ctob(UPAGES);
  54: #endif
  55: #endif
  56: 
  57:     setbuf(stdout, NULL);
  58:     setbuf(stderr, NULL);
  59: 
  60:     WHILE argc>1
  61:     DO  IF eqstr("-w",argv[1])
  62:         THEN    wtflag=2; argc--; argv++;
  63:         ELSE    break;
  64:         FI
  65:     OD
  66: 
  67:     IF argc>1 THEN symfil = argv[1]; FI
  68:     IF argc>2 THEN corfil = argv[2]; FI
  69:     fp = filework;
  70:     if (argc > 3) {
  71:         for (p = argv[3]; *p; *fp++ = *p++) ;
  72:         *fp++ = '/';
  73:     }
  74:     argcount=argc;
  75: 
  76:     if (stat(symfil, &stbuf) == -1) {
  77:         printf("`%s' does not exist\n", symfil);
  78:         exit(4);
  79:     }
  80:     symtime = stbuf.st_mtime;
  81:     if (stat(corfil, &stbuf) != -1) {
  82:         if (symtime > stbuf.st_mtime)
  83:             printf("Warning: `%s' newer than `%s'\n",
  84:                 symfil, corfil);
  85:     }
  86: 
  87:     setsym(); setcor();
  88:     initfp();
  89:     mkioptab();
  90: 
  91:     /* set up variables for user */
  92:     maxoff=MAXOFF; maxpos=MAXPOS;
  93:     gtty(2, &sdbttym);
  94:     IF (sigint= (ADDR) signal(SIGINT,01))!=01
  95:     THEN    sigint= (ADDR) fault; signal(SIGINT,fault);
  96:     FI
  97:     sigqit= (ADDR) signal(SIGQUIT,1);
  98:     signal(SIGILL, fpe);
  99: 
 100:     setjmp(env);
 101:     if (debug) printf("Sdb restarted\n");
 102:     gtty(2, &userttym);
 103:     if (sdbttym.sg_flags != userttym.sg_flags)
 104:         stty(2, &sdbttym);
 105:     IF executing THEN delbp(); FI
 106:     executing=FALSE;
 107: 
 108:     for (;;) {
 109:         mkfault = 0;
 110:         printf("*");
 111:         if (decode(readline(stdin)) == 1) {
 112:             printf("Error; try again\n");
 113:             continue;
 114:         }
 115: 
 116:     if (debug) {
 117:         printf("cmd %c:\n", cmd);
 118:         printf("%s:%s\n", proc, var);
 119:         printf("args-%s;re-%s;integ-%d\n", args, re, integ);
 120:         printf("scallf-%d;reflg-%d\n", scallf, reflag);
 121:         printf("colonflag-%d;ncolonflag-%d\n\n",
 122:             colonflag, ncolonflag);
 123:     }
 124:         docommand();
 125:     }
 126: }
 127: 
 128: 
 129: fault(a)
 130: {
 131:     signal(a,fault);
 132:     mkfault++;
 133:     printf("\n");
 134:     longjmp(env, 0);
 135: }
 136: 
 137: fpe() {
 138:     signal(SIGILL, fpe);
 139:     error("Illegal floating constant");
 140:     longjmp(env, 0);
 141: }

Defined functions

fault defined in line 129; used 4 times
fpe defined in line 137; used 3 times
main defined in line 40; never used

Defined variables

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