1 /* Basic, host-specific, and target-specific definitions for GDB.
2 Copyright (C) 1986, 89, 91, 92, 93, 94, 95, 96, 98, 1999
3 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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. */
24 #include "config.h" /* Generated by configure */
26 #include <errno.h> /* System call error return status */
34 # include <sys/types.h> /* for size_t */
37 /* Just in case they're not defined in stdio.h. */
46 /* First include ansidecl.h so we can use the various macro definitions
47 here and in all subsequent file inclusions. */
51 #ifdef ANSI_PROTOTYPES
57 #include "libiberty.h"
59 /* libiberty.h can't declare this one, but evidently we can. */
60 extern char *strsignal PARAMS ((int));
68 /* For BFD64 and bfd_vma. */
71 /* An address in the program being debugged. Host byte order. Rather
72 than duplicate all the logic in BFD which figures out what type
73 this is (long, long long, etc.) and whether it needs to be 64
74 bits (the host/target interactions are subtle), we just use
77 typedef bfd_vma CORE_ADDR;
80 #define min(a, b) ((a) < (b) ? (a) : (b))
83 #define max(a, b) ((a) > (b) ? (a) : (b))
86 /* Gdb does *lots* of string compares. Use macros to speed them up by
87 avoiding function calls if the first characters are not the same. */
89 #define STRCMP(a,b) (*(a) == *(b) ? strcmp ((a), (b)) : (int)*(a) - (int)*(b))
90 #define STREQ(a,b) (*(a) == *(b) ? !strcmp ((a), (b)) : 0)
91 #define STREQN(a,b,c) (*(a) == *(b) ? !strncmp ((a), (b), (c)) : 0)
93 /* The character GNU C++ uses to build identifiers that must be unique from
94 the program's identifiers (such as $this and $$vptr). */
95 #define CPLUS_MARKER '$' /* May be overridden to '.' for SysV */
97 /* Check if a character is one of the commonly used C++ marker characters. */
98 extern int is_cplus_marker PARAMS ((int));
100 /* use tui interface if non-zero */
101 extern int tui_version;
104 /* all invocations of TUIDO should have two sets of parens */
105 #define TUIDO(x) tuiDo x
110 /* enable xdb commands if set */
111 extern int xdb_commands;
113 /* enable dbx commands if set */
114 extern int dbx_commands;
116 extern int quit_flag;
117 extern int immediate_quit;
118 extern int sevenbit_strings;
120 extern void quit PARAMS ((void));
123 /* do twice to force compiler warning */
124 #define QUIT_FIXME "FIXME"
125 #define QUIT_FIXME "ignoring redefinition of QUIT"
128 if (quit_flag) quit (); \
129 if (interactive_hook) interactive_hook (); \
134 /* Command classes are top-level categories into which commands are broken
135 down for "help" purposes.
136 Notes on classes: class_alias is for alias commands which are not
137 abbreviations of the original command. class-pseudo is for commands
138 which are not really commands nor help topics ("stop"). */
142 /* Special args to help_list */
143 all_classes = -2, all_commands = -1,
144 /* Classes of commands */
145 no_class = -1, class_run = 0, class_vars, class_stack,
146 class_files, class_support, class_info, class_breakpoint, class_trace,
147 class_alias, class_obscure, class_user, class_maintenance,
148 class_pseudo, class_tui, class_xdb
151 /* Languages represented in the symbol table and elsewhere.
152 This should probably be in language.h, but since enum's can't
153 be forward declared to satisfy opaque references before their
154 actual definition, needs to be here. */
158 language_unknown, /* Language not known */
159 language_auto, /* Placeholder for automatic setting */
161 language_cplus, /* C++ */
162 language_java, /* Java */
163 language_chill, /* Chill */
164 language_fortran, /* Fortran */
165 language_m2, /* Modula-2 */
166 language_asm, /* Assembly language */
167 language_scm /* Scheme / Guile */
174 unspecified_precision
177 /* the cleanup list records things that have to be undone
178 if an error happens (descriptors to be closed, memory to be freed, etc.)
179 Each link in the chain records a function to call and an
182 Use make_cleanup to add an element to the cleanup chain.
183 Use do_cleanups to do all cleanup actions back to a given
184 point in the chain. Use discard_cleanups to remove cleanups
185 from the chain back to a given point, not doing them. */
189 struct cleanup *next;
190 void (*function) PARAMS ((PTR));
195 /* The ability to declare that a function never returns is useful, but
196 not really required to compile GDB successfully, so the NORETURN and
197 ATTR_NORETURN macros normally expand into nothing. */
199 /* If compiling with older versions of GCC, a function may be declared
200 "volatile" to indicate that it does not return. */
203 # if defined(__GNUC__) \
204 && (__GNUC__ == 1 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7))
205 # define NORETURN volatile
207 # define NORETURN /* nothing */
211 /* GCC 2.5 and later versions define a function attribute "noreturn",
212 which is the preferred way to declare that a function never returns.
213 However GCC 2.7 appears to be the first version in which this fully
214 works everywhere we use it. */
216 #ifndef ATTR_NORETURN
217 # if defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 7
218 # define ATTR_NORETURN __attribute__ ((noreturn))
220 # define ATTR_NORETURN /* nothing */
225 # if defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 4 && defined (__ANSI_PROTOTYPES)
226 # define ATTR_FORMAT(type, x, y) __attribute__ ((format(type, x, y)))
228 # define ATTR_FORMAT(type, x, y) /* nothing */
232 /* Needed for various prototypes */
239 /* From blockframe.c */
241 extern int inside_entry_func PARAMS ((CORE_ADDR));
243 extern int inside_entry_file PARAMS ((CORE_ADDR addr));
245 extern int inside_main_func PARAMS ((CORE_ADDR pc));
247 /* From ch-lang.c, for the moment. (FIXME) */
249 extern char *chill_demangle PARAMS ((const char *));
253 extern void notice_quit PARAMS ((void));
255 extern int strcmp_iw PARAMS ((const char *, const char *));
257 extern char *safe_strerror PARAMS ((int));
259 extern char *safe_strsignal PARAMS ((int));
261 extern void init_malloc PARAMS ((void *));
263 extern void request_quit PARAMS ((int));
265 extern void do_cleanups PARAMS ((struct cleanup *));
266 extern void do_final_cleanups PARAMS ((struct cleanup *));
267 extern void do_my_cleanups PARAMS ((struct cleanup **, struct cleanup *));
268 extern void do_run_cleanups PARAMS ((struct cleanup *));
270 extern void discard_cleanups PARAMS ((struct cleanup *));
271 extern void discard_final_cleanups PARAMS ((struct cleanup *));
272 extern void discard_my_cleanups PARAMS ((struct cleanup **, struct cleanup *));
274 typedef void (*make_cleanup_func) PARAMS ((void *));
276 extern struct cleanup *make_cleanup PARAMS ((make_cleanup_func, void *));
278 extern struct cleanup *make_final_cleanup PARAMS ((make_cleanup_func, void *));
280 extern struct cleanup *make_my_cleanup PARAMS ((struct cleanup **,
281 make_cleanup_func, void *));
283 extern struct cleanup *make_run_cleanup PARAMS ((make_cleanup_func, void *));
285 extern struct cleanup *save_cleanups PARAMS ((void));
286 extern struct cleanup *save_final_cleanups PARAMS ((void));
287 extern struct cleanup *save_my_cleanups PARAMS ((struct cleanup **));
289 extern void restore_cleanups PARAMS ((struct cleanup *));
290 extern void restore_final_cleanups PARAMS ((struct cleanup *));
291 extern void restore_my_cleanups PARAMS ((struct cleanup **, struct cleanup *));
293 extern void free_current_contents PARAMS ((char **));
295 extern void null_cleanup PARAMS ((PTR));
297 extern int myread PARAMS ((int, char *, int));
299 extern int query PARAMS((char *, ...))
300 ATTR_FORMAT(printf, 1, 2);
302 #if !defined (USE_MMALLOC)
303 extern PTR mmalloc PARAMS ((PTR, size_t));
304 extern PTR mrealloc PARAMS ((PTR, PTR, size_t));
305 extern void mfree PARAMS ((PTR, PTR));
308 /* From demangle.c */
310 extern void set_demangling_style PARAMS ((char *));
315 typedef int (use_struct_convention_fn) PARAMS ((int gcc_p, struct type *value_type));
316 extern use_struct_convention_fn generic_use_struct_convention;
318 typedef unsigned char *(breakpoint_from_pc_fn) PARAMS ((CORE_ADDR *pcptr, int *lenptr));
322 /* Annotation stuff. */
324 extern int annotation_level; /* in stack.c */
326 extern void begin_line PARAMS ((void));
328 extern void wrap_here PARAMS ((char *));
330 extern void reinitialize_more_filter PARAMS ((void));
340 typedef struct tui_stream
342 enum streamtype ts_streamtype;
348 extern GDB_FILE *gdb_stdout;
349 extern GDB_FILE *gdb_stderr;
352 typedef FILE GDB_FILE;
353 #define gdb_stdout stdout
354 #define gdb_stderr stderr
359 #include "tuiCommand.h"
362 #include "tuiLayout.h"
366 extern void gdb_fclose PARAMS ((GDB_FILE **));
368 extern void gdb_flush PARAMS ((GDB_FILE *));
370 extern GDB_FILE *gdb_fopen PARAMS ((char * name, char * mode));
372 extern void fputs_filtered PARAMS ((const char *, GDB_FILE *));
374 extern void fputs_unfiltered PARAMS ((const char *, GDB_FILE *));
376 extern int fputc_filtered PARAMS ((int c, GDB_FILE *));
378 extern int fputc_unfiltered PARAMS ((int c, GDB_FILE *));
380 extern int putchar_unfiltered PARAMS ((int c));
382 extern void puts_filtered PARAMS ((const char *));
384 extern void puts_unfiltered PARAMS ((const char *));
386 extern void puts_debug PARAMS ((char *prefix, char *string, char *suffix));
388 extern void vprintf_filtered PARAMS ((const char *, va_list))
389 ATTR_FORMAT(printf, 1, 0);
391 extern void vfprintf_filtered PARAMS ((GDB_FILE *, const char *, va_list))
392 ATTR_FORMAT(printf, 2, 0);
394 extern void fprintf_filtered PARAMS ((GDB_FILE *, const char *, ...))
395 ATTR_FORMAT(printf, 2, 3);
397 extern void fprintfi_filtered PARAMS ((int, GDB_FILE *, const char *, ...))
398 ATTR_FORMAT(printf, 3, 4);
400 extern void printf_filtered PARAMS ((const char *, ...))
401 ATTR_FORMAT(printf, 1, 2);
403 extern void printfi_filtered PARAMS ((int, const char *, ...))
404 ATTR_FORMAT(printf, 2, 3);
406 extern void vprintf_unfiltered PARAMS ((const char *, va_list))
407 ATTR_FORMAT(printf, 1, 0);
409 extern void vfprintf_unfiltered PARAMS ((GDB_FILE *, const char *, va_list))
410 ATTR_FORMAT(printf, 2, 0);
412 extern void fprintf_unfiltered PARAMS ((GDB_FILE *, const char *, ...))
413 ATTR_FORMAT(printf, 2, 3);
415 extern void printf_unfiltered PARAMS ((const char *, ...))
416 ATTR_FORMAT(printf, 1, 2);
418 extern int gdb_file_isatty PARAMS ((GDB_FILE *));
420 extern GDB_FILE *gdb_file_init_astring PARAMS ((int));
422 extern void gdb_file_deallocate PARAMS ((GDB_FILE **));
424 extern char *gdb_file_get_strbuf PARAMS ((GDB_FILE *));
426 extern void gdb_file_adjust_strbuf PARAMS ((int, GDB_FILE *));
428 extern void print_spaces PARAMS ((int, GDB_FILE *));
430 extern void print_spaces_filtered PARAMS ((int, GDB_FILE *));
432 extern char *n_spaces PARAMS ((int));
434 extern void gdb_printchar PARAMS ((int, GDB_FILE *, int));
436 extern void gdb_print_address PARAMS ((void *, GDB_FILE *));
438 typedef bfd_vma t_addr;
439 typedef bfd_vma t_reg;
440 extern char* paddr PARAMS ((t_addr addr));
442 extern char* preg PARAMS ((t_reg reg));
444 extern char* paddr_nz PARAMS ((t_addr addr));
446 extern char* preg_nz PARAMS ((t_reg reg));
448 extern void fprintf_symbol_filtered PARAMS ((GDB_FILE *, char *,
449 enum language, int));
451 extern NORETURN void perror_with_name PARAMS ((char *)) ATTR_NORETURN;
453 extern void print_sys_errmsg PARAMS ((char *, int));
455 /* From regex.c or libc. BSD 4.4 declares this with the argument type as
456 "const char *" in unistd.h, so we can't declare the argument
459 extern char *re_comp PARAMS ((const char *));
463 extern void symbol_file_command PARAMS ((char *, int));
467 extern char *skip_quoted PARAMS ((char *));
469 extern char *gdb_readline PARAMS ((char *));
471 extern char *command_line_input PARAMS ((char *, int, char *));
473 extern void print_prompt PARAMS ((void));
475 extern int input_from_terminal_p PARAMS ((void));
477 extern int info_verbose;
479 /* From printcmd.c */
481 extern void set_next_address PARAMS ((CORE_ADDR));
483 extern void print_address_symbolic PARAMS ((CORE_ADDR, GDB_FILE *, int,
486 extern void print_address_numeric PARAMS ((CORE_ADDR, int, GDB_FILE *));
488 extern void print_address PARAMS ((CORE_ADDR, GDB_FILE *));
492 extern int openp PARAMS ((char *, int, char *, int, int, char **));
494 extern int source_full_path_of PARAMS ((char *, char **));
496 extern void mod_path PARAMS ((char *, char **));
498 extern void directory_command PARAMS ((char *, int));
500 extern void init_source_path PARAMS ((void));
502 extern char *symtab_to_filename PARAMS ((struct symtab *));
506 extern int read_relative_register_raw_bytes PARAMS ((int, char *));
508 /* From readline (but not in any readline .h files). */
510 extern char *tilde_expand PARAMS ((char *));
512 /* Control types for commands */
514 enum misc_command_type
522 enum command_control_type
532 /* Structure for saved commands lines
533 (for breakpoints, defined commands, etc). */
537 struct command_line *next;
539 enum command_control_type control_type;
541 struct command_line **body_list;
544 extern struct command_line *read_command_lines PARAMS ((char *, int));
546 extern void free_command_lines PARAMS ((struct command_line **));
548 /* String containing the current directory (what getwd would return). */
550 extern char *current_directory;
552 /* Default radixes for input and output. Only some values supported. */
553 extern unsigned input_radix;
554 extern unsigned output_radix;
556 /* Possibilities for prettyprint parameters to routines which print
557 things. Like enum language, this should be in value.h, but needs
558 to be here for the same reason. FIXME: If we can eliminate this
559 as an arg to LA_VAL_PRINT, then we can probably move it back to
564 Val_no_prettyprint = 0,
566 /* Use the default setting which the user has specified. */
571 /* Host machine definition. This will be a symlink to one of the
572 xm-*.h files, built by the `configure' script. */
576 /* Native machine support. This will be a symlink to one of the
577 nm-*.h files, built by the `configure' script. */
581 /* Target machine definition. This will be a symlink to one of the
582 tm-*.h files, built by the `configure' script. */
586 /* If the xm.h file did not define the mode string used to open the
587 files, assume that binary files are opened the same way as text
590 #include "fopen-same.h"
593 /* Microsoft C can't deal with const pointers */
598 #define CONST_PTR const
602 * Allow things in gdb to be declared "volatile". If compiling ANSI, it
603 * just works. If compiling with gcc but non-ansi, redefine to __volatile__.
604 * If non-ansi, non-gcc, then eliminate "volatile" entirely, making those
605 * objects be read-write rather than read-only.
611 # define volatile __volatile__
613 # define volatile /*nothing*/
616 #endif /* volatile */
618 /* Defaults for system-wide constants (if not defined by xm.h, we fake it).
619 FIXME: Assumes 2's complement arithmetic */
621 #if !defined (UINT_MAX)
622 #define UINT_MAX ((unsigned int)(~0)) /* 0xFFFFFFFF for 32-bits */
625 #if !defined (INT_MAX)
626 #define INT_MAX ((int)(UINT_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */
629 #if !defined (INT_MIN)
630 #define INT_MIN ((int)((int) ~0 ^ INT_MAX)) /* 0x80000000 for 32-bits */
633 #if !defined (ULONG_MAX)
634 #define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF for 32-bits */
637 #if !defined (LONG_MAX)
638 #define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */
645 /* This is to make sure that LONGEST is at least as big as CORE_ADDR. */
647 #define LONGEST BFD_HOST_64_BIT
648 #define ULONGEST BFD_HOST_U_64_BIT
652 # ifdef CC_HAS_LONG_LONG
653 # define LONGEST long long
654 # define ULONGEST unsigned long long
656 /* BFD_HOST_64_BIT is defined for some hosts that don't have long long
657 (e.g. i386-windows) so try it. */
658 # ifdef BFD_HOST_64_BIT
659 # define LONGEST BFD_HOST_64_BIT
660 # define ULONGEST BFD_HOST_U_64_BIT
662 # define LONGEST long
663 # define ULONGEST unsigned long
667 #endif /* No BFD64 */
669 #endif /* ! LONGEST */
671 /* Convert a LONGEST to an int. This is used in contexts (e.g. number of
672 arguments to a function, number in a value history, register number, etc.)
673 where the value must not be larger than can fit in an int. */
675 extern int longest_to_int PARAMS ((LONGEST));
677 /* Assorted functions we can declare, now that const and volatile are
680 extern char *savestring PARAMS ((const char *, int));
682 extern char *msavestring PARAMS ((void *, const char *, int));
684 extern char *strsave PARAMS ((const char *));
686 extern char *mstrsave PARAMS ((void *, const char *));
688 #ifdef _MSC_VER /* FIXME; was long, but this causes compile errors in msvc if already defined */
689 extern PTR xmmalloc PARAMS ((PTR, size_t));
691 extern PTR xmrealloc PARAMS ((PTR, PTR, size_t));
693 extern PTR xmmalloc PARAMS ((PTR, long));
695 extern PTR xmrealloc PARAMS ((PTR, PTR, long));
698 extern int parse_escape PARAMS ((char **));
700 /* compat - handle old targets that just define REGISTER_NAMES */
701 #ifndef REGISTER_NAME
702 extern char *gdb_register_names[];
703 #define REGISTER_NAME(i) gdb_register_names[i]
706 /* Message to be printed before the error message, when an error occurs. */
708 extern char *error_pre_print;
710 /* Message to be printed before the error message, when an error occurs. */
712 extern char *quit_pre_print;
714 /* Message to be printed before the warning message, when a warning occurs. */
716 extern char *warning_pre_print;
718 extern NORETURN void error PARAMS((const char *, ...)) ATTR_NORETURN;
720 extern void error_begin PARAMS ((void));
722 extern NORETURN void fatal PARAMS((char *, ...)) ATTR_NORETURN;
724 extern NORETURN void nomem PARAMS ((long)) ATTR_NORETURN;
726 /* Reasons for calling return_to_top_level. */
728 /* User interrupt. */
731 /* Any other error. */
735 #define RETURN_MASK_QUIT (1 << (int)RETURN_QUIT)
736 #define RETURN_MASK_ERROR (1 << (int)RETURN_ERROR)
737 #define RETURN_MASK_ALL (RETURN_MASK_QUIT | RETURN_MASK_ERROR)
738 typedef int return_mask;
741 return_to_top_level PARAMS ((enum return_reason)) ATTR_NORETURN;
743 typedef int (catch_errors_ftype) PARAMS ((PTR));
744 extern int catch_errors PARAMS ((catch_errors_ftype *, PTR, char *, return_mask));
746 extern void warning_begin PARAMS ((void));
748 extern void warning PARAMS ((const char *, ...))
749 ATTR_FORMAT(printf, 1, 2);
751 /* Global functions from other, non-gdb GNU thingies.
752 Libiberty thingies are no longer declared here. We include libiberty.h
755 #ifndef GETENV_PROVIDED
756 extern char *getenv PARAMS ((const char *));
759 /* From other system libraries */
766 #if defined(_MSC_VER) && !defined(__cplusplus)
767 /* msvc defines these in stdlib.h for c code */
774 #define min(a, b) ((a) < (b) ? (a) : (b))
777 #define max(a, b) ((a) > (b) ? (a) : (b))
781 /* We take the address of fclose later, but some stdio's forget
782 to declare this. We can't always declare it since there's
783 no way to declare the parameters without upsetting some compiler
786 #ifndef FCLOSE_PROVIDED
787 extern int fclose PARAMS ((FILE *));
791 extern double atof PARAMS ((const char *)); /* X3.159-1989 4.10.1.1 */
794 #ifndef MALLOC_INCOMPATIBLE
796 #ifdef NEED_DECLARATION_MALLOC
797 extern PTR malloc ();
800 #ifdef NEED_DECLARATION_REALLOC
801 extern PTR realloc ();
804 #ifdef NEED_DECLARATION_FREE
808 #endif /* MALLOC_INCOMPATIBLE */
810 /* Various possibilities for alloca. */
813 # define alloca __builtin_alloca
814 # else /* Not GNU C */
815 # ifdef HAVE_ALLOCA_H
822 /* We need to be careful not to declare this in a way which conflicts with
823 bison. Bison never declares it as char *, but under various circumstances
824 (like __hpux) we need to use void *. */
825 # if defined (__STDC__) || defined (__hpux)
826 extern void *alloca ();
827 # else /* Don't use void *. */
828 extern char *alloca ();
829 # endif /* Don't use void *. */
830 # endif /* Not _AIX */
831 # endif /* Not HAVE_ALLOCA_H */
832 # endif /* Not GNU C */
833 #endif /* alloca not defined */
835 /* HOST_BYTE_ORDER must be defined to one of these. */
841 #if !defined (BIG_ENDIAN)
842 #define BIG_ENDIAN 4321
845 #if !defined (LITTLE_ENDIAN)
846 #define LITTLE_ENDIAN 1234
849 /* Dynamic target-system-dependent parameters for GDB. */
852 /* Static target-system-dependent parameters for GDB. */
854 /* Number of bits in a char or unsigned char for the target machine.
855 Just like CHAR_BIT in <limits.h> but describes the target machine. */
856 #if !defined (TARGET_CHAR_BIT)
857 #define TARGET_CHAR_BIT 8
860 /* Number of bits in a short or unsigned short for the target machine. */
861 #if !defined (TARGET_SHORT_BIT)
862 #define TARGET_SHORT_BIT (2 * TARGET_CHAR_BIT)
865 /* Number of bits in an int or unsigned int for the target machine. */
866 #if !defined (TARGET_INT_BIT)
867 #define TARGET_INT_BIT (4 * TARGET_CHAR_BIT)
870 /* Number of bits in a long or unsigned long for the target machine. */
871 #if !defined (TARGET_LONG_BIT)
872 #define TARGET_LONG_BIT (4 * TARGET_CHAR_BIT)
875 /* Number of bits in a long long or unsigned long long for the target machine. */
876 #if !defined (TARGET_LONG_LONG_BIT)
877 #define TARGET_LONG_LONG_BIT (2 * TARGET_LONG_BIT)
880 /* Number of bits in a float for the target machine. */
881 #if !defined (TARGET_FLOAT_BIT)
882 #define TARGET_FLOAT_BIT (4 * TARGET_CHAR_BIT)
885 /* Number of bits in a double for the target machine. */
886 #if !defined (TARGET_DOUBLE_BIT)
887 #define TARGET_DOUBLE_BIT (8 * TARGET_CHAR_BIT)
890 /* Number of bits in a long double for the target machine. */
891 #if !defined (TARGET_LONG_DOUBLE_BIT)
892 #define TARGET_LONG_DOUBLE_BIT (2 * TARGET_DOUBLE_BIT)
895 /* Number of bits in a pointer for the target machine */
896 #if !defined (TARGET_PTR_BIT)
897 #define TARGET_PTR_BIT TARGET_INT_BIT
900 /* If we picked up a copy of CHAR_BIT from a configuration file
901 (which may get it by including <limits.h>) then use it to set
902 the number of bits in a host char. If not, use the same size
905 #if defined (CHAR_BIT)
906 #define HOST_CHAR_BIT CHAR_BIT
908 #define HOST_CHAR_BIT TARGET_CHAR_BIT
911 /* The bit byte-order has to do just with numbering of bits in
912 debugging symbols and such. Conceptually, it's quite separate
913 from byte/word byte order. */
915 #if !defined (BITS_BIG_ENDIAN)
916 #define BITS_BIG_ENDIAN (TARGET_BYTE_ORDER == BIG_ENDIAN)
921 extern LONGEST extract_signed_integer PARAMS ((void *, int));
923 extern ULONGEST extract_unsigned_integer PARAMS ((void *, int));
925 extern int extract_long_unsigned_integer PARAMS ((void *, int, LONGEST *));
927 extern CORE_ADDR extract_address PARAMS ((void *, int));
929 extern void store_signed_integer PARAMS ((PTR, int, LONGEST));
931 extern void store_unsigned_integer PARAMS ((PTR, int, ULONGEST));
933 extern void store_address PARAMS ((PTR, int, LONGEST));
935 /* Setup definitions for host and target floating point formats. We need to
936 consider the format for `float', `double', and `long double' for both target
937 and host. We need to do this so that we know what kind of conversions need
938 to be done when converting target numbers to and from the hosts DOUBLEST
941 /* This is used to indicate that we don't know the format of the floating point
942 number. Typically, this is useful for native ports, where the actual format
943 is irrelevant, since no conversions will be taking place. */
945 extern const struct floatformat floatformat_unknown;
947 #if HOST_BYTE_ORDER == BIG_ENDIAN
948 # ifndef HOST_FLOAT_FORMAT
949 # define HOST_FLOAT_FORMAT &floatformat_ieee_single_big
951 # ifndef HOST_DOUBLE_FORMAT
952 # define HOST_DOUBLE_FORMAT &floatformat_ieee_double_big
954 #else /* LITTLE_ENDIAN */
955 # ifndef HOST_FLOAT_FORMAT
956 # define HOST_FLOAT_FORMAT &floatformat_ieee_single_little
958 # ifndef HOST_DOUBLE_FORMAT
959 # define HOST_DOUBLE_FORMAT &floatformat_ieee_double_little
963 #ifndef HOST_LONG_DOUBLE_FORMAT
964 #define HOST_LONG_DOUBLE_FORMAT &floatformat_unknown
967 #ifndef TARGET_FLOAT_FORMAT
968 #define TARGET_FLOAT_FORMAT (TARGET_BYTE_ORDER == BIG_ENDIAN \
969 ? &floatformat_ieee_single_big \
970 : &floatformat_ieee_single_little)
972 #ifndef TARGET_DOUBLE_FORMAT
973 #define TARGET_DOUBLE_FORMAT (TARGET_BYTE_ORDER == BIG_ENDIAN \
974 ? &floatformat_ieee_double_big \
975 : &floatformat_ieee_double_little)
978 #ifndef TARGET_LONG_DOUBLE_FORMAT
979 # define TARGET_LONG_DOUBLE_FORMAT &floatformat_unknown
982 /* Use `long double' if the host compiler supports it. (Note that this is not
983 necessarily any longer than `double'. On SunOS/gcc, it's the same as
984 double.) This is necessary because GDB internally converts all floating
985 point values to the widest type supported by the host.
987 There are problems however, when the target `long double' is longer than the
988 host's `long double'. In general, we'll probably reduce the precision of
989 any such values and print a warning. */
991 #ifdef HAVE_LONG_DOUBLE
992 typedef long double DOUBLEST;
994 typedef double DOUBLEST;
997 extern void floatformat_to_doublest PARAMS ((const struct floatformat *,
998 char *, DOUBLEST *));
999 extern void floatformat_from_doublest PARAMS ((const struct floatformat *,
1000 DOUBLEST *, char *));
1001 extern DOUBLEST extract_floating PARAMS ((void *, int));
1003 extern void store_floating PARAMS ((void *, int, DOUBLEST));
1005 /* On some machines there are bits in addresses which are not really
1006 part of the address, but are used by the kernel, the hardware, etc.
1007 for special purposes. ADDR_BITS_REMOVE takes out any such bits
1008 so we get a "real" address such as one would find in a symbol
1009 table. This is used only for addresses of instructions, and even then
1010 I'm not sure it's used in all contexts. It exists to deal with there
1011 being a few stray bits in the PC which would mislead us, not as some sort
1012 of generic thing to handle alignment or segmentation (it's possible it
1013 should be in TARGET_READ_PC instead). */
1014 #if !defined (ADDR_BITS_REMOVE)
1015 #define ADDR_BITS_REMOVE(addr) (addr)
1016 #endif /* No ADDR_BITS_REMOVE. */
1020 extern CORE_ADDR push_bytes PARAMS ((CORE_ADDR, char *, int));
1022 extern CORE_ADDR push_word PARAMS ((CORE_ADDR, ULONGEST));
1024 /* Some parts of gdb might be considered optional, in the sense that they
1025 are not essential for being able to build a working, usable debugger
1026 for a specific environment. For example, the maintenance commands
1027 are there for the benefit of gdb maintainers. As another example,
1028 some environments really don't need gdb's that are able to read N
1029 different object file formats. In order to make it possible (but
1030 not necessarily recommended) to build "stripped down" versions of
1031 gdb, the following defines control selective compilation of those
1032 parts of gdb which can be safely left out when necessary. Note that
1033 the default is to include everything. */
1035 #ifndef MAINTENANCE_CMDS
1036 #define MAINTENANCE_CMDS 1
1039 #ifdef MAINTENANCE_CMDS
1040 extern int watchdog;
1043 /* Hooks for alternate command interfaces. */
1046 struct target_waitstatus;
1047 struct cmd_list_element;
1050 extern void (*init_ui_hook) PARAMS ((char *argv0));
1051 extern void (*command_loop_hook) PARAMS ((void));
1052 extern void (*fputs_unfiltered_hook) PARAMS ((const char *linebuffer,
1054 extern void (*print_frame_info_listing_hook) PARAMS ((struct symtab *s,
1055 int line, int stopline,
1057 extern struct frame_info *parse_frame_specification PARAMS ((char *frame_exp));
1058 extern int (*query_hook) PARAMS ((const char *, va_list));
1059 extern void (*warning_hook) PARAMS ((const char *, va_list));
1060 extern void (*flush_hook) PARAMS ((GDB_FILE *stream));
1061 extern void (*create_breakpoint_hook) PARAMS ((struct breakpoint *b));
1062 extern void (*delete_breakpoint_hook) PARAMS ((struct breakpoint *bpt));
1063 extern void (*modify_breakpoint_hook) PARAMS ((struct breakpoint *bpt));
1064 extern void (*target_output_hook) PARAMS ((char *));
1065 extern void (*interactive_hook) PARAMS ((void));
1066 extern void (*registers_changed_hook) PARAMS ((void));
1067 extern void (*readline_begin_hook) PARAMS ((char *, ...));
1068 extern char * (*readline_hook) PARAMS ((char *));
1069 extern void (*readline_end_hook) PARAMS ((void));
1070 extern void (*register_changed_hook) PARAMS ((int regno));
1071 extern void (*memory_changed_hook) PARAMS ((CORE_ADDR addr, int len));
1072 extern void (*context_hook) PARAMS ((int));
1073 extern int (*target_wait_hook) PARAMS ((int pid,
1074 struct target_waitstatus *status));
1076 extern void (*call_command_hook) PARAMS ((struct cmd_list_element *c,
1077 char *cmd, int from_tty));
1079 extern NORETURN void (*error_hook) PARAMS ((void)) ATTR_NORETURN;
1081 extern void (*error_begin_hook) PARAMS ((void));
1084 /* Inhibit window interface if non-zero. */
1086 extern int use_windows;
1088 /* Symbolic definitions of filename-related things. */
1089 /* FIXME, this doesn't work very well if host and executable
1090 filesystems conventions are different. */
1092 #ifndef DIRNAME_SEPARATOR
1093 #define DIRNAME_SEPARATOR ':'
1097 #if defined(__GO32__)||defined(_WIN32)
1098 #define SLASH_P(X) ((X)=='\\')
1100 #define SLASH_P(X) ((X)=='/')
1105 #if defined(__GO32__)||defined(_WIN32)
1106 #define SLASH_CHAR '\\'
1108 #define SLASH_CHAR '/'
1112 #ifndef SLASH_STRING
1113 #if defined(__GO32__)||defined(_WIN32)
1114 #define SLASH_STRING "\\"
1116 #define SLASH_STRING "/"
1121 #define ROOTED_P(X) (SLASH_P((X)[0]))
1124 /* On some systems, PIDGET is defined to extract the inferior pid from
1125 an internal pid that has the thread id and pid in seperate bit
1126 fields. If not defined, then just use the entire internal pid as
1130 #define PIDGET(pid) (pid)
1133 /* If under Cygwin, provide backwards compatibility with older
1134 Cygwin compilers that don't define the current cpp define. */
1141 #endif /* #ifndef DEFS_H */