1 /* This file has been modified by Data General Corporation, November 1989. */
12 This file provides an abstract interface to "tdesc" information.
13 It is designed to be used in a uniform manner by several kinds
15 (1) code in live debugged process (e.g., a traceback routine)
16 (2) a separate-process debugger debugging a live process
17 (3) a separate-process debugger debugging a memory dump
20 * captures machine context
21 * partial: excludes memory
24 * make one for starters, chain in reverse order to previous ones
25 * representation: pointer to opaque
36 typedef int dc_boolean_t; /* range 0 .. 1 */
41 typedef int dc_tristate_t; /* range 0 .. 2 */
47 #define DC_MII_PRECEDING_TDESC_END (1<<0)
48 #define DC_MII_FOLLOWING_TDESC_START (1<<1)
50 #define DC_MIO_ENTRY_POINT (1<< 0)
51 #define DC_MIO_PROLOGUE_END (1<< 1)
52 #define DC_MIO_EPILOGUE_START (1<< 2)
53 #define DC_MIO_IMPLICIT_PROLOGUE_END (1<<16)
54 #define DC_MIO_LITERAL_ENTRY_POINT (1<<17)
55 #define DC_MIO_LITERAL_EPILOGUE_START (1<<18)
59 A word is 32 bits of information. In memory, a word is word-aligned.
61 A common and important use of word_t is to represent values in the
62 target process, including (byte) addresses in the target process.
63 In this case, C arithmetic can be used to simulate machine address
64 arithmetic on the target. (Unsigned arithmetic is actually modulus
67 typedef unsigned int dc_word_t;
73 /* The exactness of locations may not be certainly known. */
74 typedef dc_tristate_t dc_exactness_t;
78 The model includes five kinds of contexts. Because each context
79 has an associated region and frame, these describe region kinds
80 and frame kinds as well.
81 [more description needed]
82 Currently, only call contexts exist.
85 typedef int dc_kind_t; /* range 0 .. 4 */
86 #define DC_CALL_KIND 0
87 #define DC_SAVE_KIND 1
88 #define DC_EXCEPTION_KIND 2
89 #define DC_PROTECTION_KIND 3
90 #define DC_SPECIAL_KIND 4
91 #define DC_NUM_KINDS 5
94 typedef struct dc_debug_info {
95 unsigned int protocol; /* 1 for this structure */
97 unsigned int text_words_count;
98 dc_word_t text_words_ptr;
99 unsigned int data_words_count;
100 dc_word_t data_words_ptr;
104 typedef struct dc_mstate {
105 dc_word_t reg[32]; /* general registers */
118 void error_fcn (env, continuable, message)
119 dc_word_t env; /* environment (arbitrary datum) */
120 boolean_t continuable; /* whether error function may return */
121 char *message; /* string (no trailing newline) */
123 /* In the future, we probably want the error_fcn to be: */
124 void error_fcn (env, continuable, code, ...)
125 dc_word_t env; /* environment (arbitrary datum) */
126 boolean_t continuable; /* whether error function may return */
127 int code; /* error code */
128 ... /* parameters to message associated
131 void read_fcn (env, memory, length, buffer)
132 dc_word_t env; /* environment (arbitrary datum) */
133 dc_word_t memory; /* start address in image */
134 int length; /* in bytes */
135 char *buffer; /* start address of buffer */
136 /* There are no alignment assumptions for the read function. */
138 void write_fcn (env, memory, length, buffer)
139 dc_word_t env; /* environment (arbitrary datum) */
140 dc_word_t memory; /* start address in image */
141 int length; /* in bytes */
142 char *buffer; /* start address of buffer */
143 /* There are no alignment assumptions for the write function. */
144 /* The write function is optional. It must be provided if changes
145 to writable registers are to be made. */
147 void exec_fcn (env, mstate)
148 dc_word_t env; /* environment (arbitrary datum) */
149 dc_mstate_t *mstate; /* machine state (read-write) */
150 /* The execute function is optional. It would be used (in the future)
151 by the implementation of a procedurally specified tdesc mechanism. */
158 typedef struct dc_map_info_in {
160 dc_word_t preceding_tdesc_end;
161 dc_word_t following_tdesc_start;
165 typedef struct dc_map_info_out {
167 dc_word_t entry_point;
168 dc_word_t prologue_end;
169 dc_word_t epilogue_start;
173 typedef void *dc_handle_t;
175 typedef void (*tdesc_error_fcn_type) _ARGS((
176 dc_word_t env, /* environment (arbitrary datum) */
177 dc_boolean_t continuable, /* whether error function may return */
178 const char *message /* string (no trailing newline) */
180 typedef void (*tdesc_io_fcn_type) _ARGS((
181 dc_word_t env, /* environment (arbitrary datum) */
182 dc_word_t memory, /* start address in image */
183 int length, /* in bytes */
184 void *buffer /* start address of buffer */
186 typedef void (*tdesc_exec_fcn_type) _ARGS((
187 dc_word_t env, /* environment (arbitrary datum) */
188 dc_mstate_t *mstate /* machine state (read-write) */
190 typedef void (*tdesc_map_fcn_type) _ARGS((
193 dc_map_info_in_t map_info_in,
194 dc_map_info_out_t *map_info_out
198 extern dc_handle_t dc_initiate _ARGS((
199 dc_word_t debug_info_ptr,
200 tdesc_error_fcn_type error_fcn,
202 tdesc_io_fcn_type read_fcn,
204 tdesc_io_fcn_type write_fcn, /* NULL => absent */
206 tdesc_exec_fcn_type exec_fcn, /* NULL => absent */
208 tdesc_map_fcn_type map_fcn, /* NULL => absent */
211 extern void dc_terminate _ARGS((
215 typedef int dc_register_state_t; /* range 0 to 2 */
218 #define DC_READABLE 1
219 #define DC_WRITABLE 2
221 #define DC_NUM_REG 32
224 #define DC_AUX_SXIP 1
225 #define DC_AUX_SNIP 2
226 #define DC_AUX_SFIP 3
227 #define DC_AUX_FPSR 4
228 #define DC_AUX_FPCR 5
232 typedef void *dc_dcontext_t;
234 extern dc_dcontext_t dc_make_dcontext _ARGS((
236 dc_word_t reg_info[DC_NUM_REG],
237 dc_word_t reg_flags[2],
238 dc_word_t aux_info[DC_NUM_AUX],
239 dc_word_t aux_flags[2],
240 dc_exactness_t loc_exact,
242 dc_boolean_t psr_ind,
243 dc_word_t psr_flags[2]
245 extern void dc_free_dcontext _ARGS((
246 dc_dcontext_t dcontext
248 extern dc_register_state_t dc_location_state _ARGS((
249 dc_dcontext_t dcontext
251 extern dc_exactness_t dc_location_exactness _ARGS((
252 dc_dcontext_t dcontext
254 extern dc_word_t dc_location _ARGS((
255 dc_dcontext_t dcontext
257 extern void dc_set_location _ARGS((
258 dc_dcontext_t dcontext,
261 extern dc_register_state_t dc_general_register_state _ARGS((
262 dc_dcontext_t dcontext,
265 extern dc_word_t dc_general_register _ARGS((
266 dc_dcontext_t dcontext,
269 extern void dc_set_general_register _ARGS((
270 dc_dcontext_t dcontext,
274 extern dc_register_state_t dc_auxiliary_register_state _ARGS((
275 dc_dcontext_t dcontext,
278 extern dc_word_t dc_auxiliary_register _ARGS((
279 dc_dcontext_t dcontext,
282 extern void dc_set_auxiliary_register _ARGS((
283 dc_dcontext_t dcontext,
287 extern dc_register_state_t dc_psr_register_bit_state _ARGS((
288 dc_dcontext_t dcontext,
291 extern dc_word_t dc_psr_register _ARGS((
292 dc_dcontext_t dcontext
294 extern void dc_set_psr_register _ARGS((
295 dc_dcontext_t dcontext,
299 extern dc_word_t dc_frame_address _ARGS((
300 dc_dcontext_t dcontext
302 extern dc_kind_t dc_context_kind _ARGS((
303 dc_dcontext_t dcontext
305 extern dc_register_state_t dc_return_address_state _ARGS((
306 dc_dcontext_t dcontext
308 extern dc_exactness_t dc_return_address_exactness _ARGS((
309 dc_dcontext_t dcontext
311 extern dc_word_t dc_return_address _ARGS((
312 dc_dcontext_t dcontext
314 extern void dc_set_return_address _ARGS((
315 dc_dcontext_t dcontext,
318 extern void dc_get_exception_info();
319 extern void dc_get_protection_info();
320 extern void dc_get_special_info();
321 extern dc_dcontext_t dc_previous_dcontext _ARGS((
322 dc_dcontext_t dcontext
324 extern dc_boolean_t dc_location_in_text_chunk _ARGS((
325 dc_dcontext_t dcontext,