Commit | Line | Data |
---|---|---|
7d9884b9 | 1 | /* Basic, host-specific, and target-specific definitions for GDB. |
ad3b8c4a | 2 | Copyright (C) 1986, 89, 91, 92, 93, 94, 95, 1996, 1998 |
6f54efdc | 3 | Free Software Foundation, Inc. |
bd5635a1 RP |
4 | |
5 | This file is part of GDB. | |
6 | ||
a10c0d36 | 7 | This program is free software; you can redistribute it and/or modify |
bd5635a1 | 8 | it under the terms of the GNU General Public License as published by |
a10c0d36 JG |
9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | |
bd5635a1 | 11 | |
a10c0d36 | 12 | This program is distributed in the hope that it will be useful, |
bd5635a1 RP |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
a10c0d36 | 18 | along with this program; if not, write to the Free Software |
b6d70e15 | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
bd5635a1 | 20 | |
09722039 SG |
21 | #ifndef DEFS_H |
22 | #define DEFS_H | |
d747e0af | 23 | |
a243a22f | 24 | #include "config.h" /* Generated by configure */ |
d747e0af | 25 | #include <stdio.h> |
81afee37 FF |
26 | #include <errno.h> /* System call error return status */ |
27 | ||
ad3b8c4a JM |
28 | #ifdef HAVE_STDDEF_H |
29 | # include <stddef.h> | |
30 | #else | |
31 | # include <sys/types.h> /* for size_t */ | |
32 | #endif | |
33 | ||
81afee37 FF |
34 | /* Just in case they're not defined in stdio.h. */ |
35 | ||
36 | #ifndef SEEK_SET | |
37 | #define SEEK_SET 0 | |
38 | #endif | |
39 | #ifndef SEEK_CUR | |
40 | #define SEEK_CUR 1 | |
41 | #endif | |
d747e0af MT |
42 | |
43 | /* First include ansidecl.h so we can use the various macro definitions | |
debd3443 | 44 | here and in all subsequent file inclusions. */ |
d747e0af MT |
45 | |
46 | #include "ansidecl.h" | |
47 | ||
45993f61 SC |
48 | #ifdef ANSI_PROTOTYPES |
49 | #include <stdarg.h> | |
50 | #else | |
51 | #include <varargs.h> | |
52 | #endif | |
53 | ||
97e7b66f DE |
54 | #include "libiberty.h" |
55 | ||
56 | /* libiberty.h can't declare this one, but evidently we can. */ | |
57 | extern char *strsignal PARAMS ((int)); | |
58 | ||
c023fbf4 KH |
59 | #include "progress.h" |
60 | ||
ad3b8c4a | 61 | #ifdef USE_MMALLOC |
86db943c | 62 | #include "mmalloc.h" |
031c4a7e | 63 | #endif |
86db943c | 64 | |
7343d716 JK |
65 | /* For BFD64 and bfd_vma. */ |
66 | #include "bfd.h" | |
67 | ||
68 | /* An address in the program being debugged. Host byte order. Rather | |
69 | than duplicate all the logic in BFD which figures out what type | |
70 | this is (long, long long, etc.) and whether it needs to be 64 | |
71 | bits (the host/target interactions are subtle), we just use | |
72 | bfd_vma. */ | |
73 | ||
74 | typedef bfd_vma CORE_ADDR; | |
bd5635a1 | 75 | |
28444bf3 | 76 | #ifndef min |
bd5635a1 | 77 | #define min(a, b) ((a) < (b) ? (a) : (b)) |
28444bf3 DP |
78 | #endif |
79 | #ifndef max | |
bd5635a1 | 80 | #define max(a, b) ((a) > (b) ? (a) : (b)) |
28444bf3 | 81 | #endif |
bd5635a1 | 82 | |
2e4964ad FF |
83 | /* Gdb does *lots* of string compares. Use macros to speed them up by |
84 | avoiding function calls if the first characters are not the same. */ | |
85 | ||
bd5d07d9 | 86 | #define STRCMP(a,b) (*(a) == *(b) ? strcmp ((a), (b)) : (int)*(a) - (int)*(b)) |
2e4964ad FF |
87 | #define STREQ(a,b) (*(a) == *(b) ? !strcmp ((a), (b)) : 0) |
88 | #define STREQN(a,b,c) (*(a) == *(b) ? !strncmp ((a), (b), (c)) : 0) | |
89 | ||
dd577ca5 | 90 | /* The character GNU C++ uses to build identifiers that must be unique from |
bd5635a1 RP |
91 | the program's identifiers (such as $this and $$vptr). */ |
92 | #define CPLUS_MARKER '$' /* May be overridden to '.' for SysV */ | |
93 | ||
81afee37 FF |
94 | /* Check if a character is one of the commonly used C++ marker characters. */ |
95 | extern int is_cplus_marker PARAMS ((int)); | |
bd5635a1 RP |
96 | |
97 | extern int quit_flag; | |
98 | extern int immediate_quit; | |
51b80b00 | 99 | extern int sevenbit_strings; |
d747e0af | 100 | |
6f54efdc | 101 | extern void quit PARAMS ((void)); |
bd5635a1 | 102 | |
28444bf3 DP |
103 | #ifdef QUIT |
104 | /* do twice to force compiler warning */ | |
16a43bf4 DP |
105 | #define QUIT_FIXME "FIXME" |
106 | #define QUIT_FIXME "ignoring redefinition of QUIT" | |
28444bf3 | 107 | #else |
c023fbf4 KH |
108 | #define QUIT { \ |
109 | if (quit_flag) quit (); \ | |
110 | if (interactive_hook) interactive_hook (); \ | |
111 | PROGRESS (1); \ | |
112 | } | |
28444bf3 | 113 | #endif |
bd5635a1 | 114 | |
e58de8a2 FF |
115 | /* Command classes are top-level categories into which commands are broken |
116 | down for "help" purposes. | |
117 | Notes on classes: class_alias is for alias commands which are not | |
118 | abbreviations of the original command. class-pseudo is for commands | |
119 | which are not really commands nor help topics ("stop"). */ | |
bd5635a1 RP |
120 | |
121 | enum command_class | |
122 | { | |
123 | /* Special args to help_list */ | |
124 | all_classes = -2, all_commands = -1, | |
125 | /* Classes of commands */ | |
126 | no_class = -1, class_run = 0, class_vars, class_stack, | |
7e9576e0 | 127 | class_files, class_support, class_info, class_breakpoint, class_trace, |
e58de8a2 FF |
128 | class_alias, class_obscure, class_user, class_maintenance, |
129 | class_pseudo | |
bd5635a1 RP |
130 | }; |
131 | ||
bd5d07d9 FF |
132 | /* Languages represented in the symbol table and elsewhere. |
133 | This should probably be in language.h, but since enum's can't | |
134 | be forward declared to satisfy opaque references before their | |
135 | actual definition, needs to be here. */ | |
136 | ||
137 | enum language | |
138 | { | |
139 | language_unknown, /* Language not known */ | |
140 | language_auto, /* Placeholder for automatic setting */ | |
141 | language_c, /* C */ | |
142 | language_cplus, /* C++ */ | |
ad3b8c4a | 143 | /* start-sanitize-java */ |
7a9eb4c4 | 144 | language_java, /* Java */ |
ad3b8c4a | 145 | /* end-sanitize-java */ |
bd5d07d9 | 146 | language_chill, /* Chill */ |
e52bfe0c | 147 | language_fortran, /* Fortran */ |
754e5da2 | 148 | language_m2, /* Modula-2 */ |
0e4ca328 PB |
149 | language_asm, /* Assembly language */ |
150 | language_scm /* Scheme / Guile */ | |
bd5d07d9 FF |
151 | }; |
152 | ||
bd5635a1 RP |
153 | /* the cleanup list records things that have to be undone |
154 | if an error happens (descriptors to be closed, memory to be freed, etc.) | |
155 | Each link in the chain records a function to call and an | |
156 | argument to give it. | |
157 | ||
158 | Use make_cleanup to add an element to the cleanup chain. | |
159 | Use do_cleanups to do all cleanup actions back to a given | |
160 | point in the chain. Use discard_cleanups to remove cleanups | |
161 | from the chain back to a given point, not doing them. */ | |
162 | ||
163 | struct cleanup | |
164 | { | |
165 | struct cleanup *next; | |
d747e0af MT |
166 | void (*function) PARAMS ((PTR)); |
167 | PTR arg; | |
bd5635a1 RP |
168 | }; |
169 | ||
413cba82 JL |
170 | |
171 | /* The ability to declare that a function never returns is useful, but | |
172 | not really required to compile GDB successfully, so the NORETURN and | |
173 | ATTR_NORETURN macros normally expand into nothing. */ | |
174 | ||
175 | /* If compiling with older versions of GCC, a function may be declared | |
176 | "volatile" to indicate that it does not return. */ | |
177 | ||
178 | #ifndef NORETURN | |
179 | # if defined(__GNUC__) \ | |
b6d70e15 | 180 | && (__GNUC__ == 1 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)) |
413cba82 JL |
181 | # define NORETURN volatile |
182 | # else | |
183 | # define NORETURN /* nothing */ | |
184 | # endif | |
185 | #endif | |
186 | ||
187 | /* GCC 2.5 and later versions define a function attribute "noreturn", | |
b6d70e15 SC |
188 | which is the preferred way to declare that a function never returns. |
189 | However GCC 2.7 appears to be the first version in which this fully | |
190 | works everywhere we use it. */ | |
413cba82 JL |
191 | |
192 | #ifndef ATTR_NORETURN | |
b6d70e15 | 193 | # if defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 7 |
413cba82 JL |
194 | # define ATTR_NORETURN __attribute__ ((noreturn)) |
195 | # else | |
196 | # define ATTR_NORETURN /* nothing */ | |
197 | # endif | |
198 | #endif | |
199 | ||
200 | #ifndef ATTR_FORMAT | |
b6d70e15 | 201 | # if defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 4 && defined (__ANSI_PROTOTYPES) |
413cba82 JL |
202 | # define ATTR_FORMAT(type, x, y) __attribute__ ((format(type, x, y))) |
203 | # else | |
204 | # define ATTR_FORMAT(type, x, y) /* nothing */ | |
205 | # endif | |
206 | #endif | |
207 | ||
637b1661 SG |
208 | /* Needed for various prototypes */ |
209 | ||
210 | #ifdef __STDC__ | |
211 | struct symtab; | |
212 | struct breakpoint; | |
213 | #endif | |
214 | ||
d747e0af MT |
215 | /* From blockframe.c */ |
216 | ||
6f54efdc | 217 | extern int inside_entry_func PARAMS ((CORE_ADDR)); |
d747e0af | 218 | |
6f54efdc | 219 | extern int inside_entry_file PARAMS ((CORE_ADDR addr)); |
d747e0af | 220 | |
6f54efdc | 221 | extern int inside_main_func PARAMS ((CORE_ADDR pc)); |
d747e0af | 222 | |
ad3b8c4a JM |
223 | extern void _initialize_blockframe PARAMS ((void)); |
224 | ||
7532cf10 FF |
225 | /* From ch-lang.c, for the moment. (FIXME) */ |
226 | ||
6f54efdc | 227 | extern char *chill_demangle PARAMS ((const char *)); |
7532cf10 | 228 | |
d747e0af MT |
229 | /* From utils.c */ |
230 | ||
b607efe7 FF |
231 | extern void notice_quit PARAMS ((void)); |
232 | ||
6f54efdc | 233 | extern int strcmp_iw PARAMS ((const char *, const char *)); |
d630b615 | 234 | |
6f54efdc | 235 | extern char *safe_strerror PARAMS ((int)); |
e146177e | 236 | |
6f54efdc | 237 | extern char *safe_strsignal PARAMS ((int)); |
e146177e | 238 | |
6f54efdc | 239 | extern void init_malloc PARAMS ((void *)); |
d747e0af | 240 | |
6f54efdc | 241 | extern void request_quit PARAMS ((int)); |
d747e0af | 242 | |
6f54efdc | 243 | extern void do_cleanups PARAMS ((struct cleanup *)); |
16a43bf4 | 244 | extern void do_final_cleanups PARAMS ((struct cleanup *)); |
7a9eb4c4 | 245 | extern void do_my_cleanups PARAMS ((struct cleanup **, struct cleanup *)); |
d747e0af | 246 | |
6f54efdc | 247 | extern void discard_cleanups PARAMS ((struct cleanup *)); |
16a43bf4 | 248 | extern void discard_final_cleanups PARAMS ((struct cleanup *)); |
7a9eb4c4 | 249 | extern void discard_my_cleanups PARAMS ((struct cleanup **, struct cleanup *)); |
d747e0af | 250 | |
ad3b8c4a | 251 | typedef void (*make_cleanup_func) (void *); |
d747e0af | 252 | |
d747e0af | 253 | extern struct cleanup * |
ad3b8c4a | 254 | make_cleanup PARAMS ((make_cleanup_func, void *)); |
d747e0af | 255 | |
16a43bf4 DP |
256 | extern struct cleanup * |
257 | make_final_cleanup PARAMS ((void (*function) (void *), void *)); | |
ad3b8c4a | 258 | |
16a43bf4 | 259 | extern struct cleanup * |
7a9eb4c4 | 260 | make_my_cleanup PARAMS ((struct cleanup **, void (*function) (void *), void *)); |
d747e0af | 261 | |
ad3b8c4a JM |
262 | extern struct cleanup * |
263 | make_run_cleanup PARAMS ((void (*function) (void *), void *)); | |
264 | ||
6f54efdc | 265 | extern struct cleanup *save_cleanups PARAMS ((void)); |
16a43bf4 | 266 | extern struct cleanup *save_final_cleanups PARAMS ((void)); |
7a9eb4c4 | 267 | extern struct cleanup *save_my_cleanups PARAMS ((struct cleanup **)); |
d747e0af | 268 | |
6f54efdc | 269 | extern void restore_cleanups PARAMS ((struct cleanup *)); |
16a43bf4 | 270 | extern void restore_final_cleanups PARAMS ((struct cleanup *)); |
7a9eb4c4 | 271 | extern void restore_my_cleanups PARAMS ((struct cleanup **, struct cleanup *)); |
d747e0af | 272 | |
6f54efdc | 273 | extern void free_current_contents PARAMS ((char **)); |
d747e0af | 274 | |
b607efe7 | 275 | extern void null_cleanup PARAMS ((PTR)); |
d747e0af | 276 | |
6f54efdc | 277 | extern int myread PARAMS ((int, char *, int)); |
d747e0af | 278 | |
413cba82 JL |
279 | extern int query PARAMS((char *, ...)) |
280 | ATTR_FORMAT(printf, 1, 2); | |
b607efe7 | 281 | |
ad3b8c4a JM |
282 | #if !defined (USE_MMALLOC) |
283 | extern PTR mmalloc PARAMS ((PTR, size_t)); | |
284 | extern PTR mrealloc PARAMS ((PTR, PTR, size_t)); | |
285 | extern void mfree PARAMS ((PTR, PTR)); | |
286 | #endif | |
287 | ||
b607efe7 FF |
288 | /* From demangle.c */ |
289 | ||
290 | extern void set_demangling_style PARAMS ((char *)); | |
291 | ||
6c803036 | 292 | \f |
96f7edbd JK |
293 | /* Annotation stuff. */ |
294 | ||
6c803036 JK |
295 | extern int annotation_level; /* in stack.c */ |
296 | \f | |
6f54efdc | 297 | extern void begin_line PARAMS ((void)); |
51b80b00 | 298 | |
6f54efdc | 299 | extern void wrap_here PARAMS ((char *)); |
d747e0af | 300 | |
6f54efdc | 301 | extern void reinitialize_more_filter PARAMS ((void)); |
d747e0af | 302 | |
04f566a3 JK |
303 | typedef FILE GDB_FILE; |
304 | #define gdb_stdout stdout | |
305 | #define gdb_stderr stderr | |
306 | ||
6f54efdc | 307 | extern void gdb_flush PARAMS ((GDB_FILE *)); |
04f566a3 | 308 | |
6f54efdc | 309 | extern GDB_FILE *gdb_fopen PARAMS ((char * name, char * mode)); |
04f566a3 | 310 | |
6f54efdc | 311 | extern void fputs_filtered PARAMS ((const char *, GDB_FILE *)); |
04f566a3 | 312 | |
6f54efdc | 313 | extern void fputs_unfiltered PARAMS ((const char *, GDB_FILE *)); |
d747e0af | 314 | |
ad3b8c4a JM |
315 | extern int fputc_filtered PARAMS ((int c, GDB_FILE *)); |
316 | ||
8989d4fc | 317 | extern int fputc_unfiltered PARAMS ((int c, GDB_FILE *)); |
04f566a3 | 318 | |
8989d4fc | 319 | extern int putchar_unfiltered PARAMS ((int c)); |
d747e0af | 320 | |
81afee37 | 321 | extern void puts_filtered PARAMS ((const char *)); |
d747e0af | 322 | |
81afee37 | 323 | extern void puts_unfiltered PARAMS ((const char *)); |
04f566a3 | 324 | |
7e9576e0 MA |
325 | extern void puts_debug PARAMS ((char *prefix, char *string, char *suffix)); |
326 | ||
81afee37 | 327 | extern void vprintf_filtered PARAMS ((const char *, va_list)) |
413cba82 | 328 | ATTR_FORMAT(printf, 1, 0); |
51b80b00 | 329 | |
81afee37 | 330 | extern void vfprintf_filtered PARAMS ((FILE *, const char *, va_list)) |
413cba82 | 331 | ATTR_FORMAT(printf, 2, 0); |
a8e033f2 | 332 | |
81afee37 | 333 | extern void fprintf_filtered PARAMS ((FILE *, const char *, ...)) |
413cba82 | 334 | ATTR_FORMAT(printf, 2, 3); |
d747e0af | 335 | |
81afee37 | 336 | extern void fprintfi_filtered PARAMS ((int, FILE *, const char *, ...)) |
413cba82 | 337 | ATTR_FORMAT(printf, 3, 4); |
a8e033f2 | 338 | |
81afee37 | 339 | extern void printf_filtered PARAMS ((const char *, ...)) |
413cba82 | 340 | ATTR_FORMAT(printf, 1, 2); |
d747e0af | 341 | |
81afee37 | 342 | extern void printfi_filtered PARAMS ((int, const char *, ...)) |
413cba82 | 343 | ATTR_FORMAT(printf, 2, 3); |
a8e033f2 | 344 | |
81afee37 | 345 | extern void vprintf_unfiltered PARAMS ((const char *, va_list)) |
413cba82 | 346 | ATTR_FORMAT(printf, 1, 0); |
04f566a3 | 347 | |
81afee37 | 348 | extern void vfprintf_unfiltered PARAMS ((FILE *, const char *, va_list)) |
413cba82 | 349 | ATTR_FORMAT(printf, 2, 0); |
04f566a3 | 350 | |
81afee37 | 351 | extern void fprintf_unfiltered PARAMS ((FILE *, const char *, ...)) |
413cba82 | 352 | ATTR_FORMAT(printf, 2, 3); |
d747e0af | 353 | |
81afee37 | 354 | extern void printf_unfiltered PARAMS ((const char *, ...)) |
413cba82 | 355 | ATTR_FORMAT(printf, 1, 2); |
04f566a3 | 356 | |
6f54efdc | 357 | extern void print_spaces PARAMS ((int, GDB_FILE *)); |
04f566a3 | 358 | |
6f54efdc | 359 | extern void print_spaces_filtered PARAMS ((int, GDB_FILE *)); |
d747e0af | 360 | |
6f54efdc | 361 | extern char *n_spaces PARAMS ((int)); |
d747e0af | 362 | |
6f54efdc | 363 | extern void gdb_printchar PARAMS ((int, GDB_FILE *, int)); |
d747e0af | 364 | |
833e0d94 JK |
365 | extern void gdb_print_address PARAMS ((void *, GDB_FILE *)); |
366 | ||
28444bf3 DP |
367 | typedef bfd_vma t_addr; |
368 | typedef bfd_vma t_reg; | |
369 | extern char* paddr PARAMS ((t_addr addr)); | |
370 | ||
371 | extern char* preg PARAMS ((t_reg reg)); | |
372 | ||
16a43bf4 DP |
373 | extern char* paddr_nz PARAMS ((t_addr addr)); |
374 | ||
375 | extern char* preg_nz PARAMS ((t_reg reg)); | |
376 | ||
6f54efdc SS |
377 | extern void fprintf_symbol_filtered PARAMS ((GDB_FILE *, char *, |
378 | enum language, int)); | |
d747e0af | 379 | |
56e327b3 | 380 | extern NORETURN void perror_with_name PARAMS ((char *)) ATTR_NORETURN; |
d747e0af | 381 | |
6f54efdc | 382 | extern void print_sys_errmsg PARAMS ((char *, int)); |
d747e0af | 383 | |
ad3b8c4a JM |
384 | extern void _initialize_stack PARAMS ((void)); |
385 | ||
1bef45ea JK |
386 | /* From regex.c or libc. BSD 4.4 declares this with the argument type as |
387 | "const char *" in unistd.h, so we can't declare the argument | |
388 | as "char *". */ | |
d747e0af | 389 | |
6f54efdc | 390 | extern char *re_comp PARAMS ((const char *)); |
d747e0af MT |
391 | |
392 | /* From symfile.c */ | |
393 | ||
6f54efdc | 394 | extern void symbol_file_command PARAMS ((char *, int)); |
d747e0af | 395 | |
eba08643 | 396 | /* From top.c */ |
d747e0af | 397 | |
6f54efdc | 398 | extern char *skip_quoted PARAMS ((char *)); |
d630b615 | 399 | |
6f54efdc | 400 | extern char *gdb_readline PARAMS ((char *)); |
d747e0af | 401 | |
6f54efdc | 402 | extern char *command_line_input PARAMS ((char *, int, char *)); |
d747e0af | 403 | |
6f54efdc | 404 | extern void print_prompt PARAMS ((void)); |
d747e0af | 405 | |
6f54efdc | 406 | extern int input_from_terminal_p PARAMS ((void)); |
d747e0af | 407 | |
eba08643 C |
408 | extern int info_verbose; |
409 | ||
bd5635a1 | 410 | /* From printcmd.c */ |
d747e0af | 411 | |
6f54efdc | 412 | extern void set_next_address PARAMS ((CORE_ADDR)); |
d747e0af | 413 | |
6f54efdc SS |
414 | extern void print_address_symbolic PARAMS ((CORE_ADDR, GDB_FILE *, int, |
415 | char *)); | |
d747e0af | 416 | |
6f54efdc | 417 | extern void print_address_numeric PARAMS ((CORE_ADDR, int, GDB_FILE *)); |
833e0d94 | 418 | |
6f54efdc | 419 | extern void print_address PARAMS ((CORE_ADDR, GDB_FILE *)); |
bd5635a1 | 420 | |
ad3b8c4a JM |
421 | extern void _initialize_printcmd PARAMS ((void)); |
422 | ||
e1ce8aa5 | 423 | /* From source.c */ |
d747e0af | 424 | |
6f54efdc | 425 | extern int openp PARAMS ((char *, int, char *, int, int, char **)); |
d747e0af | 426 | |
6f54efdc | 427 | extern void mod_path PARAMS ((char *, char **)); |
d747e0af | 428 | |
6f54efdc | 429 | extern void directory_command PARAMS ((char *, int)); |
d747e0af | 430 | |
6f54efdc | 431 | extern void init_source_path PARAMS ((void)); |
d747e0af | 432 | |
637b1661 SG |
433 | extern char *symtab_to_filename PARAMS ((struct symtab *)); |
434 | ||
d747e0af MT |
435 | /* From findvar.c */ |
436 | ||
6f54efdc | 437 | extern int read_relative_register_raw_bytes PARAMS ((int, char *)); |
e1ce8aa5 | 438 | |
bd5635a1 | 439 | /* From readline (but not in any readline .h files). */ |
d747e0af | 440 | |
6f54efdc | 441 | extern char *tilde_expand PARAMS ((char *)); |
bd5635a1 | 442 | |
78751d4f PS |
443 | /* Control types for commands */ |
444 | ||
445 | enum misc_command_type | |
446 | { | |
447 | ok_command, | |
448 | end_command, | |
449 | else_command, | |
450 | nop_command | |
451 | }; | |
452 | ||
453 | enum command_control_type | |
454 | { | |
455 | simple_control, | |
456 | break_control, | |
457 | continue_control, | |
458 | while_control, | |
459 | if_control, | |
460 | invalid_control | |
461 | }; | |
462 | ||
bd5635a1 RP |
463 | /* Structure for saved commands lines |
464 | (for breakpoints, defined commands, etc). */ | |
465 | ||
466 | struct command_line | |
467 | { | |
468 | struct command_line *next; | |
469 | char *line; | |
78751d4f PS |
470 | enum command_control_type control_type; |
471 | int body_count; | |
472 | struct command_line **body_list; | |
bd5635a1 RP |
473 | }; |
474 | ||
91550191 | 475 | extern struct command_line *read_command_lines PARAMS ((char *, int)); |
d747e0af | 476 | |
6f54efdc | 477 | extern void free_command_lines PARAMS ((struct command_line **)); |
bd5635a1 RP |
478 | |
479 | /* String containing the current directory (what getwd would return). */ | |
480 | ||
d747e0af | 481 | extern char *current_directory; |
bd5635a1 RP |
482 | |
483 | /* Default radixes for input and output. Only some values supported. */ | |
484 | extern unsigned input_radix; | |
485 | extern unsigned output_radix; | |
486 | ||
a8a69e63 FF |
487 | /* Possibilities for prettyprint parameters to routines which print |
488 | things. Like enum language, this should be in value.h, but needs | |
489 | to be here for the same reason. FIXME: If we can eliminate this | |
490 | as an arg to LA_VAL_PRINT, then we can probably move it back to | |
491 | value.h. */ | |
492 | ||
493 | enum val_prettyprint | |
494 | { | |
495 | Val_no_prettyprint = 0, | |
496 | Val_prettyprint, | |
497 | /* Use the default setting which the user has specified. */ | |
498 | Val_pretty_default | |
499 | }; | |
500 | ||
0a5d35ed SG |
501 | \f |
502 | /* Host machine definition. This will be a symlink to one of the | |
503 | xm-*.h files, built by the `configure' script. */ | |
504 | ||
505 | #include "xm.h" | |
506 | ||
e58de8a2 FF |
507 | /* Native machine support. This will be a symlink to one of the |
508 | nm-*.h files, built by the `configure' script. */ | |
509 | ||
510 | #include "nm.h" | |
511 | ||
c023fbf4 KH |
512 | /* Target machine definition. This will be a symlink to one of the |
513 | tm-*.h files, built by the `configure' script. */ | |
514 | ||
515 | #include "tm.h" | |
516 | ||
e146177e SEF |
517 | /* If the xm.h file did not define the mode string used to open the |
518 | files, assume that binary files are opened the same way as text | |
519 | files */ | |
520 | #ifndef FOPEN_RB | |
521 | #include "fopen-same.h" | |
522 | #endif | |
523 | ||
b51843d8 FF |
524 | /* Microsoft C can't deal with const pointers */ |
525 | ||
526 | #ifdef _MSC_VER | |
527 | #define CONST_PTR | |
528 | #else | |
529 | #define CONST_PTR const | |
530 | #endif | |
531 | ||
0a5d35ed | 532 | /* |
b51843d8 FF |
533 | * Allow things in gdb to be declared "volatile". If compiling ANSI, it |
534 | * just works. If compiling with gcc but non-ansi, redefine to __volatile__. | |
535 | * If non-ansi, non-gcc, then eliminate "volatile" entirely, making those | |
0a5d35ed SG |
536 | * objects be read-write rather than read-only. |
537 | */ | |
538 | ||
0a5d35ed SG |
539 | #ifndef volatile |
540 | #ifndef __STDC__ | |
541 | # ifdef __GNUC__ | |
542 | # define volatile __volatile__ | |
543 | # else | |
544 | # define volatile /*nothing*/ | |
545 | # endif /* GNUC */ | |
546 | #endif /* STDC */ | |
547 | #endif /* volatile */ | |
548 | ||
3f550b59 FF |
549 | /* Defaults for system-wide constants (if not defined by xm.h, we fake it). |
550 | FIXME: Assumes 2's complement arithmetic */ | |
0a5d35ed | 551 | |
bd5635a1 | 552 | #if !defined (UINT_MAX) |
38dc5e12 | 553 | #define UINT_MAX ((unsigned int)(~0)) /* 0xFFFFFFFF for 32-bits */ |
bd5635a1 RP |
554 | #endif |
555 | ||
e1ce8aa5 | 556 | #if !defined (INT_MAX) |
dd577ca5 | 557 | #define INT_MAX ((int)(UINT_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */ |
e1ce8aa5 JK |
558 | #endif |
559 | ||
560 | #if !defined (INT_MIN) | |
3f550b59 | 561 | #define INT_MIN ((int)((int) ~0 ^ INT_MAX)) /* 0x80000000 for 32-bits */ |
38dc5e12 SG |
562 | #endif |
563 | ||
564 | #if !defined (ULONG_MAX) | |
565 | #define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF for 32-bits */ | |
566 | #endif | |
567 | ||
568 | #if !defined (LONG_MAX) | |
569 | #define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */ | |
e1ce8aa5 JK |
570 | #endif |
571 | ||
7a9eb4c4 PB |
572 | #ifndef LONGEST |
573 | ||
7343d716 JK |
574 | #ifdef BFD64 |
575 | ||
576 | /* This is to make sure that LONGEST is at least as big as CORE_ADDR. */ | |
577 | ||
70126bf9 | 578 | #define LONGEST BFD_HOST_64_BIT |
16a43bf4 | 579 | #define ULONGEST BFD_HOST_U_64_BIT |
7343d716 JK |
580 | |
581 | #else /* No BFD64 */ | |
582 | ||
7efb57c3 FF |
583 | # ifdef CC_HAS_LONG_LONG |
584 | # define LONGEST long long | |
16a43bf4 | 585 | # define ULONGEST unsigned long long |
7efb57c3 | 586 | # else |
7a9eb4c4 PB |
587 | /* BFD_HOST_64_BIT is defined for some hosts that don't have long long |
588 | (e.g. i386-windows) so try it. */ | |
589 | # ifdef BFD_HOST_64_BIT | |
590 | # define LONGEST BFD_HOST_64_BIT | |
591 | # define ULONGEST BFD_HOST_U_64_BIT | |
592 | # else | |
593 | # define LONGEST long | |
594 | # define ULONGEST unsigned long | |
595 | # endif | |
7efb57c3 | 596 | # endif |
7efb57c3 | 597 | |
7343d716 JK |
598 | #endif /* No BFD64 */ |
599 | ||
7a9eb4c4 PB |
600 | #endif /* ! LONGEST */ |
601 | ||
7efb57c3 FF |
602 | /* Convert a LONGEST to an int. This is used in contexts (e.g. number of |
603 | arguments to a function, number in a value history, register number, etc.) | |
604 | where the value must not be larger than can fit in an int. */ | |
605 | ||
fb0f4231 | 606 | extern int longest_to_int PARAMS ((LONGEST)); |
d747e0af | 607 | |
0a5d35ed SG |
608 | /* Assorted functions we can declare, now that const and volatile are |
609 | defined. */ | |
d747e0af | 610 | |
6f54efdc | 611 | extern char *savestring PARAMS ((const char *, int)); |
d747e0af | 612 | |
6f54efdc | 613 | extern char *msavestring PARAMS ((void *, const char *, int)); |
318bf84f | 614 | |
6f54efdc | 615 | extern char *strsave PARAMS ((const char *)); |
d747e0af | 616 | |
6f54efdc | 617 | extern char *mstrsave PARAMS ((void *, const char *)); |
318bf84f | 618 | |
cad9cd60 | 619 | #ifdef _MSC_VER /* FIXME; was long, but this causes compile errors in msvc if already defined */ |
28444bf3 DP |
620 | extern PTR xmmalloc PARAMS ((PTR, size_t)); |
621 | ||
622 | extern PTR xmrealloc PARAMS ((PTR, PTR, size_t)); | |
623 | #else | |
6f54efdc | 624 | extern PTR xmmalloc PARAMS ((PTR, long)); |
318bf84f | 625 | |
6f54efdc | 626 | extern PTR xmrealloc PARAMS ((PTR, PTR, long)); |
28444bf3 | 627 | #endif |
318bf84f | 628 | |
6f54efdc | 629 | extern int parse_escape PARAMS ((char **)); |
d747e0af | 630 | |
86db943c | 631 | extern char *reg_names[]; |
d747e0af | 632 | |
833e0d94 JK |
633 | /* Message to be printed before the error message, when an error occurs. */ |
634 | ||
635 | extern char *error_pre_print; | |
636 | ||
8989d4fc JK |
637 | /* Message to be printed before the error message, when an error occurs. */ |
638 | ||
639 | extern char *quit_pre_print; | |
640 | ||
833e0d94 JK |
641 | /* Message to be printed before the warning message, when a warning occurs. */ |
642 | ||
643 | extern char *warning_pre_print; | |
644 | ||
56e327b3 | 645 | extern NORETURN void error PARAMS((const char *, ...)) ATTR_NORETURN; |
a0cf4681 JK |
646 | |
647 | extern void error_begin PARAMS ((void)); | |
d747e0af | 648 | |
85c613aa | 649 | extern NORETURN void fatal PARAMS((char *, ...)) ATTR_NORETURN; |
d747e0af | 650 | |
6f54efdc | 651 | extern NORETURN void nomem PARAMS ((long)) ATTR_NORETURN; |
318bf84f | 652 | |
2fcdae93 PS |
653 | /* Reasons for calling return_to_top_level. */ |
654 | enum return_reason { | |
655 | /* User interrupt. */ | |
656 | RETURN_QUIT, | |
657 | ||
658 | /* Any other error. */ | |
659 | RETURN_ERROR | |
660 | }; | |
661 | ||
662 | #define RETURN_MASK_QUIT (1 << (int)RETURN_QUIT) | |
663 | #define RETURN_MASK_ERROR (1 << (int)RETURN_ERROR) | |
664 | #define RETURN_MASK_ALL (RETURN_MASK_QUIT | RETURN_MASK_ERROR) | |
665 | typedef int return_mask; | |
666 | ||
6f54efdc SS |
667 | extern NORETURN void |
668 | return_to_top_level PARAMS ((enum return_reason)) ATTR_NORETURN; | |
2fcdae93 | 669 | |
6f54efdc SS |
670 | extern int |
671 | catch_errors PARAMS ((int (*) (char *), void *, char *, return_mask)); | |
d747e0af | 672 | |
8989d4fc | 673 | extern void warning_begin PARAMS ((void)); |
d747e0af | 674 | |
56e327b3 | 675 | extern void warning PARAMS ((const char *, ...)) |
413cba82 | 676 | ATTR_FORMAT(printf, 1, 2); |
d747e0af | 677 | |
97e7b66f DE |
678 | /* Global functions from other, non-gdb GNU thingies. |
679 | Libiberty thingies are no longer declared here. We include libiberty.h | |
680 | above, instead. */ | |
d747e0af | 681 | |
6b009ef6 | 682 | #ifndef GETENV_PROVIDED |
6f54efdc | 683 | extern char *getenv PARAMS ((const char *)); |
6b009ef6 | 684 | #endif |
d747e0af | 685 | |
e146177e SEF |
686 | /* From other system libraries */ |
687 | ||
b51843d8 | 688 | #ifdef HAVE_STDDEF_H |
d747e0af | 689 | #include <stddef.h> |
b51843d8 FF |
690 | #endif |
691 | ||
692 | #ifdef HAVE_STDLIB_H | |
28444bf3 DP |
693 | #if defined(_MSC_VER) && !defined(__cplusplus) |
694 | /* msvc defines these in stdlib.h for c code */ | |
695 | #undef min | |
696 | #undef max | |
697 | #endif | |
e3be225e | 698 | #include <stdlib.h> |
0a5d35ed | 699 | #endif |
28444bf3 DP |
700 | #ifndef min |
701 | #define min(a, b) ((a) < (b) ? (a) : (b)) | |
702 | #endif | |
703 | #ifndef max | |
704 | #define max(a, b) ((a) > (b) ? (a) : (b)) | |
705 | #endif | |
d747e0af | 706 | |
6b009ef6 SC |
707 | |
708 | /* We take the address of fclose later, but some stdio's forget | |
709 | to declare this. We can't always declare it since there's | |
710 | no way to declare the parameters without upsetting some compiler | |
711 | somewhere. */ | |
712 | ||
713 | #ifndef FCLOSE_PROVIDED | |
b607efe7 | 714 | extern int fclose PARAMS ((FILE *)); |
6b009ef6 | 715 | #endif |
e146177e | 716 | |
8989d4fc | 717 | #ifndef atof |
b607efe7 | 718 | extern double atof PARAMS ((const char *)); /* X3.159-1989 4.10.1.1 */ |
8989d4fc | 719 | #endif |
51b57ded | 720 | |
d747e0af | 721 | #ifndef MALLOC_INCOMPATIBLE |
318bf84f | 722 | |
b51843d8 | 723 | #ifdef NEED_DECLARATION_MALLOC |
e3be225e | 724 | extern PTR malloc (); |
b51843d8 | 725 | #endif |
d747e0af | 726 | |
b51843d8 | 727 | #ifdef NEED_DECLARATION_REALLOC |
e3be225e | 728 | extern PTR realloc (); |
b51843d8 | 729 | #endif |
318bf84f | 730 | |
b51843d8 | 731 | #ifdef NEED_DECLARATION_FREE |
e3be225e | 732 | extern void free (); |
b51843d8 | 733 | #endif |
d747e0af | 734 | |
e3be225e | 735 | #endif /* MALLOC_INCOMPATIBLE */ |
d747e0af | 736 | |
0a5d35ed SG |
737 | /* Various possibilities for alloca. */ |
738 | #ifndef alloca | |
739 | # ifdef __GNUC__ | |
740 | # define alloca __builtin_alloca | |
7343d716 | 741 | # else /* Not GNU C */ |
ad3b8c4a JM |
742 | # ifdef HAVE_ALLOCA_H |
743 | # include <alloca.h> | |
744 | # else | |
745 | # ifdef _AIX | |
746 | #pragma alloca | |
747 | # else | |
7343d716 JK |
748 | |
749 | /* We need to be careful not to declare this in a way which conflicts with | |
750 | bison. Bison never declares it as char *, but under various circumstances | |
751 | (like __hpux) we need to use void *. */ | |
ad3b8c4a | 752 | # if defined (__STDC__) || defined (__hpux) |
7343d716 | 753 | extern void *alloca (); |
ad3b8c4a | 754 | # else /* Don't use void *. */ |
0f552c5f | 755 | extern char *alloca (); |
ad3b8c4a JM |
756 | # endif /* Don't use void *. */ |
757 | # endif /* Not _AIX */ | |
758 | # endif /* Not HAVE_ALLOCA_H */ | |
7343d716 JK |
759 | # endif /* Not GNU C */ |
760 | #endif /* alloca not defined */ | |
e2aab031 | 761 | |
479f0f18 | 762 | /* HOST_BYTE_ORDER must be defined to one of these. */ |
a10c0d36 | 763 | |
d8efbc66 FF |
764 | #ifdef HAVE_ENDIAN_H |
765 | #include <endian.h> | |
766 | #endif | |
767 | ||
0a5d35ed SG |
768 | #if !defined (BIG_ENDIAN) |
769 | #define BIG_ENDIAN 4321 | |
770 | #endif | |
a10c0d36 | 771 | |
0a5d35ed SG |
772 | #if !defined (LITTLE_ENDIAN) |
773 | #define LITTLE_ENDIAN 1234 | |
774 | #endif | |
a10c0d36 | 775 | |
2fcdae93 | 776 | /* Target-system-dependent parameters for GDB. */ |
7d9884b9 | 777 | |
479f0f18 SG |
778 | #ifdef TARGET_BYTE_ORDER_SELECTABLE |
779 | /* The target endianness is selectable at runtime. Define | |
780 | TARGET_BYTE_ORDER to be a variable. The user can use the `set | |
781 | endian' command to change it. */ | |
782 | #undef TARGET_BYTE_ORDER | |
783 | #define TARGET_BYTE_ORDER target_byte_order | |
784 | extern int target_byte_order; | |
750b7942 AC |
785 | /* Nonzero when target_byte_order auto-detected */ |
786 | extern int target_byte_order_auto; | |
479f0f18 SG |
787 | #endif |
788 | ||
789 | extern void set_endian_from_file PARAMS ((bfd *)); | |
790 | ||
d0aba53f AC |
791 | /* The target architecture can be set at run-time. */ |
792 | extern int target_architecture_auto; | |
793 | extern const bfd_arch_info_type *target_architecture; | |
794 | extern void set_architecture_from_file PARAMS ((bfd *)); | |
795 | /* Notify target of a change to the selected architecture. Zero return | |
796 | status indicates that the target did not like the change. */ | |
797 | extern int (*target_architecture_hook) PARAMS ((const bfd_arch_info_type *ap)); | |
7e9576e0 | 798 | extern void set_architecture_from_arch_mach PARAMS ((enum bfd_architecture arch, unsigned long mach)); |
d0aba53f | 799 | |
04f566a3 JK |
800 | /* Number of bits in a char or unsigned char for the target machine. |
801 | Just like CHAR_BIT in <limits.h> but describes the target machine. */ | |
802 | #if !defined (TARGET_CHAR_BIT) | |
803 | #define TARGET_CHAR_BIT 8 | |
804 | #endif | |
805 | ||
806 | /* Number of bits in a short or unsigned short for the target machine. */ | |
807 | #if !defined (TARGET_SHORT_BIT) | |
808 | #define TARGET_SHORT_BIT (2 * TARGET_CHAR_BIT) | |
809 | #endif | |
810 | ||
811 | /* Number of bits in an int or unsigned int for the target machine. */ | |
812 | #if !defined (TARGET_INT_BIT) | |
813 | #define TARGET_INT_BIT (4 * TARGET_CHAR_BIT) | |
814 | #endif | |
815 | ||
816 | /* Number of bits in a long or unsigned long for the target machine. */ | |
817 | #if !defined (TARGET_LONG_BIT) | |
818 | #define TARGET_LONG_BIT (4 * TARGET_CHAR_BIT) | |
819 | #endif | |
820 | ||
821 | /* Number of bits in a long long or unsigned long long for the target machine. */ | |
822 | #if !defined (TARGET_LONG_LONG_BIT) | |
823 | #define TARGET_LONG_LONG_BIT (2 * TARGET_LONG_BIT) | |
824 | #endif | |
825 | ||
826 | /* Number of bits in a float for the target machine. */ | |
827 | #if !defined (TARGET_FLOAT_BIT) | |
828 | #define TARGET_FLOAT_BIT (4 * TARGET_CHAR_BIT) | |
829 | #endif | |
830 | ||
831 | /* Number of bits in a double for the target machine. */ | |
832 | #if !defined (TARGET_DOUBLE_BIT) | |
833 | #define TARGET_DOUBLE_BIT (8 * TARGET_CHAR_BIT) | |
834 | #endif | |
835 | ||
836 | /* Number of bits in a long double for the target machine. */ | |
837 | #if !defined (TARGET_LONG_DOUBLE_BIT) | |
838 | #define TARGET_LONG_DOUBLE_BIT (2 * TARGET_DOUBLE_BIT) | |
839 | #endif | |
840 | ||
04f566a3 JK |
841 | /* Number of bits in a pointer for the target machine */ |
842 | #if !defined (TARGET_PTR_BIT) | |
843 | #define TARGET_PTR_BIT TARGET_INT_BIT | |
844 | #endif | |
845 | ||
846 | /* If we picked up a copy of CHAR_BIT from a configuration file | |
847 | (which may get it by including <limits.h>) then use it to set | |
848 | the number of bits in a host char. If not, use the same size | |
849 | as the target. */ | |
850 | ||
851 | #if defined (CHAR_BIT) | |
852 | #define HOST_CHAR_BIT CHAR_BIT | |
853 | #else | |
854 | #define HOST_CHAR_BIT TARGET_CHAR_BIT | |
855 | #endif | |
856 | ||
7d9884b9 JG |
857 | /* The bit byte-order has to do just with numbering of bits in |
858 | debugging symbols and such. Conceptually, it's quite separate | |
859 | from byte/word byte order. */ | |
860 | ||
861 | #if !defined (BITS_BIG_ENDIAN) | |
479f0f18 SG |
862 | #ifndef TARGET_BYTE_ORDER_SELECTABLE |
863 | ||
7d9884b9 JG |
864 | #if TARGET_BYTE_ORDER == BIG_ENDIAN |
865 | #define BITS_BIG_ENDIAN 1 | |
866 | #endif /* Big endian. */ | |
867 | ||
868 | #if TARGET_BYTE_ORDER == LITTLE_ENDIAN | |
869 | #define BITS_BIG_ENDIAN 0 | |
870 | #endif /* Little endian. */ | |
479f0f18 SG |
871 | |
872 | #else /* defined (TARGET_BYTE_ORDER_SELECTABLE) */ | |
873 | ||
874 | #define BITS_BIG_ENDIAN (TARGET_BYTE_ORDER == BIG_ENDIAN) | |
875 | ||
876 | #endif /* defined (TARGET_BYTE_ORDER_SELECTABLE) */ | |
7d9884b9 JG |
877 | #endif /* BITS_BIG_ENDIAN not defined. */ |
878 | ||
e3c16900 | 879 | /* In findvar.c. */ |
e3c16900 | 880 | |
6f54efdc SS |
881 | extern LONGEST extract_signed_integer PARAMS ((void *, int)); |
882 | ||
16a43bf4 | 883 | extern ULONGEST extract_unsigned_integer PARAMS ((void *, int)); |
6f54efdc | 884 | |
a243a22f SG |
885 | extern int extract_long_unsigned_integer PARAMS ((void *, int, LONGEST *)); |
886 | ||
6f54efdc SS |
887 | extern CORE_ADDR extract_address PARAMS ((void *, int)); |
888 | ||
889 | extern void store_signed_integer PARAMS ((void *, int, LONGEST)); | |
890 | ||
16a43bf4 | 891 | extern void store_unsigned_integer PARAMS ((void *, int, ULONGEST)); |
6f54efdc SS |
892 | |
893 | extern void store_address PARAMS ((void *, int, CORE_ADDR)); | |
894 | ||
a243a22f SG |
895 | /* Setup definitions for host and target floating point formats. We need to |
896 | consider the format for `float', `double', and `long double' for both target | |
897 | and host. We need to do this so that we know what kind of conversions need | |
898 | to be done when converting target numbers to and from the hosts DOUBLEST | |
899 | data type. */ | |
900 | ||
901 | /* This is used to indicate that we don't know the format of the floating point | |
902 | number. Typically, this is useful for native ports, where the actual format | |
903 | is irrelevant, since no conversions will be taking place. */ | |
904 | ||
905 | extern const struct floatformat floatformat_unknown; | |
906 | ||
907 | #if HOST_BYTE_ORDER == BIG_ENDIAN | |
908 | # ifndef HOST_FLOAT_FORMAT | |
909 | # define HOST_FLOAT_FORMAT &floatformat_ieee_single_big | |
910 | # endif | |
911 | # ifndef HOST_DOUBLE_FORMAT | |
912 | # define HOST_DOUBLE_FORMAT &floatformat_ieee_double_big | |
913 | # endif | |
914 | #else /* LITTLE_ENDIAN */ | |
915 | # ifndef HOST_FLOAT_FORMAT | |
916 | # define HOST_FLOAT_FORMAT &floatformat_ieee_single_little | |
917 | # endif | |
918 | # ifndef HOST_DOUBLE_FORMAT | |
919 | # define HOST_DOUBLE_FORMAT &floatformat_ieee_double_little | |
920 | # endif | |
921 | #endif | |
922 | ||
923 | #ifndef HOST_LONG_DOUBLE_FORMAT | |
924 | #define HOST_LONG_DOUBLE_FORMAT &floatformat_unknown | |
925 | #endif | |
926 | ||
927 | #ifndef TARGET_BYTE_ORDER_SELECTABLE | |
928 | # if TARGET_BYTE_ORDER == BIG_ENDIAN | |
929 | # ifndef TARGET_FLOAT_FORMAT | |
930 | # define TARGET_FLOAT_FORMAT &floatformat_ieee_single_big | |
931 | # endif | |
932 | # ifndef TARGET_DOUBLE_FORMAT | |
933 | # define TARGET_DOUBLE_FORMAT &floatformat_ieee_double_big | |
934 | # endif | |
935 | # else /* LITTLE_ENDIAN */ | |
936 | # ifndef TARGET_FLOAT_FORMAT | |
937 | # define TARGET_FLOAT_FORMAT &floatformat_ieee_single_little | |
938 | # endif | |
939 | # ifndef TARGET_DOUBLE_FORMAT | |
940 | # define TARGET_DOUBLE_FORMAT &floatformat_ieee_double_little | |
941 | # endif | |
942 | # endif | |
a243a22f SG |
943 | #else /* TARGET_BYTE_ORDER_SELECTABLE */ |
944 | # ifndef TARGET_FLOAT_FORMAT | |
c6fbd98b SG |
945 | # define TARGET_FLOAT_FORMAT (target_byte_order == BIG_ENDIAN \ |
946 | ? &floatformat_ieee_single_big \ | |
947 | : &floatformat_ieee_single_little) | |
a243a22f SG |
948 | # endif |
949 | # ifndef TARGET_DOUBLE_FORMAT | |
c6fbd98b SG |
950 | # define TARGET_DOUBLE_FORMAT (target_byte_order == BIG_ENDIAN \ |
951 | ? &floatformat_ieee_double_big \ | |
952 | : &floatformat_ieee_double_little) | |
a243a22f SG |
953 | # endif |
954 | #endif | |
955 | ||
c6fbd98b SG |
956 | #ifndef TARGET_LONG_DOUBLE_FORMAT |
957 | # define TARGET_LONG_DOUBLE_FORMAT &floatformat_unknown | |
958 | #endif | |
959 | ||
a243a22f SG |
960 | /* Use `long double' if the host compiler supports it. (Note that this is not |
961 | necessarily any longer than `double'. On SunOS/gcc, it's the same as | |
962 | double.) This is necessary because GDB internally converts all floating | |
963 | point values to the widest type supported by the host. | |
964 | ||
965 | There are problems however, when the target `long double' is longer than the | |
966 | host's `long double'. In general, we'll probably reduce the precision of | |
967 | any such values and print a warning. */ | |
968 | ||
969 | #ifdef HAVE_LONG_DOUBLE | |
970 | typedef long double DOUBLEST; | |
a243a22f SG |
971 | #else |
972 | typedef double DOUBLEST; | |
973 | #endif | |
974 | ||
91550191 SG |
975 | extern void floatformat_to_doublest PARAMS ((const struct floatformat *, |
976 | char *, DOUBLEST *)); | |
977 | extern void floatformat_from_doublest PARAMS ((const struct floatformat *, | |
978 | DOUBLEST *, char *)); | |
a243a22f | 979 | extern DOUBLEST extract_floating PARAMS ((void *, int)); |
04f566a3 | 980 | |
a243a22f | 981 | extern void store_floating PARAMS ((void *, int, DOUBLEST)); |
e3c16900 | 982 | \f |
7d9884b9 JG |
983 | /* On some machines there are bits in addresses which are not really |
984 | part of the address, but are used by the kernel, the hardware, etc. | |
985 | for special purposes. ADDR_BITS_REMOVE takes out any such bits | |
986 | so we get a "real" address such as one would find in a symbol | |
04f566a3 | 987 | table. This is used only for addresses of instructions, and even then |
e3c16900 JK |
988 | I'm not sure it's used in all contexts. It exists to deal with there |
989 | being a few stray bits in the PC which would mislead us, not as some sort | |
04f566a3 JK |
990 | of generic thing to handle alignment or segmentation (it's possible it |
991 | should be in TARGET_READ_PC instead). */ | |
7d9884b9 JG |
992 | #if !defined (ADDR_BITS_REMOVE) |
993 | #define ADDR_BITS_REMOVE(addr) (addr) | |
7d9884b9 JG |
994 | #endif /* No ADDR_BITS_REMOVE. */ |
995 | ||
d747e0af MT |
996 | /* From valops.c */ |
997 | ||
6f54efdc | 998 | extern CORE_ADDR push_bytes PARAMS ((CORE_ADDR, char *, int)); |
d747e0af | 999 | |
16a43bf4 | 1000 | extern CORE_ADDR push_word PARAMS ((CORE_ADDR, ULONGEST)); |
d747e0af | 1001 | |
0239d9b3 FF |
1002 | /* Some parts of gdb might be considered optional, in the sense that they |
1003 | are not essential for being able to build a working, usable debugger | |
1004 | for a specific environment. For example, the maintenance commands | |
1005 | are there for the benefit of gdb maintainers. As another example, | |
1006 | some environments really don't need gdb's that are able to read N | |
1007 | different object file formats. In order to make it possible (but | |
1008 | not necessarily recommended) to build "stripped down" versions of | |
1009 | gdb, the following defines control selective compilation of those | |
1010 | parts of gdb which can be safely left out when necessary. Note that | |
1011 | the default is to include everything. */ | |
1012 | ||
1013 | #ifndef MAINTENANCE_CMDS | |
1014 | #define MAINTENANCE_CMDS 1 | |
1015 | #endif | |
1016 | ||
45993f61 SC |
1017 | #ifdef MAINTENANCE_CMDS |
1018 | extern int watchdog; | |
1019 | #endif | |
1020 | ||
09722039 SG |
1021 | #include "dis-asm.h" /* Get defs for disassemble_info */ |
1022 | ||
18b46e7c SS |
1023 | extern int dis_asm_read_memory PARAMS ((bfd_vma memaddr, bfd_byte *myaddr, |
1024 | int len, disassemble_info *info)); | |
1025 | ||
1026 | extern void dis_asm_memory_error PARAMS ((int status, bfd_vma memaddr, | |
1027 | disassemble_info *info)); | |
1028 | ||
1029 | extern void dis_asm_print_address PARAMS ((bfd_vma addr, | |
1030 | disassemble_info *info)); | |
1031 | ||
1032 | extern int (*tm_print_insn) PARAMS ((bfd_vma, disassemble_info*)); | |
91550191 | 1033 | extern disassemble_info tm_print_insn_info; |
18b46e7c SS |
1034 | |
1035 | /* Hooks for alternate command interfaces. */ | |
1036 | ||
09722039 SG |
1037 | #ifdef __STDC__ |
1038 | struct target_waitstatus; | |
1039 | struct cmd_list_element; | |
1040 | #endif | |
1041 | ||
750b7942 | 1042 | extern void (*init_ui_hook) PARAMS ((char *argv0)); |
8164ec2e | 1043 | extern void (*command_loop_hook) PARAMS ((void)); |
18b46e7c SS |
1044 | extern void (*fputs_unfiltered_hook) PARAMS ((const char *linebuffer, |
1045 | FILE *stream)); | |
1046 | extern void (*print_frame_info_listing_hook) PARAMS ((struct symtab *s, | |
1047 | int line, int stopline, | |
1048 | int noerror)); | |
ad3b8c4a JM |
1049 | extern int (*query_hook) PARAMS ((const char *, va_list)); |
1050 | extern void (*warning_hook) PARAMS ((const char *, va_list)); | |
8164ec2e SG |
1051 | extern void (*flush_hook) PARAMS ((FILE *stream)); |
1052 | extern void (*create_breakpoint_hook) PARAMS ((struct breakpoint *b)); | |
1053 | extern void (*delete_breakpoint_hook) PARAMS ((struct breakpoint *bpt)); | |
326ae3e2 | 1054 | extern void (*modify_breakpoint_hook) PARAMS ((struct breakpoint *bpt)); |
b6d70e15 | 1055 | extern void (*target_output_hook) PARAMS ((char *)); |
637b1661 | 1056 | extern void (*interactive_hook) PARAMS ((void)); |
16041d53 | 1057 | extern void (*registers_changed_hook) PARAMS ((void)); |
91550191 SG |
1058 | extern void (*readline_begin_hook) PARAMS ((char *, ...)); |
1059 | extern char * (*readline_hook) PARAMS ((char *)); | |
1060 | extern void (*readline_end_hook) PARAMS ((void)); | |
ad3b8c4a JM |
1061 | extern void (*pc_changed_hook) PARAMS ((void)); |
1062 | extern void (*context_hook) PARAMS ((int)); | |
479f0f18 SG |
1063 | extern int (*target_wait_hook) PARAMS ((int pid, |
1064 | struct target_waitstatus *status)); | |
1065 | ||
1066 | extern void (*call_command_hook) PARAMS ((struct cmd_list_element *c, | |
1067 | char *cmd, int from_tty)); | |
1068 | ||
b607efe7 | 1069 | extern NORETURN void (*error_hook) PARAMS ((void)) ATTR_NORETURN; |
45993f61 SC |
1070 | |
1071 | ||
1072 | ||
754e5da2 SG |
1073 | /* Inhibit window interface if non-zero. */ |
1074 | ||
c5197511 | 1075 | extern int use_windows; |
754e5da2 | 1076 | |
45993f61 SC |
1077 | /* Symbolic definitions of filename-related things. */ |
1078 | /* FIXME, this doesn't work very well if host and executable | |
1079 | filesystems conventions are different. */ | |
1080 | ||
1081 | #ifndef DIRNAME_SEPARATOR | |
1082 | #define DIRNAME_SEPARATOR ':' | |
1083 | #endif | |
1084 | ||
1085 | #ifndef SLASH_P | |
9e77e83d | 1086 | #if defined(__GO32__)||defined(_WIN32) |
b6d70e15 SC |
1087 | #define SLASH_P(X) ((X)=='\\') |
1088 | #else | |
45993f61 SC |
1089 | #define SLASH_P(X) ((X)=='/') |
1090 | #endif | |
b6d70e15 | 1091 | #endif |
45993f61 SC |
1092 | |
1093 | #ifndef SLASH_CHAR | |
9e77e83d | 1094 | #if defined(__GO32__)||defined(_WIN32) |
b6d70e15 SC |
1095 | #define SLASH_CHAR '\\' |
1096 | #else | |
45993f61 SC |
1097 | #define SLASH_CHAR '/' |
1098 | #endif | |
b6d70e15 | 1099 | #endif |
45993f61 SC |
1100 | |
1101 | #ifndef SLASH_STRING | |
9e77e83d | 1102 | #if defined(__GO32__)||defined(_WIN32) |
b6d70e15 SC |
1103 | #define SLASH_STRING "\\" |
1104 | #else | |
45993f61 SC |
1105 | #define SLASH_STRING "/" |
1106 | #endif | |
b6d70e15 | 1107 | #endif |
45993f61 SC |
1108 | |
1109 | #ifndef ROOTED_P | |
1110 | #define ROOTED_P(X) (SLASH_P((X)[0])) | |
1111 | #endif | |
1112 | ||
16a43bf4 DP |
1113 | /* On some systems, PIDGET is defined to extract the inferior pid from |
1114 | an internal pid that has the thread id and pid in seperate bit | |
1115 | fields. If not defined, then just use the entire internal pid as | |
1116 | the actual pid. */ | |
1117 | ||
1118 | #ifndef PIDGET | |
1119 | #define PIDGET(pid) (pid) | |
1120 | #endif | |
1121 | ||
09722039 | 1122 | #endif /* #ifndef DEFS_H */ |