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