kernel: new DEBUG_RACE option. try to provoke race conditions between processes.
[minix.git] / commands / mdb / mdb.h
blobe2160d196b4b55aa8fd10cc9bc496e370c555299
1 /*
2 * mdb.h for mdb
3 */
4 #define MDBVERSION "2.6"
5 #define MDBBUILD 0
7 #define MINIX_SYMBOLS 1
8 #define GNU_SYMBOLS 2
11 * Handle options here
13 #ifndef GNU_SUPPORT
14 #define GNU_SUPPORT 0
15 #endif
17 #ifndef SYSCALLS_SUPPORT
18 #define SYSCALLS_SUPPORT 0
19 #endif
21 #ifdef DEBUG
22 #undef DEBUG
23 #endif
25 #ifdef NDEBUG
26 #undef DEBUG
27 #else
28 #define DEBUG 1
29 #endif
31 #ifdef __i386
32 #define EXTRA_SYMBOLS GNU_SUPPORT
33 #else
34 #define EXTRA_SYMBOLS 0
35 #endif
38 #include <minix/config.h>
39 #include <ansi.h>
40 #include <sys/types.h>
42 #include <minix/const.h>
43 #include <minix/type.h>
45 #include <limits.h>
46 #include <errno.h>
47 #include <minix/ipc.h>
48 #include <timers.h>
50 #undef printf /* defined as printk in <minix/const.h> */
52 #if (CHIP == M68000)
53 #define __mc68000__ /* controls processor-dependent stuff */
54 #error "only the MINIX_ST 1.5.x implementation works on 68K's"
55 #endif
57 #if (CHIP == INTEL)
58 #if (MACHINE == IBM_PC)
59 #define MINIX_PC
60 #else
61 #error "only the MINIX_PC 1.5.x and later versions works on *86's"
62 #endif
63 #endif
65 #ifdef MINIX_ST
66 #define BP_OFF ((long)&((struct proc *)0)->p_reg.a6)
67 #define PC_MEMBER(rp) ((rp)->p_reg.pc)
68 #define PC_OFF ((long)&((struct proc *)0)->p_reg.pc)
69 #define SP_MEMBER(rp) ((rp)->p_reg.sp)
70 #define PSW_MEMBER(rp) ((rp)->p_reg.psw)
71 #endif
73 #ifdef MINIX_PC
74 #define BP_OFF ((long)&((struct proc *)0)->p_reg.fp)
75 #define PC_MEMBER(rp) ((rp)->p_reg.pc)
76 #define PC_OFF ((long)&((struct proc *)0)->p_reg.pc)
77 #endif
79 #define ADDRSIZE _WORD_SIZE
80 #define BITSIZE(size) (8 * (size))
81 #define INTSIZE (sizeof(int)) /* not quite right for cross-debugger */
82 #define LONGSIZE (sizeof(long))
83 #define UCHAR(x) ((x) & 0xFF)
84 #define NOSEG (-1) /* no segment */
86 /* use hardware codes for segments for simplest decoding */
87 #define CSEG 0x2E /* 8088 through 80386 */
88 #define DSEG 0x3E
90 #if (CHIP == INTEL )
91 #ifdef __i86
92 #define N_REG16 2
93 #endif
94 #ifdef __i386
95 #define N_REG16 4 /* 16 bit registers at start of stackframe */
96 #endif
97 #ifndef N_REG16
98 #error "N_REG16 not defined"
99 #endif
100 #endif
102 #if (CHIP == INTEL )
103 #define ADDA(l) ((u16_t) (l) == 0xC481)
105 #ifdef __i386
106 #define ADDA_CNT(l) ((i32_t) (l))
107 #else
108 #define ADDA_CNT(l) ((i16_t) (l))
109 #endif
111 #define ADDQ(l) ((u16_t) (l) == 0xC483)
112 #define ADDQ_CNT(l) (((((l) >> 16) + 128) & 0x000000FF) - 128)
113 #define BREAK(l) (0x000000CC | ((l) & 0xFFFFFF00))
114 #define BREAKPOINT_ADVANCE 1
115 #define INCSP2(l) ((u16_t) (l) == 0x4444)
116 #define POPBX2(l) ((u16_t) (l) == 0x5B5B)
117 #define POPBX(l) ( (l & 0xFF) == 0x5B)
119 /* Added for ANSI CC */
120 #define POPCX2(l) ((u16_t) (l) == 0x5959)
121 #define POPCX(l) ( (l & 0xFF) == 0x59)
123 #endif
125 #ifdef __mc68000__
126 #define ADDA(l) ((int)((l) >> 16) == 0xDFFC)
127 #define ADDA_CNT(l) (l)
128 #define ADDQ(l) (((l >> 16) & 0xF13F) == 0x500F)
129 #define ADDQ_CNT(l) (((((l) >> 25) - 1) & 7) + 1)
130 #define BREAK(l) (0xA0000000 | ((l) & 0xFFFF))
131 #define BREAKPOINT_ADVANCE 0
132 #define BYTES_SWAPPED /* this assumes WORDS_SWAPPED too */
133 #define LEA(l) (((l) >> 16) == 0x4FEF)
134 #define LEA_DISP(l) ((long)( l & 0xFFFF))
135 #endif
137 #define MASK(size) ((size) >= LONGSIZE ? -1L : (1L << BITSIZE(size)) - 1)
139 #ifdef BYTES_SWAPPED
140 #define SHIFT(size) BITSIZE(LONGSIZE - (size))
141 #else
142 #define SHIFT(size) (0)
143 #endif
145 #ifdef _MAIN_MDB
146 #undef EXTERN
147 #define EXTERN
148 #endif
150 extern long lbuf[]; /* buffer for proc */
152 EXTERN long st_addr; /* starting address of text */
153 EXTERN long et_addr; /* ending address of text */
154 EXTERN long sd_addr; /* starting address of data */
155 EXTERN long ed_addr; /* ending address of data */
156 EXTERN long end_addr; /* ending address of text/data */
157 EXTERN long sk_addr; /* starting address of stack */
158 EXTERN long sk_size; /* size of stack */
159 EXTERN int curpid; /* current pid of process/core */
160 EXTERN int corepid; /* pid of core file */
161 EXTERN int coreonly; /* core file only */
162 EXTERN int fileonly; /* file only */
163 EXTERN int cursig; /* current signal */
164 EXTERN int seg; /* segment */
165 EXTERN int is_separate; /* separate I & D */
166 EXTERN int paging; /* paging flag */
167 #ifdef DEBUG
168 EXTERN int debug; /* debug flag */
169 #endif
170 #if SYSCALLS_SUPPORT
171 EXTERN int syscalls; /* trace syscalls */
172 #endif
174 #ifdef _MAIN_MDB
175 #undef EXTERN
176 #define EXTERN extern
177 #endif