1: #
2: /*
3: *
4: * UNIX debugger
5: *
6: */
7:
8: #include "defs.h"
9:
10:
11: MSG NOEOR;
12:
13: INT mkfault;
14: INT executing;
15: INT infile;
16: CHAR *lp;
17: INT maxoff;
18: INT maxpos;
19: INT sigint;
20: INT sigqit;
21: INT wtflag;
22: INT kernel;
23: L_INT maxfile;
24: L_INT maxstor;
25: L_INT txtsiz;
26: L_INT datsiz;
27: L_INT datbas;
28: L_INT stksiz;
29: L_INT ovlsiz;
30: int overlay;
31: STRING errflg;
32: INT exitflg;
33: INT magic;
34: L_INT entrypt;
35:
36: CHAR lastc;
37: INT eof;
38:
39: INT lastcom;
40: L_INT var[36];
41: STRING symfil;
42: STRING corfil;
43: CHAR printbuf[];
44: CHAR *printptr;
45:
46:
47: L_INT round(a,b)
48: L_INT a, b;
49: {
50: L_INT w;
51: w = ((a+b-1)/b)*b;
52: return(w);
53: }
54:
55: /* error handling */
56:
57: chkerr()
58: {
59: IF errflg ORF mkfault
60: THEN error(errflg);
61: FI
62: }
63:
64: error(n)
65: STRING n;
66: {
67: errflg=n;
68: iclose(); oclose();
69: longjmp(erradb,1);
70: }
71:
72: fault(a)
73: {
74: signal(a,fault);
75: lseek(infile,0L,2);
76: mkfault++;
77: }
78:
79: /* set up files and initial address mappings */
80: INT argcount;
81:
82: main(argc, argv)
83: REG STRING *argv;
84: REG INT argc;
85: {
86: maxfile=1L<<24; maxstor=1L<<16;
87:
88: gtty(0,&adbtty);
89: gtty(0,&usrtty);
90: WHILE argc>1
91: DO IF eqstr("-w",argv[1])
92: THEN wtflag=2; argc--; argv++; continue;
93: ELIF eqstr("-k",argv[1])
94: THEN kernel++; argc--; argv++; continue;
95: ELSE break;
96: FI
97: OD
98:
99: IF argc>1 THEN symfil = argv[1]; FI
100: IF argc>2 THEN corfil = argv[2]; FI
101: argcount=argc;
102: setsym(); setcor();
103:
104: /* set up variables for user */
105: maxoff=MAXOFF; maxpos=MAXPOS;
106: var[VARB] = datbas;
107: var[VARD] = datsiz;
108: var[VARE] = entrypt;
109: var[VARM] = magic;
110: var[VARS] = stksiz;
111: var[VART] = txtsiz;
112: /* if text overlay, enter total overlay area size */
113: IF overlay
114: THEN var[VARO] = ovlsiz;
115: FI
116:
117: IF (sigint=signal(SIGINT,01))!=01
118: THEN sigint=fault; signal(SIGINT,fault);
119: FI
120: sigqit=signal(SIGQUIT,1);
121: setjmp(erradb);
122: IF executing THEN delbp(); FI
123: executing=FALSE;
124:
125: LOOP flushbuf();
126: IF errflg
127: THEN printf("%s\n",errflg);
128: exitflg=errflg;
129: errflg=0;
130: FI
131: IF mkfault
132: THEN mkfault=0; printc(EOR); prints(DBNAME);
133: FI
134: lp=0; rdc(); lp--;
135: IF eof
136: THEN IF infile
137: THEN iclose(); eof=0; longjmp(erradb,1);
138: ELSE done();
139: FI
140: ELSE exitflg=0;
141: FI
142: command(0,lastcom);
143: IF lp ANDF lastc!=EOR THEN error(NOEOR); FI
144: POOL
145: }
146:
147: done()
148: {
149: endpcs();
150: exit(exitflg);
151: }
Defined functions
done
defined in line
147; used 2 times
error
defined in line
64; used 38 times
- in line 60,
143
- in /usr/src/cmd/adb/access.c line
65,
87
- in /usr/src/cmd/adb/command.c line
113,
133,
153,
197,
222
- in /usr/src/cmd/adb/expr.c line
87,
117,
158,
169,
180,
226,
235-240(2),
316
- in /usr/src/cmd/adb/format.c line
66,
72,
110,
224,
246,
269
- in /usr/src/cmd/adb/input.c line
39
- in /usr/src/cmd/adb/pcs.c line
57,
75,
93,
101,
122-127(2)
- in /usr/src/cmd/adb/print.c line
147,
153,
272-276(2),
318
- in /usr/src/cmd/adb/runpcs.c line
115-120(2)
fault
defined in line
72; used 4 times
main
defined in line
82;
never used
round
defined in line
47; used 9 times
Defined variables