aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/db/defs.h
blob: 7929cc63faf3527b2235ab7f52be60a9f8c9ade3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
 * db - common definitions
 * something of a grab-bag
 */

#include <u.h>
#include <libc.h>
#include <bio.h>
#include <ctype.h>

#include <mach.h>

typedef long WORD;
typedef u64int ADDR;

#define	HUGEINT	0x7fffffff	/* enormous WORD */

#define	MAXOFF	0x1000000
#define	INCDIR	"/usr/lib/adb"
#define	DBNAME	"db\n"
#define CMD_VERBS	"?/=>!$: \t"

typedef	int	BOOL;

#define MAXPOS	80
#define MAXLIN	128
#define	ARB	512
#define MAXCOM	64
#define MAXARG	32
#define LINSIZ	4096
#define	MAXSYM	255

#define EOR	'\n'
#define SPC	' '
#define TB	'\t'

#define	STDIN	0
#define	STDOUT	1

#define	TRUE	(-1)
#define	FALSE	0


/*
 * run modes
 */

#define	SINGLE	1
#define	CONTIN	2

/*
 * breakpoints
 */

#define	BKPTCLR	0	/* not a real breakpoint */
#define BKPTSET	1	/* real, ready to trap */
#define BKPTSKIP 2	/* real, skip over it next time */
#define	BKPTTMP	3	/* temporary; clear when it happens */

struct bkpt {
	ADDR	loc;
	uchar	save[4];
	int	count;
	int	initcnt;
	int	flag;
	char	comm[MAXCOM];
	struct bkpt *nxtbkpt;
};
typedef struct bkpt	BKPT;

#define	BADREG	(-1)

/*
 * common globals
 */

extern	WORD	adrval;
extern	vlong	expv;
extern	int	adrflg;
extern	WORD	cntval;
extern	int	cntflg;
extern	WORD	loopcnt;
extern	ADDR	maxoff;
extern	ADDR	localval;
extern	ADDR	maxfile;
extern	ADDR	maxstor;

extern	ADDR	dot;
extern	WORD	dotinc;

extern	int	xargc;

extern	BOOL	wtflag;
extern	char	*corfil, *symfil;
extern	BOOL	mkfault;
extern	BOOL	regdirty;

extern	int	pid;
extern	int	pcsactive;
#define	NNOTE 10
extern	int	nnote;
extern	char	note[NNOTE][ERRMAX];

extern	int	ending;
extern	Map	*dotmap;

extern	BKPT	*bkpthead;
extern	int	kflag;
extern	int	lastc, peekc;