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