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