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