Commit | Line | Data |
---|---|---|
7d9884b9 | 1 | /* Basic, host-specific, and target-specific definitions for GDB. |
8adbc73e | 2 | Copyright (C) 1986, 89, 91, 92, 93, 94, 95, 96, 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 | |
7532cf10 FF |
223 | /* From ch-lang.c, for the moment. (FIXME) */ |
224 | ||
6f54efdc | 225 | extern char *chill_demangle PARAMS ((const char *)); |
7532cf10 | 226 | |
d747e0af MT |
227 | /* From utils.c */ |
228 | ||
b607efe7 FF |
229 | extern void notice_quit PARAMS ((void)); |
230 | ||
6f54efdc | 231 | extern int strcmp_iw PARAMS ((const char *, const char *)); |
d630b615 | 232 | |
6f54efdc | 233 | extern char *safe_strerror PARAMS ((int)); |
e146177e | 234 | |
6f54efdc | 235 | extern char *safe_strsignal PARAMS ((int)); |
e146177e | 236 | |
6f54efdc | 237 | extern void init_malloc PARAMS ((void *)); |
d747e0af | 238 | |
6f54efdc | 239 | extern void request_quit PARAMS ((int)); |
d747e0af | 240 | |
6f54efdc | 241 | extern void do_cleanups PARAMS ((struct cleanup *)); |
16a43bf4 | 242 | extern void do_final_cleanups PARAMS ((struct cleanup *)); |
7a9eb4c4 | 243 | extern void do_my_cleanups PARAMS ((struct cleanup **, struct cleanup *)); |
8adbc73e | 244 | extern void do_run_cleanups PARAMS ((struct cleanup *)); |
d747e0af | 245 | |
6f54efdc | 246 | extern void discard_cleanups PARAMS ((struct cleanup *)); |
16a43bf4 | 247 | extern void discard_final_cleanups PARAMS ((struct cleanup *)); |
7a9eb4c4 | 248 | extern void discard_my_cleanups PARAMS ((struct cleanup **, struct cleanup *)); |
d747e0af | 249 | |
ac95dc5e | 250 | typedef void (*make_cleanup_func) PARAMS ((void *)); |
d747e0af | 251 | |
8adbc73e | 252 | extern struct cleanup *make_cleanup PARAMS ((make_cleanup_func, void *)); |
d747e0af | 253 | |
8adbc73e | 254 | extern struct cleanup *make_final_cleanup PARAMS ((make_cleanup_func, void *)); |
ad3b8c4a | 255 | |
8adbc73e GN |
256 | extern struct cleanup *make_my_cleanup PARAMS ((struct cleanup **, |
257 | make_cleanup_func, void *)); | |
d747e0af | 258 | |
8adbc73e | 259 | extern struct cleanup *make_run_cleanup PARAMS ((make_cleanup_func, void *)); |
ad3b8c4a | 260 | |
6f54efdc | 261 | extern struct cleanup *save_cleanups PARAMS ((void)); |
16a43bf4 | 262 | extern struct cleanup *save_final_cleanups PARAMS ((void)); |
7a9eb4c4 | 263 | extern struct cleanup *save_my_cleanups PARAMS ((struct cleanup **)); |
d747e0af | 264 | |
6f54efdc | 265 | extern void restore_cleanups PARAMS ((struct cleanup *)); |
16a43bf4 | 266 | extern void restore_final_cleanups PARAMS ((struct cleanup *)); |
7a9eb4c4 | 267 | extern void restore_my_cleanups PARAMS ((struct cleanup **, struct cleanup *)); |
d747e0af | 268 | |
6f54efdc | 269 | extern void free_current_contents PARAMS ((char **)); |
d747e0af | 270 | |
b607efe7 | 271 | extern void null_cleanup PARAMS ((PTR)); |
d747e0af | 272 | |
6f54efdc | 273 | extern int myread PARAMS ((int, char *, int)); |
d747e0af | 274 | |
413cba82 JL |
275 | extern int query PARAMS((char *, ...)) |
276 | ATTR_FORMAT(printf, 1, 2); | |
b607efe7 | 277 | |
ad3b8c4a JM |
278 | #if !defined (USE_MMALLOC) |
279 | extern PTR mmalloc PARAMS ((PTR, size_t)); | |
280 | extern PTR mrealloc PARAMS ((PTR, PTR, size_t)); | |
281 | extern void mfree PARAMS ((PTR, PTR)); | |
282 | #endif | |
283 | ||
b607efe7 FF |
284 | /* From demangle.c */ |
285 | ||
286 | extern void set_demangling_style PARAMS ((char *)); | |
287 | ||
98760eab | 288 | /* From tm.h */ |
ac95dc5e | 289 | |
98760eab AC |
290 | struct type; |
291 | typedef int (use_struct_convention_fn) PARAMS ((int gcc_p, struct type *value_type)); | |
292 | extern use_struct_convention_fn generic_use_struct_convention; | |
293 | ||
ac95dc5e JM |
294 | typedef unsigned char *(breakpoint_from_pc_fn) PARAMS ((CORE_ADDR *pcptr, int *lenptr)); |
295 | ||
296 | ||
6c803036 | 297 | \f |
96f7edbd JK |
298 | /* Annotation stuff. */ |
299 | ||
6c803036 JK |
300 | extern int annotation_level; /* in stack.c */ |
301 | \f | |
6f54efdc | 302 | extern void begin_line PARAMS ((void)); |
51b80b00 | 303 | |
6f54efdc | 304 | extern void wrap_here PARAMS ((char *)); |
d747e0af | 305 | |
6f54efdc | 306 | extern void reinitialize_more_filter PARAMS ((void)); |
d747e0af | 307 | |
04f566a3 JK |
308 | typedef FILE GDB_FILE; |
309 | #define gdb_stdout stdout | |
310 | #define gdb_stderr stderr | |
311 | ||
6f54efdc | 312 | extern void gdb_flush PARAMS ((GDB_FILE *)); |
04f566a3 | 313 | |
6f54efdc | 314 | extern GDB_FILE *gdb_fopen PARAMS ((char * name, char * mode)); |
04f566a3 | 315 | |
6f54efdc | 316 | extern void fputs_filtered PARAMS ((const char *, GDB_FILE *)); |
04f566a3 | 317 | |
6f54efdc | 318 | extern void fputs_unfiltered PARAMS ((const char *, GDB_FILE *)); |
d747e0af | 319 | |
ad3b8c4a JM |
320 | extern int fputc_filtered PARAMS ((int c, GDB_FILE *)); |
321 | ||
8989d4fc | 322 | extern int fputc_unfiltered PARAMS ((int c, GDB_FILE *)); |
04f566a3 | 323 | |
8989d4fc | 324 | extern int putchar_unfiltered PARAMS ((int c)); |
d747e0af | 325 | |
81afee37 | 326 | extern void puts_filtered PARAMS ((const char *)); |
d747e0af | 327 | |
81afee37 | 328 | extern void puts_unfiltered PARAMS ((const char *)); |
04f566a3 | 329 | |
7e9576e0 MA |
330 | extern void puts_debug PARAMS ((char *prefix, char *string, char *suffix)); |
331 | ||
81afee37 | 332 | extern void vprintf_filtered PARAMS ((const char *, va_list)) |
413cba82 | 333 | ATTR_FORMAT(printf, 1, 0); |
51b80b00 | 334 | |
81afee37 | 335 | extern void vfprintf_filtered PARAMS ((FILE *, const char *, va_list)) |
413cba82 | 336 | ATTR_FORMAT(printf, 2, 0); |
a8e033f2 | 337 | |
81afee37 | 338 | extern void fprintf_filtered PARAMS ((FILE *, const char *, ...)) |
413cba82 | 339 | ATTR_FORMAT(printf, 2, 3); |
d747e0af | 340 | |
81afee37 | 341 | extern void fprintfi_filtered PARAMS ((int, FILE *, const char *, ...)) |
413cba82 | 342 | ATTR_FORMAT(printf, 3, 4); |
a8e033f2 | 343 | |
81afee37 | 344 | extern void printf_filtered PARAMS ((const char *, ...)) |
413cba82 | 345 | ATTR_FORMAT(printf, 1, 2); |
d747e0af | 346 | |
81afee37 | 347 | extern void printfi_filtered PARAMS ((int, const char *, ...)) |
413cba82 | 348 | ATTR_FORMAT(printf, 2, 3); |
a8e033f2 | 349 | |
81afee37 | 350 | extern void vprintf_unfiltered PARAMS ((const char *, va_list)) |
413cba82 | 351 | ATTR_FORMAT(printf, 1, 0); |
04f566a3 | 352 | |
81afee37 | 353 | extern void vfprintf_unfiltered PARAMS ((FILE *, const char *, va_list)) |
413cba82 | 354 | ATTR_FORMAT(printf, 2, 0); |
04f566a3 | 355 | |
81afee37 | 356 | extern void fprintf_unfiltered PARAMS ((FILE *, const char *, ...)) |
413cba82 | 357 | ATTR_FORMAT(printf, 2, 3); |
d747e0af | 358 | |
81afee37 | 359 | extern void printf_unfiltered PARAMS ((const char *, ...)) |
413cba82 | 360 | ATTR_FORMAT(printf, 1, 2); |
04f566a3 | 361 | |
6f54efdc | 362 | extern void print_spaces PARAMS ((int, GDB_FILE *)); |
04f566a3 | 363 | |
6f54efdc | 364 | extern void print_spaces_filtered PARAMS ((int, GDB_FILE *)); |
d747e0af | 365 | |
6f54efdc | 366 | extern char *n_spaces PARAMS ((int)); |
d747e0af | 367 | |
6f54efdc | 368 | extern void gdb_printchar PARAMS ((int, GDB_FILE *, int)); |
d747e0af | 369 | |
833e0d94 JK |
370 | extern void gdb_print_address PARAMS ((void *, GDB_FILE *)); |
371 | ||
28444bf3 DP |
372 | typedef bfd_vma t_addr; |
373 | typedef bfd_vma t_reg; | |
374 | extern char* paddr PARAMS ((t_addr addr)); | |
375 | ||
376 | extern char* preg PARAMS ((t_reg reg)); | |
377 | ||
16a43bf4 DP |
378 | extern char* paddr_nz PARAMS ((t_addr addr)); |
379 | ||
380 | extern char* preg_nz PARAMS ((t_reg reg)); | |
381 | ||
6f54efdc SS |
382 | extern void fprintf_symbol_filtered PARAMS ((GDB_FILE *, char *, |
383 | enum language, int)); | |
d747e0af | 384 | |
56e327b3 | 385 | extern NORETURN void perror_with_name PARAMS ((char *)) ATTR_NORETURN; |
d747e0af | 386 | |
6f54efdc | 387 | extern void print_sys_errmsg PARAMS ((char *, int)); |
d747e0af | 388 | |
1bef45ea JK |
389 | /* From regex.c or libc. BSD 4.4 declares this with the argument type as |
390 | "const char *" in unistd.h, so we can't declare the argument | |
391 | as "char *". */ | |
d747e0af | 392 | |
6f54efdc | 393 | extern char *re_comp PARAMS ((const char *)); |
d747e0af MT |
394 | |
395 | /* From symfile.c */ | |
396 | ||
6f54efdc | 397 | extern void symbol_file_command PARAMS ((char *, int)); |
d747e0af | 398 | |
eba08643 | 399 | /* From top.c */ |
d747e0af | 400 | |
6f54efdc | 401 | extern char *skip_quoted PARAMS ((char *)); |
d630b615 | 402 | |
6f54efdc | 403 | extern char *gdb_readline PARAMS ((char *)); |
d747e0af | 404 | |
6f54efdc | 405 | extern char *command_line_input PARAMS ((char *, int, char *)); |
d747e0af | 406 | |
6f54efdc | 407 | extern void print_prompt PARAMS ((void)); |
d747e0af | 408 | |
6f54efdc | 409 | extern int input_from_terminal_p PARAMS ((void)); |
d747e0af | 410 | |
eba08643 C |
411 | extern int info_verbose; |
412 | ||
bd5635a1 | 413 | /* From printcmd.c */ |
d747e0af | 414 | |
6f54efdc | 415 | extern void set_next_address PARAMS ((CORE_ADDR)); |
d747e0af | 416 | |
6f54efdc SS |
417 | extern void print_address_symbolic PARAMS ((CORE_ADDR, GDB_FILE *, int, |
418 | char *)); | |
d747e0af | 419 | |
6f54efdc | 420 | extern void print_address_numeric PARAMS ((CORE_ADDR, int, GDB_FILE *)); |
833e0d94 | 421 | |
6f54efdc | 422 | extern void print_address PARAMS ((CORE_ADDR, GDB_FILE *)); |
bd5635a1 | 423 | |
e1ce8aa5 | 424 | /* From source.c */ |
d747e0af | 425 | |
6f54efdc | 426 | extern int openp PARAMS ((char *, int, char *, int, int, char **)); |
d747e0af | 427 | |
6f54efdc | 428 | extern void mod_path PARAMS ((char *, char **)); |
d747e0af | 429 | |
6f54efdc | 430 | extern void directory_command PARAMS ((char *, int)); |
d747e0af | 431 | |
6f54efdc | 432 | extern void init_source_path PARAMS ((void)); |
d747e0af | 433 | |
637b1661 SG |
434 | extern char *symtab_to_filename PARAMS ((struct symtab *)); |
435 | ||
d747e0af MT |
436 | /* From findvar.c */ |
437 | ||
6f54efdc | 438 | extern int read_relative_register_raw_bytes PARAMS ((int, char *)); |
e1ce8aa5 | 439 | |
bd5635a1 | 440 | /* From readline (but not in any readline .h files). */ |
d747e0af | 441 | |
6f54efdc | 442 | extern char *tilde_expand PARAMS ((char *)); |
bd5635a1 | 443 | |
78751d4f PS |
444 | /* Control types for commands */ |
445 | ||
446 | enum misc_command_type | |
447 | { | |
448 | ok_command, | |
449 | end_command, | |
450 | else_command, | |
451 | nop_command | |
452 | }; | |
453 | ||
454 | enum command_control_type | |
455 | { | |
456 | simple_control, | |
457 | break_control, | |
458 | continue_control, | |
459 | while_control, | |
460 | if_control, | |
461 | invalid_control | |
462 | }; | |
463 | ||
bd5635a1 RP |
464 | /* Structure for saved commands lines |
465 | (for breakpoints, defined commands, etc). */ | |
466 | ||
467 | struct command_line | |
468 | { | |
469 | struct command_line *next; | |
470 | char *line; | |
78751d4f PS |
471 | enum command_control_type control_type; |
472 | int body_count; | |
473 | struct command_line **body_list; | |
bd5635a1 RP |
474 | }; |
475 | ||
91550191 | 476 | extern struct command_line *read_command_lines PARAMS ((char *, int)); |
d747e0af | 477 | |
6f54efdc | 478 | extern void free_command_lines PARAMS ((struct command_line **)); |
bd5635a1 RP |
479 | |
480 | /* String containing the current directory (what getwd would return). */ | |
481 | ||
d747e0af | 482 | extern char *current_directory; |
bd5635a1 RP |
483 | |
484 | /* Default radixes for input and output. Only some values supported. */ | |
485 | extern unsigned input_radix; | |
486 | extern unsigned output_radix; | |
487 | ||
a8a69e63 FF |
488 | /* Possibilities for prettyprint parameters to routines which print |
489 | things. Like enum language, this should be in value.h, but needs | |
490 | to be here for the same reason. FIXME: If we can eliminate this | |
491 | as an arg to LA_VAL_PRINT, then we can probably move it back to | |
492 | value.h. */ | |
493 | ||
494 | enum val_prettyprint | |
495 | { | |
496 | Val_no_prettyprint = 0, | |
497 | Val_prettyprint, | |
498 | /* Use the default setting which the user has specified. */ | |
499 | Val_pretty_default | |
500 | }; | |
501 | ||
0a5d35ed SG |
502 | \f |
503 | /* Host machine definition. This will be a symlink to one of the | |
504 | xm-*.h files, built by the `configure' script. */ | |
505 | ||
506 | #include "xm.h" | |
507 | ||
e58de8a2 FF |
508 | /* Native machine support. This will be a symlink to one of the |
509 | nm-*.h files, built by the `configure' script. */ | |
510 | ||
511 | #include "nm.h" | |
512 | ||
c023fbf4 KH |
513 | /* Target machine definition. This will be a symlink to one of the |
514 | tm-*.h files, built by the `configure' script. */ | |
515 | ||
516 | #include "tm.h" | |
517 | ||
e146177e SEF |
518 | /* If the xm.h file did not define the mode string used to open the |
519 | files, assume that binary files are opened the same way as text | |
520 | files */ | |
521 | #ifndef FOPEN_RB | |
522 | #include "fopen-same.h" | |
523 | #endif | |
524 | ||
b51843d8 FF |
525 | /* Microsoft C can't deal with const pointers */ |
526 | ||
527 | #ifdef _MSC_VER | |
528 | #define CONST_PTR | |
529 | #else | |
530 | #define CONST_PTR const | |
531 | #endif | |
532 | ||
0a5d35ed | 533 | /* |
b51843d8 FF |
534 | * Allow things in gdb to be declared "volatile". If compiling ANSI, it |
535 | * just works. If compiling with gcc but non-ansi, redefine to __volatile__. | |
536 | * If non-ansi, non-gcc, then eliminate "volatile" entirely, making those | |
0a5d35ed SG |
537 | * objects be read-write rather than read-only. |
538 | */ | |
539 | ||
0a5d35ed SG |
540 | #ifndef volatile |
541 | #ifndef __STDC__ | |
542 | # ifdef __GNUC__ | |
543 | # define volatile __volatile__ | |
544 | # else | |
545 | # define volatile /*nothing*/ | |
546 | # endif /* GNUC */ | |
547 | #endif /* STDC */ | |
548 | #endif /* volatile */ | |
549 | ||
3f550b59 FF |
550 | /* Defaults for system-wide constants (if not defined by xm.h, we fake it). |
551 | FIXME: Assumes 2's complement arithmetic */ | |
0a5d35ed | 552 | |
bd5635a1 | 553 | #if !defined (UINT_MAX) |
38dc5e12 | 554 | #define UINT_MAX ((unsigned int)(~0)) /* 0xFFFFFFFF for 32-bits */ |
bd5635a1 RP |
555 | #endif |
556 | ||
e1ce8aa5 | 557 | #if !defined (INT_MAX) |
dd577ca5 | 558 | #define INT_MAX ((int)(UINT_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */ |
e1ce8aa5 JK |
559 | #endif |
560 | ||
561 | #if !defined (INT_MIN) | |
3f550b59 | 562 | #define INT_MIN ((int)((int) ~0 ^ INT_MAX)) /* 0x80000000 for 32-bits */ |
38dc5e12 SG |
563 | #endif |
564 | ||
565 | #if !defined (ULONG_MAX) | |
566 | #define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF for 32-bits */ | |
567 | #endif | |
568 | ||
569 | #if !defined (LONG_MAX) | |
570 | #define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */ | |
e1ce8aa5 JK |
571 | #endif |
572 | ||
7a9eb4c4 PB |
573 | #ifndef LONGEST |
574 | ||
7343d716 JK |
575 | #ifdef BFD64 |
576 | ||
577 | /* This is to make sure that LONGEST is at least as big as CORE_ADDR. */ | |
578 | ||
70126bf9 | 579 | #define LONGEST BFD_HOST_64_BIT |
16a43bf4 | 580 | #define ULONGEST BFD_HOST_U_64_BIT |
7343d716 JK |
581 | |
582 | #else /* No BFD64 */ | |
583 | ||
7efb57c3 FF |
584 | # ifdef CC_HAS_LONG_LONG |
585 | # define LONGEST long long | |
16a43bf4 | 586 | # define ULONGEST unsigned long long |
7efb57c3 | 587 | # else |
7a9eb4c4 PB |
588 | /* BFD_HOST_64_BIT is defined for some hosts that don't have long long |
589 | (e.g. i386-windows) so try it. */ | |
590 | # ifdef BFD_HOST_64_BIT | |
591 | # define LONGEST BFD_HOST_64_BIT | |
592 | # define ULONGEST BFD_HOST_U_64_BIT | |
593 | # else | |
594 | # define LONGEST long | |
595 | # define ULONGEST unsigned long | |
596 | # endif | |
7efb57c3 | 597 | # endif |
7efb57c3 | 598 | |
7343d716 JK |
599 | #endif /* No BFD64 */ |
600 | ||
7a9eb4c4 PB |
601 | #endif /* ! LONGEST */ |
602 | ||
7efb57c3 FF |
603 | /* Convert a LONGEST to an int. This is used in contexts (e.g. number of |
604 | arguments to a function, number in a value history, register number, etc.) | |
605 | where the value must not be larger than can fit in an int. */ | |
606 | ||
fb0f4231 | 607 | extern int longest_to_int PARAMS ((LONGEST)); |
d747e0af | 608 | |
0a5d35ed SG |
609 | /* Assorted functions we can declare, now that const and volatile are |
610 | defined. */ | |
d747e0af | 611 | |
6f54efdc | 612 | extern char *savestring PARAMS ((const char *, int)); |
d747e0af | 613 | |
6f54efdc | 614 | extern char *msavestring PARAMS ((void *, const char *, int)); |
318bf84f | 615 | |
6f54efdc | 616 | extern char *strsave PARAMS ((const char *)); |
d747e0af | 617 | |
6f54efdc | 618 | extern char *mstrsave PARAMS ((void *, const char *)); |
318bf84f | 619 | |
cad9cd60 | 620 | #ifdef _MSC_VER /* FIXME; was long, but this causes compile errors in msvc if already defined */ |
28444bf3 DP |
621 | extern PTR xmmalloc PARAMS ((PTR, size_t)); |
622 | ||
623 | extern PTR xmrealloc PARAMS ((PTR, PTR, size_t)); | |
624 | #else | |
6f54efdc | 625 | extern PTR xmmalloc PARAMS ((PTR, long)); |
318bf84f | 626 | |
6f54efdc | 627 | extern PTR xmrealloc PARAMS ((PTR, PTR, long)); |
28444bf3 | 628 | #endif |
318bf84f | 629 | |
6f54efdc | 630 | extern int parse_escape PARAMS ((char **)); |
d747e0af | 631 | |
9ddf9aa9 AC |
632 | /* compat - handle old targets that just define REGISTER_NAMES */ |
633 | #ifndef REGISTER_NAME | |
634 | extern char *gdb_register_names[]; | |
635 | #define REGISTER_NAME(i) gdb_register_names[i] | |
636 | #endif | |
d747e0af | 637 | |
833e0d94 JK |
638 | /* Message to be printed before the error message, when an error occurs. */ |
639 | ||
640 | extern char *error_pre_print; | |
641 | ||
8989d4fc JK |
642 | /* Message to be printed before the error message, when an error occurs. */ |
643 | ||
644 | extern char *quit_pre_print; | |
645 | ||
833e0d94 JK |
646 | /* Message to be printed before the warning message, when a warning occurs. */ |
647 | ||
648 | extern char *warning_pre_print; | |
649 | ||
56e327b3 | 650 | extern NORETURN void error PARAMS((const char *, ...)) ATTR_NORETURN; |
a0cf4681 JK |
651 | |
652 | extern void error_begin PARAMS ((void)); | |
d747e0af | 653 | |
85c613aa | 654 | extern NORETURN void fatal PARAMS((char *, ...)) ATTR_NORETURN; |
d747e0af | 655 | |
6f54efdc | 656 | extern NORETURN void nomem PARAMS ((long)) ATTR_NORETURN; |
318bf84f | 657 | |
2fcdae93 PS |
658 | /* Reasons for calling return_to_top_level. */ |
659 | enum return_reason { | |
660 | /* User interrupt. */ | |
661 | RETURN_QUIT, | |
662 | ||
663 | /* Any other error. */ | |
664 | RETURN_ERROR | |
665 | }; | |
666 | ||
667 | #define RETURN_MASK_QUIT (1 << (int)RETURN_QUIT) | |
668 | #define RETURN_MASK_ERROR (1 << (int)RETURN_ERROR) | |
669 | #define RETURN_MASK_ALL (RETURN_MASK_QUIT | RETURN_MASK_ERROR) | |
670 | typedef int return_mask; | |
671 | ||
6f54efdc SS |
672 | extern NORETURN void |
673 | return_to_top_level PARAMS ((enum return_reason)) ATTR_NORETURN; | |
2fcdae93 | 674 | |
6f54efdc SS |
675 | extern int |
676 | catch_errors PARAMS ((int (*) (char *), void *, char *, return_mask)); | |
d747e0af | 677 | |
8989d4fc | 678 | extern void warning_begin PARAMS ((void)); |
d747e0af | 679 | |
56e327b3 | 680 | extern void warning PARAMS ((const char *, ...)) |
413cba82 | 681 | ATTR_FORMAT(printf, 1, 2); |
d747e0af | 682 | |
97e7b66f DE |
683 | /* Global functions from other, non-gdb GNU thingies. |
684 | Libiberty thingies are no longer declared here. We include libiberty.h | |
685 | above, instead. */ | |
d747e0af | 686 | |
6b009ef6 | 687 | #ifndef GETENV_PROVIDED |
6f54efdc | 688 | extern char *getenv PARAMS ((const char *)); |
6b009ef6 | 689 | #endif |
d747e0af | 690 | |
e146177e SEF |
691 | /* From other system libraries */ |
692 | ||
b51843d8 | 693 | #ifdef HAVE_STDDEF_H |
d747e0af | 694 | #include <stddef.h> |
b51843d8 FF |
695 | #endif |
696 | ||
697 | #ifdef HAVE_STDLIB_H | |
28444bf3 DP |
698 | #if defined(_MSC_VER) && !defined(__cplusplus) |
699 | /* msvc defines these in stdlib.h for c code */ | |
700 | #undef min | |
701 | #undef max | |
702 | #endif | |
e3be225e | 703 | #include <stdlib.h> |
0a5d35ed | 704 | #endif |
28444bf3 DP |
705 | #ifndef min |
706 | #define min(a, b) ((a) < (b) ? (a) : (b)) | |
707 | #endif | |
708 | #ifndef max | |
709 | #define max(a, b) ((a) > (b) ? (a) : (b)) | |
710 | #endif | |
d747e0af | 711 | |
6b009ef6 SC |
712 | |
713 | /* We take the address of fclose later, but some stdio's forget | |
714 | to declare this. We can't always declare it since there's | |
715 | no way to declare the parameters without upsetting some compiler | |
716 | somewhere. */ | |
717 | ||
718 | #ifndef FCLOSE_PROVIDED | |
b607efe7 | 719 | extern int fclose PARAMS ((FILE *)); |
6b009ef6 | 720 | #endif |
e146177e | 721 | |
8989d4fc | 722 | #ifndef atof |
b607efe7 | 723 | extern double atof PARAMS ((const char *)); /* X3.159-1989 4.10.1.1 */ |
8989d4fc | 724 | #endif |
51b57ded | 725 | |
d747e0af | 726 | #ifndef MALLOC_INCOMPATIBLE |
318bf84f | 727 | |
b51843d8 | 728 | #ifdef NEED_DECLARATION_MALLOC |
e3be225e | 729 | extern PTR malloc (); |
b51843d8 | 730 | #endif |
d747e0af | 731 | |
b51843d8 | 732 | #ifdef NEED_DECLARATION_REALLOC |
e3be225e | 733 | extern PTR realloc (); |
b51843d8 | 734 | #endif |
318bf84f | 735 | |
b51843d8 | 736 | #ifdef NEED_DECLARATION_FREE |
e3be225e | 737 | extern void free (); |
b51843d8 | 738 | #endif |
d747e0af | 739 | |
e3be225e | 740 | #endif /* MALLOC_INCOMPATIBLE */ |
d747e0af | 741 | |
0a5d35ed SG |
742 | /* Various possibilities for alloca. */ |
743 | #ifndef alloca | |
744 | # ifdef __GNUC__ | |
745 | # define alloca __builtin_alloca | |
7343d716 | 746 | # else /* Not GNU C */ |
ad3b8c4a JM |
747 | # ifdef HAVE_ALLOCA_H |
748 | # include <alloca.h> | |
749 | # else | |
750 | # ifdef _AIX | |
751 | #pragma alloca | |
752 | # else | |
7343d716 JK |
753 | |
754 | /* We need to be careful not to declare this in a way which conflicts with | |
755 | bison. Bison never declares it as char *, but under various circumstances | |
756 | (like __hpux) we need to use void *. */ | |
ad3b8c4a | 757 | # if defined (__STDC__) || defined (__hpux) |
7343d716 | 758 | extern void *alloca (); |
ad3b8c4a | 759 | # else /* Don't use void *. */ |
0f552c5f | 760 | extern char *alloca (); |
ad3b8c4a JM |
761 | # endif /* Don't use void *. */ |
762 | # endif /* Not _AIX */ | |
763 | # endif /* Not HAVE_ALLOCA_H */ | |
7343d716 JK |
764 | # endif /* Not GNU C */ |
765 | #endif /* alloca not defined */ | |
e2aab031 | 766 | |
479f0f18 | 767 | /* HOST_BYTE_ORDER must be defined to one of these. */ |
a10c0d36 | 768 | |
d8efbc66 FF |
769 | #ifdef HAVE_ENDIAN_H |
770 | #include <endian.h> | |
771 | #endif | |
772 | ||
0a5d35ed SG |
773 | #if !defined (BIG_ENDIAN) |
774 | #define BIG_ENDIAN 4321 | |
775 | #endif | |
a10c0d36 | 776 | |
0a5d35ed SG |
777 | #if !defined (LITTLE_ENDIAN) |
778 | #define LITTLE_ENDIAN 1234 | |
779 | #endif | |
a10c0d36 | 780 | |
2fcdae93 | 781 | /* Target-system-dependent parameters for GDB. */ |
7d9884b9 | 782 | |
aaa3c096 AC |
783 | /* TARGET_BYTE_ORDER_SELECTABLE_P determines if the target endianness |
784 | is selectable at runtime. The user can use the `set endian' | |
785 | command to change it. TARGET_BYTE_ORDER_AUTO is nonzero when | |
786 | target_byte_order should be auto-detected (from the program image | |
787 | say). */ | |
788 | ||
789 | #ifndef TARGET_BYTE_ORDER_SELECTABLE_P | |
790 | /* compat - Catch old targets that define TARGET_BYTE_ORDER_SLECTABLE | |
791 | when they should have defined TARGET_BYTE_ORDER_SELECTABLE_P 1 */ | |
479f0f18 | 792 | #ifdef TARGET_BYTE_ORDER_SELECTABLE |
aaa3c096 AC |
793 | #define TARGET_BYTE_ORDER_SELECTABLE_P 1 |
794 | #else | |
795 | #define TARGET_BYTE_ORDER_SELECTABLE_P 0 | |
796 | #endif | |
797 | #endif | |
798 | ||
479f0f18 | 799 | extern int target_byte_order; |
aaa3c096 AC |
800 | #ifdef TARGET_BYTE_ORDER_SELECTABLE |
801 | /* compat - Catch old targets that define TARGET_BYTE_ORDER_SELECTABLE | |
802 | and expect defs.h to re-define TARGET_BYTE_ORDER. */ | |
803 | #undef TARGET_BYTE_ORDER | |
804 | #endif | |
805 | #ifndef TARGET_BYTE_ORDER | |
806 | #define TARGET_BYTE_ORDER (target_byte_order + 0) | |
807 | #endif | |
808 | ||
750b7942 | 809 | extern int target_byte_order_auto; |
aaa3c096 AC |
810 | #ifndef TARGET_BYTE_ORDER_AUTO |
811 | #define TARGET_BYTE_ORDER_AUTO (target_byte_order_auto + 0) | |
479f0f18 SG |
812 | #endif |
813 | ||
814 | extern void set_endian_from_file PARAMS ((bfd *)); | |
815 | ||
d0aba53f AC |
816 | /* The target architecture can be set at run-time. */ |
817 | extern int target_architecture_auto; | |
818 | extern const bfd_arch_info_type *target_architecture; | |
aaa3c096 AC |
819 | #define TARGET_ARCHITECTURE_AUTO (target_architecture_auto + 0) |
820 | #define TARGET_ARCHITECTURE (target_architecture + 0) | |
d0aba53f AC |
821 | extern void set_architecture_from_file PARAMS ((bfd *)); |
822 | /* Notify target of a change to the selected architecture. Zero return | |
823 | status indicates that the target did not like the change. */ | |
824 | extern int (*target_architecture_hook) PARAMS ((const bfd_arch_info_type *ap)); | |
7e9576e0 | 825 | extern void set_architecture_from_arch_mach PARAMS ((enum bfd_architecture arch, unsigned long mach)); |
d0aba53f | 826 | |
04f566a3 JK |
827 | /* Number of bits in a char or unsigned char for the target machine. |
828 | Just like CHAR_BIT in <limits.h> but describes the target machine. */ | |
829 | #if !defined (TARGET_CHAR_BIT) | |
830 | #define TARGET_CHAR_BIT 8 | |
831 | #endif | |
832 | ||
833 | /* Number of bits in a short or unsigned short for the target machine. */ | |
834 | #if !defined (TARGET_SHORT_BIT) | |
835 | #define TARGET_SHORT_BIT (2 * TARGET_CHAR_BIT) | |
836 | #endif | |
837 | ||
838 | /* Number of bits in an int or unsigned int for the target machine. */ | |
839 | #if !defined (TARGET_INT_BIT) | |
840 | #define TARGET_INT_BIT (4 * TARGET_CHAR_BIT) | |
841 | #endif | |
842 | ||
843 | /* Number of bits in a long or unsigned long for the target machine. */ | |
844 | #if !defined (TARGET_LONG_BIT) | |
845 | #define TARGET_LONG_BIT (4 * TARGET_CHAR_BIT) | |
846 | #endif | |
847 | ||
848 | /* Number of bits in a long long or unsigned long long for the target machine. */ | |
849 | #if !defined (TARGET_LONG_LONG_BIT) | |
850 | #define TARGET_LONG_LONG_BIT (2 * TARGET_LONG_BIT) | |
851 | #endif | |
852 | ||
853 | /* Number of bits in a float for the target machine. */ | |
854 | #if !defined (TARGET_FLOAT_BIT) | |
855 | #define TARGET_FLOAT_BIT (4 * TARGET_CHAR_BIT) | |
856 | #endif | |
857 | ||
858 | /* Number of bits in a double for the target machine. */ | |
859 | #if !defined (TARGET_DOUBLE_BIT) | |
860 | #define TARGET_DOUBLE_BIT (8 * TARGET_CHAR_BIT) | |
861 | #endif | |
862 | ||
863 | /* Number of bits in a long double for the target machine. */ | |
864 | #if !defined (TARGET_LONG_DOUBLE_BIT) | |
865 | #define TARGET_LONG_DOUBLE_BIT (2 * TARGET_DOUBLE_BIT) | |
866 | #endif | |
867 | ||
04f566a3 JK |
868 | /* Number of bits in a pointer for the target machine */ |
869 | #if !defined (TARGET_PTR_BIT) | |
870 | #define TARGET_PTR_BIT TARGET_INT_BIT | |
871 | #endif | |
872 | ||
873 | /* If we picked up a copy of CHAR_BIT from a configuration file | |
874 | (which may get it by including <limits.h>) then use it to set | |
875 | the number of bits in a host char. If not, use the same size | |
876 | as the target. */ | |
877 | ||
878 | #if defined (CHAR_BIT) | |
879 | #define HOST_CHAR_BIT CHAR_BIT | |
880 | #else | |
881 | #define HOST_CHAR_BIT TARGET_CHAR_BIT | |
882 | #endif | |
883 | ||
7d9884b9 JG |
884 | /* The bit byte-order has to do just with numbering of bits in |
885 | debugging symbols and such. Conceptually, it's quite separate | |
886 | from byte/word byte order. */ | |
887 | ||
888 | #if !defined (BITS_BIG_ENDIAN) | |
479f0f18 | 889 | #define BITS_BIG_ENDIAN (TARGET_BYTE_ORDER == BIG_ENDIAN) |
aaa3c096 | 890 | #endif |
7d9884b9 | 891 | |
e3c16900 | 892 | /* In findvar.c. */ |
e3c16900 | 893 | |
6f54efdc SS |
894 | extern LONGEST extract_signed_integer PARAMS ((void *, int)); |
895 | ||
16a43bf4 | 896 | extern ULONGEST extract_unsigned_integer PARAMS ((void *, int)); |
6f54efdc | 897 | |
a243a22f SG |
898 | extern int extract_long_unsigned_integer PARAMS ((void *, int, LONGEST *)); |
899 | ||
6f54efdc SS |
900 | extern CORE_ADDR extract_address PARAMS ((void *, int)); |
901 | ||
902 | extern void store_signed_integer PARAMS ((void *, int, LONGEST)); | |
903 | ||
16a43bf4 | 904 | extern void store_unsigned_integer PARAMS ((void *, int, ULONGEST)); |
6f54efdc SS |
905 | |
906 | extern void store_address PARAMS ((void *, int, CORE_ADDR)); | |
907 | ||
a243a22f SG |
908 | /* Setup definitions for host and target floating point formats. We need to |
909 | consider the format for `float', `double', and `long double' for both target | |
910 | and host. We need to do this so that we know what kind of conversions need | |
911 | to be done when converting target numbers to and from the hosts DOUBLEST | |
912 | data type. */ | |
913 | ||
914 | /* This is used to indicate that we don't know the format of the floating point | |
915 | number. Typically, this is useful for native ports, where the actual format | |
916 | is irrelevant, since no conversions will be taking place. */ | |
917 | ||
918 | extern const struct floatformat floatformat_unknown; | |
919 | ||
920 | #if HOST_BYTE_ORDER == BIG_ENDIAN | |
921 | # ifndef HOST_FLOAT_FORMAT | |
922 | # define HOST_FLOAT_FORMAT &floatformat_ieee_single_big | |
923 | # endif | |
924 | # ifndef HOST_DOUBLE_FORMAT | |
925 | # define HOST_DOUBLE_FORMAT &floatformat_ieee_double_big | |
926 | # endif | |
927 | #else /* LITTLE_ENDIAN */ | |
928 | # ifndef HOST_FLOAT_FORMAT | |
929 | # define HOST_FLOAT_FORMAT &floatformat_ieee_single_little | |
930 | # endif | |
931 | # ifndef HOST_DOUBLE_FORMAT | |
932 | # define HOST_DOUBLE_FORMAT &floatformat_ieee_double_little | |
933 | # endif | |
934 | #endif | |
935 | ||
936 | #ifndef HOST_LONG_DOUBLE_FORMAT | |
937 | #define HOST_LONG_DOUBLE_FORMAT &floatformat_unknown | |
938 | #endif | |
939 | ||
aaa3c096 AC |
940 | #ifndef TARGET_FLOAT_FORMAT |
941 | #define TARGET_FLOAT_FORMAT (target_byte_order == BIG_ENDIAN \ | |
942 | ? &floatformat_ieee_single_big \ | |
943 | : &floatformat_ieee_single_little) | |
944 | #endif | |
945 | #ifndef TARGET_DOUBLE_FORMAT | |
946 | #define TARGET_DOUBLE_FORMAT (target_byte_order == BIG_ENDIAN \ | |
947 | ? &floatformat_ieee_double_big \ | |
948 | : &floatformat_ieee_double_little) | |
a243a22f SG |
949 | #endif |
950 | ||
c6fbd98b SG |
951 | #ifndef TARGET_LONG_DOUBLE_FORMAT |
952 | # define TARGET_LONG_DOUBLE_FORMAT &floatformat_unknown | |
953 | #endif | |
954 | ||
a243a22f SG |
955 | /* Use `long double' if the host compiler supports it. (Note that this is not |
956 | necessarily any longer than `double'. On SunOS/gcc, it's the same as | |
957 | double.) This is necessary because GDB internally converts all floating | |
958 | point values to the widest type supported by the host. | |
959 | ||
960 | There are problems however, when the target `long double' is longer than the | |
961 | host's `long double'. In general, we'll probably reduce the precision of | |
962 | any such values and print a warning. */ | |
963 | ||
964 | #ifdef HAVE_LONG_DOUBLE | |
965 | typedef long double DOUBLEST; | |
a243a22f SG |
966 | #else |
967 | typedef double DOUBLEST; | |
968 | #endif | |
969 | ||
91550191 SG |
970 | extern void floatformat_to_doublest PARAMS ((const struct floatformat *, |
971 | char *, DOUBLEST *)); | |
972 | extern void floatformat_from_doublest PARAMS ((const struct floatformat *, | |
973 | DOUBLEST *, char *)); | |
a243a22f | 974 | extern DOUBLEST extract_floating PARAMS ((void *, int)); |
04f566a3 | 975 | |
a243a22f | 976 | extern void store_floating PARAMS ((void *, int, DOUBLEST)); |
e3c16900 | 977 | \f |
7d9884b9 JG |
978 | /* On some machines there are bits in addresses which are not really |
979 | part of the address, but are used by the kernel, the hardware, etc. | |
980 | for special purposes. ADDR_BITS_REMOVE takes out any such bits | |
981 | so we get a "real" address such as one would find in a symbol | |
04f566a3 | 982 | table. This is used only for addresses of instructions, and even then |
e3c16900 JK |
983 | I'm not sure it's used in all contexts. It exists to deal with there |
984 | being a few stray bits in the PC which would mislead us, not as some sort | |
04f566a3 JK |
985 | of generic thing to handle alignment or segmentation (it's possible it |
986 | should be in TARGET_READ_PC instead). */ | |
7d9884b9 JG |
987 | #if !defined (ADDR_BITS_REMOVE) |
988 | #define ADDR_BITS_REMOVE(addr) (addr) | |
7d9884b9 JG |
989 | #endif /* No ADDR_BITS_REMOVE. */ |
990 | ||
d747e0af MT |
991 | /* From valops.c */ |
992 | ||
6f54efdc | 993 | extern CORE_ADDR push_bytes PARAMS ((CORE_ADDR, char *, int)); |
d747e0af | 994 | |
16a43bf4 | 995 | extern CORE_ADDR push_word PARAMS ((CORE_ADDR, ULONGEST)); |
d747e0af | 996 | |
0239d9b3 FF |
997 | /* Some parts of gdb might be considered optional, in the sense that they |
998 | are not essential for being able to build a working, usable debugger | |
999 | for a specific environment. For example, the maintenance commands | |
1000 | are there for the benefit of gdb maintainers. As another example, | |
1001 | some environments really don't need gdb's that are able to read N | |
1002 | different object file formats. In order to make it possible (but | |
1003 | not necessarily recommended) to build "stripped down" versions of | |
1004 | gdb, the following defines control selective compilation of those | |
1005 | parts of gdb which can be safely left out when necessary. Note that | |
1006 | the default is to include everything. */ | |
1007 | ||
1008 | #ifndef MAINTENANCE_CMDS | |
1009 | #define MAINTENANCE_CMDS 1 | |
1010 | #endif | |
1011 | ||
45993f61 SC |
1012 | #ifdef MAINTENANCE_CMDS |
1013 | extern int watchdog; | |
1014 | #endif | |
1015 | ||
09722039 SG |
1016 | #include "dis-asm.h" /* Get defs for disassemble_info */ |
1017 | ||
18b46e7c SS |
1018 | extern int dis_asm_read_memory PARAMS ((bfd_vma memaddr, bfd_byte *myaddr, |
1019 | int len, disassemble_info *info)); | |
1020 | ||
1021 | extern void dis_asm_memory_error PARAMS ((int status, bfd_vma memaddr, | |
1022 | disassemble_info *info)); | |
1023 | ||
1024 | extern void dis_asm_print_address PARAMS ((bfd_vma addr, | |
1025 | disassemble_info *info)); | |
1026 | ||
1027 | extern int (*tm_print_insn) PARAMS ((bfd_vma, disassemble_info*)); | |
91550191 | 1028 | extern disassemble_info tm_print_insn_info; |
aaa3c096 AC |
1029 | #ifndef TARGET_PRINT_INSN |
1030 | #define TARGET_PRINT_INSN(vma, info) (*tm_print_insn) (vma, info) | |
1031 | #endif | |
1032 | #ifndef TARGET_PRINT_INSN_INFO | |
1033 | #define TARGET_PRINT_INSN_INFO (&tm_print_insn_info) | |
1034 | #endif | |
18b46e7c SS |
1035 | |
1036 | /* Hooks for alternate command interfaces. */ | |
1037 | ||
09722039 SG |
1038 | #ifdef __STDC__ |
1039 | struct target_waitstatus; | |
1040 | struct cmd_list_element; | |
1041 | #endif | |
1042 | ||
750b7942 | 1043 | extern void (*init_ui_hook) PARAMS ((char *argv0)); |
8164ec2e | 1044 | extern void (*command_loop_hook) PARAMS ((void)); |
18b46e7c SS |
1045 | extern void (*fputs_unfiltered_hook) PARAMS ((const char *linebuffer, |
1046 | FILE *stream)); | |
1047 | extern void (*print_frame_info_listing_hook) PARAMS ((struct symtab *s, | |
1048 | int line, int stopline, | |
1049 | int noerror)); | |
ad3b8c4a JM |
1050 | extern int (*query_hook) PARAMS ((const char *, va_list)); |
1051 | extern void (*warning_hook) PARAMS ((const char *, va_list)); | |
8164ec2e SG |
1052 | extern void (*flush_hook) PARAMS ((FILE *stream)); |
1053 | extern void (*create_breakpoint_hook) PARAMS ((struct breakpoint *b)); | |
1054 | extern void (*delete_breakpoint_hook) PARAMS ((struct breakpoint *bpt)); | |
326ae3e2 | 1055 | extern void (*modify_breakpoint_hook) PARAMS ((struct breakpoint *bpt)); |
b6d70e15 | 1056 | extern void (*target_output_hook) PARAMS ((char *)); |
637b1661 | 1057 | extern void (*interactive_hook) PARAMS ((void)); |
16041d53 | 1058 | extern void (*registers_changed_hook) PARAMS ((void)); |
91550191 SG |
1059 | extern void (*readline_begin_hook) PARAMS ((char *, ...)); |
1060 | extern char * (*readline_hook) PARAMS ((char *)); | |
1061 | extern void (*readline_end_hook) PARAMS ((void)); | |
ad3b8c4a JM |
1062 | extern void (*pc_changed_hook) PARAMS ((void)); |
1063 | extern void (*context_hook) PARAMS ((int)); | |
479f0f18 SG |
1064 | extern int (*target_wait_hook) PARAMS ((int pid, |
1065 | struct target_waitstatus *status)); | |
1066 | ||
1067 | extern void (*call_command_hook) PARAMS ((struct cmd_list_element *c, | |
1068 | char *cmd, int from_tty)); | |
1069 | ||
b607efe7 | 1070 | extern NORETURN void (*error_hook) PARAMS ((void)) ATTR_NORETURN; |
45993f61 SC |
1071 | |
1072 | ||
1073 | ||
754e5da2 SG |
1074 | /* Inhibit window interface if non-zero. */ |
1075 | ||
c5197511 | 1076 | extern int use_windows; |
754e5da2 | 1077 | |
45993f61 SC |
1078 | /* Symbolic definitions of filename-related things. */ |
1079 | /* FIXME, this doesn't work very well if host and executable | |
1080 | filesystems conventions are different. */ | |
1081 | ||
1082 | #ifndef DIRNAME_SEPARATOR | |
1083 | #define DIRNAME_SEPARATOR ':' | |
1084 | #endif | |
1085 | ||
1086 | #ifndef SLASH_P | |
9e77e83d | 1087 | #if defined(__GO32__)||defined(_WIN32) |
b6d70e15 SC |
1088 | #define SLASH_P(X) ((X)=='\\') |
1089 | #else | |
45993f61 SC |
1090 | #define SLASH_P(X) ((X)=='/') |
1091 | #endif | |
b6d70e15 | 1092 | #endif |
45993f61 SC |
1093 | |
1094 | #ifndef SLASH_CHAR | |
9e77e83d | 1095 | #if defined(__GO32__)||defined(_WIN32) |
b6d70e15 SC |
1096 | #define SLASH_CHAR '\\' |
1097 | #else | |
45993f61 SC |
1098 | #define SLASH_CHAR '/' |
1099 | #endif | |
b6d70e15 | 1100 | #endif |
45993f61 SC |
1101 | |
1102 | #ifndef SLASH_STRING | |
9e77e83d | 1103 | #if defined(__GO32__)||defined(_WIN32) |
b6d70e15 SC |
1104 | #define SLASH_STRING "\\" |
1105 | #else | |
45993f61 SC |
1106 | #define SLASH_STRING "/" |
1107 | #endif | |
b6d70e15 | 1108 | #endif |
45993f61 SC |
1109 | |
1110 | #ifndef ROOTED_P | |
1111 | #define ROOTED_P(X) (SLASH_P((X)[0])) | |
1112 | #endif | |
1113 | ||
16a43bf4 DP |
1114 | /* On some systems, PIDGET is defined to extract the inferior pid from |
1115 | an internal pid that has the thread id and pid in seperate bit | |
1116 | fields. If not defined, then just use the entire internal pid as | |
1117 | the actual pid. */ | |
1118 | ||
1119 | #ifndef PIDGET | |
1120 | #define PIDGET(pid) (pid) | |
1121 | #endif | |
1122 | ||
8adbc73e GN |
1123 | /* If under Cygwin, provide backwards compatibility with older |
1124 | Cygwin compilers that don't define the current cpp define. */ | |
1125 | #ifdef __CYGWIN32__ | |
1126 | #ifndef __CYGWIN__ | |
1127 | #define __CYGWIN__ | |
1128 | #endif | |
1129 | #endif | |
1130 | ||
09722039 | 1131 | #endif /* #ifndef DEFS_H */ |