xref: /original-bsd/old/sdb/head.h (revision 6b7db209)
1 /* "@(#)head.h 4.3 08/17/82" */
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 */
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 int	ncolonflag;	/* set to 1 iff colon typed after number */
23 int	percentflag;	/* set to 1 iff percent symbol typed */
24 
25 /* source file i/o */
26 char	curfile[120];	/* name of file being edited */
27 int	fline;		/* line number in file */
28 char	fbuf[BUFSIZ];	/* 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 #ifdef FLEXNAMES
33 off_t	gstart;		/* start of string table in a.out */
34 char	*strtab;	/* string table from a.out * (in core!) */
35 long	ssiz;		/* size of string table (for range checks) */
36 #endif
37 
38 /* returned by slookup */
39 #ifndef FLEXNAMES
40 char	sl_name[8];
41 #else
42 char	*sl_name;
43 #endif
44 u_char	sl_class;
45 short	sl_type;
46 int	sl_size, sl_addr;
47 int	subflag;
48 
49 /* procedure call information */
50 int scallx;			/* procedure call in progress */
51 ADDR fps, aps, pcs;		/* old stack frame */
52 BKPTR bkpts;			/* old breakpoint */
53 int flagss;			/*  and its flags */
54 char dschar;			/* '/' if value should be displayed */
55 
56 /* symbol table info */
57 long	ststart;		/* offset of symbol table in a.out */
58 #ifndef VMUNIX
59 struct brbuf sbuf;		/* buffer for symbol table */
60 #endif
61 long	extstart;		/* offset of first external in a.out */
62 
63 /* address info */
64 ADDR	dot;			/* current address */
65 ADDR	callpc, frame, argp;	/* current stack frame */
66 
67 /* other */
68 char	odesc[10];		/* descriptor of last displayed variable */
69 ADDR	oaddr;			/* address of last displayed variable */
70 char	otype;			/* type of last displayed variable */
71 u_char	oclass;			/* class of last displayed variable */
72 char	oincr;			/* size of last displayed variable */
73 struct sgttyb sdbttym, userttym;
74 				/* tty modes for sdb and user */
75 char	oldargs[128];
76 char prname[50];		/* print name used by outvar */
77 jmp_buf	env;			/* environment for setjmp, longjmp */
78 int	debug;			/* toggled by Y command */
79 time_t	symtime;		/* modification time of symfil */
80 char	*symfil;
81 char	*corfil;
82 ADDR	exactaddr, lnfaddr;	/* set by adrtolineno() */
83 ADDR	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 
96 struct 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 
107 struct 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 
127 char *readline(), readchar(), rdc();
128 char *cpname();
129 char *cpstr(), *cpall();
130 char *sbrk();
131 char *typetodesc();
132 int octdigit(), decdigit(); hexdigit();
133 int octconv(), decconv(); hexconv();
134 long readint(), rint();
135 long adrtostoffset();
136 long getval(), argvalue();
137 long slookup(), globallookup();
138 ADDR varaddr(), dispvar();
139 ADDR extaddr(), formaddr(), stackreg();
140 struct proct *curproc();
141 struct proct *findproc();
142 struct proct *adrtoprocp();
143 struct proct *initframe(), *nextframe();
144 struct filet *findfile(), *adrtofilep();
145