Commit | Line | Data |
---|---|---|
90acb15a HK |
1 | |
2 | #include <stdio.h> | |
3 | #include <setjmp.h> | |
4 | #include "sgtty.h" | |
5 | #include <sys/vm.h> | |
6 | #define PAGSIZ (CLSIZE*NBPG) | |
7 | #include "bio.h" | |
8 | #include "defs.h" | |
9 | ||
10 | /* input line decoding */ | |
11 | char proc[30]; /* procedure name */ | |
12 | int integ; /* count or number in input */ | |
13 | char cmd; /* command letter */ | |
14 | char re[128]; /* regular expression */ | |
15 | char args[128]; /* arguments */ | |
16 | char *argsp; /* pointer to args */ | |
17 | char var[60]; /* variable name */ | |
18 | int scallf; /* set to 1 iff procedure call */ | |
19 | int reflag; /* set to 1 iff re */ | |
20 | int redir; /* set to 1 iff forward search */ | |
21 | int colonflag; /* set to 1 iff colon typed */ | |
22 | ||
23 | /* source file i/o */ | |
24 | char curfile[30]; /* name of file being edited */ | |
25 | int fline; /* line number in file */ | |
26 | int maxfline; /* maximum line number in file, 0 if unknown */ | |
27 | struct brbuf fiobuf; /* file descriptor */ | |
28 | char fbuf[256]; /* current line from file */ | |
29 | char filework[128]; /* place to put filename */ | |
30 | char *fp; /* pointer to it */ | |
31 | int nolines; /* set to 1 iff no lines in file */ | |
32 | ||
33 | /* returned by slookup */ | |
34 | char sl_name[8]; | |
35 | char sl_class; | |
36 | short sl_type; | |
37 | int sl_size, sl_addr; | |
38 | int subflag; | |
39 | ||
40 | /* procedure call information */ | |
41 | int scallx; /* procedure call in progress */ | |
42 | ADDR fps, aps, pcs; /* old stack frame */ | |
43 | BKPTR bkpts; /* old breakpoint */ | |
44 | int flagss; /* and its flags */ | |
45 | char dschar; /* '/' if value should be displayed */ | |
46 | ||
47 | /* symbol table info */ | |
48 | long ststart; /* offset of symbol table in a.out */ | |
49 | struct brbuf sbuf; /* buffer for symbol table */ | |
50 | long extstart; /* offset of first external in a.out */ | |
51 | ||
52 | /* address info */ | |
53 | ADDR dot; /* current address */ | |
54 | ADDR callpc, frame, argp; /* current stack frame */ | |
55 | ||
56 | /* other */ | |
57 | char odesc[10]; /* descriptor of last displayed variable */ | |
58 | ADDR oaddr; /* address of last displayed variable */ | |
59 | char otype; /* type of last displayed variable */ | |
60 | char oclass; /* class of last displayed variable */ | |
61 | char oincr; /* size of last displayed variable */ | |
62 | struct sgttyb sdbttym, userttym; | |
63 | /* tty modes for sdb and user */ | |
64 | char oldargs[128]; | |
65 | char prname[50]; /* print name used by outvar */ | |
66 | jmp_buf env; /* environment for setjmp, longjmp */ | |
67 | #define WINDOW 10 /* window size for display commands */ | |
68 | #define COMMANDS "\004\"+-=!/BCDRSTabcdegklmpqrstwzVXY" | |
69 | /* each sdb command must appear here */ | |
70 | int debug; /* toggled by Y command */ | |
71 | time_t symtime; /* modification time of symfil */ | |
72 | ||
73 | #define STABMASK 0376 | |
74 | ||
75 | #define NUMARGS 16 /* number of args allowed in sub call */ | |
76 | #define SUBSTSP 512 /* length of space for sub args and strings */ | |
77 | #define WORDSIZE 4 /* wordsize in bytes on this machine */ | |
78 | ||
79 | #define BIGNUM 0x7fffffff | |
80 | #define MAXADDR 1L<<30 | |
81 | ||
82 | struct filet { | |
83 | char sfilename[31]; /* source file name */ | |
84 | char lineflag; /* set iff this is a '#line' file */ | |
85 | ADDR faddr; /* address in core */ | |
86 | long stf_offset; /* offset in a.out */ | |
87 | } *files, *badfile; | |
88 | ||
89 | struct proct { | |
90 | char pname[8]; /* procedure name */ | |
91 | ADDR paddr; /* address in core */ | |
92 | long st_offset; /* offset in a.out */ | |
93 | struct filet *sfptr; /* source file name pointer */ | |
94 | int lineno; /* line number in source file */ | |
95 | char entrypt; /* 1 iff a F77 entry */ | |
96 | } *procs, *badproc; | |
97 | ||
98 | ||
99 | #define PROCINCR 20 | |
100 | #define FILEINCR 10 | |
101 | ||
102 | #define varchar(x) ((x>='A' && x<='Z') || (x>='a' && x<='z') || x == '_' || x == '.' || x == '[' || x == ']' || x == '-' || x == '>' || x == '*' || x == '?') | |
103 | #define number(x) (x >= '0' && x <= '9') | |
104 | ||
105 | char *readline(), readchar(), rdc(); | |
106 | char *cpname(); | |
107 | char *cpstr(), *cpall(); | |
108 | char *sbrk(); | |
109 | char *typetodesc(); | |
110 | int octdigit(), decdigit(); hexdigit(); | |
111 | int octconv(), decconv(); hexconv(); | |
112 | long readint(), rint(); | |
113 | long adrtostoffset(); | |
114 | long getval(), argvalue(); | |
115 | long slookup(), globallookup(); | |
116 | ADDR varaddr(), dispvar(); | |
117 | ADDR extaddr(), formaddr(), stackreg(); | |
118 | struct proct *curproc(); | |
119 | struct proct *findproc(); | |
120 | struct proct *adrtoproc(); | |
121 | struct proct *initframe(), *nextframe(); | |
122 | struct filet *findfile(), *adrtofilep(); |