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