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.
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 */
31 # include <sys/types.h> /* for size_t */
34 /* Just in case they're not defined in stdio.h. */
43 /* First include ansidecl.h so we can use the various macro definitions
44 here and in all subsequent file inclusions. */
48 #ifdef ANSI_PROTOTYPES
54 #include "libiberty.h"
56 /* libiberty.h can't declare this one, but evidently we can. */
57 extern char *strsignal
PARAMS ((int));
65 /* For BFD64 and bfd_vma. */
68 /* An address in the program being debugged. Host byte order. Rather
69 than duplicate all the logic in BFD which figures out what type
70 this is (long, long long, etc.) and whether it needs to be 64
71 bits (the host/target interactions are subtle), we just use
74 typedef bfd_vma CORE_ADDR
;
77 #define min(a, b) ((a) < (b) ? (a) : (b))
80 #define max(a, b) ((a) > (b) ? (a) : (b))
83 /* Gdb does *lots* of string compares. Use macros to speed them up by
84 avoiding function calls if the first characters are not the same. */
86 #define STRCMP(a,b) (*(a) == *(b) ? strcmp ((a), (b)) : (int)*(a) - (int)*(b))
87 #define STREQ(a,b) (*(a) == *(b) ? !strcmp ((a), (b)) : 0)
88 #define STREQN(a,b,c) (*(a) == *(b) ? !strncmp ((a), (b), (c)) : 0)
90 /* The character GNU C++ uses to build identifiers that must be unique from
91 the program's identifiers (such as $this and $$vptr). */
92 #define CPLUS_MARKER '$' /* May be overridden to '.' for SysV */
94 /* Check if a character is one of the commonly used C++ marker characters. */
95 extern int is_cplus_marker
PARAMS ((int));
97 /* use tui interface if non-zero */
98 extern int tui_version
;
101 /* all invocations of TUIDO should have two sets of parens */
102 #define TUIDO(x) tuiDo x
107 /* enable xdb commands if set */
108 extern int xdb_commands
;
110 /* enable dbx commands if set */
111 extern int dbx_commands
;
113 extern int quit_flag
;
114 extern int immediate_quit
;
115 extern int sevenbit_strings
;
117 extern void quit
PARAMS ((void));
120 /* do twice to force compiler warning */
121 #define QUIT_FIXME "FIXME"
122 #define QUIT_FIXME "ignoring redefinition of QUIT"
125 if (quit_flag) quit (); \
126 if (interactive_hook) interactive_hook (); \
131 /* Command classes are top-level categories into which commands are broken
132 down for "help" purposes.
133 Notes on classes: class_alias is for alias commands which are not
134 abbreviations of the original command. class-pseudo is for commands
135 which are not really commands nor help topics ("stop"). */
139 /* Special args to help_list */
140 all_classes
= -2, all_commands
= -1,
141 /* Classes of commands */
142 no_class
= -1, class_run
= 0, class_vars
, class_stack
,
143 class_files
, class_support
, class_info
, class_breakpoint
, class_trace
,
144 class_alias
, class_obscure
, class_user
, class_maintenance
,
145 class_pseudo
, class_tui
, class_xdb
148 /* Languages represented in the symbol table and elsewhere.
149 This should probably be in language.h, but since enum's can't
150 be forward declared to satisfy opaque references before their
151 actual definition, needs to be here. */
155 language_unknown
, /* Language not known */
156 language_auto
, /* Placeholder for automatic setting */
158 language_cplus
, /* C++ */
159 /* start-sanitize-java */
160 language_java
, /* Java */
161 /* end-sanitize-java */
162 language_chill
, /* Chill */
163 language_fortran
, /* Fortran */
164 language_m2
, /* Modula-2 */
165 language_asm
, /* Assembly language */
166 language_scm
/* Scheme / Guile */
173 unspecified_precision
176 /* the cleanup list records things that have to be undone
177 if an error happens (descriptors to be closed, memory to be freed, etc.)
178 Each link in the chain records a function to call and an
181 Use make_cleanup to add an element to the cleanup chain.
182 Use do_cleanups to do all cleanup actions back to a given
183 point in the chain. Use discard_cleanups to remove cleanups
184 from the chain back to a given point, not doing them. */
188 struct cleanup
*next
;
189 void (*function
) PARAMS ((PTR
));
194 /* The ability to declare that a function never returns is useful, but
195 not really required to compile GDB successfully, so the NORETURN and
196 ATTR_NORETURN macros normally expand into nothing. */
198 /* If compiling with older versions of GCC, a function may be declared
199 "volatile" to indicate that it does not return. */
202 # if defined(__GNUC__) \
203 && (__GNUC__ == 1 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7))
204 # define NORETURN volatile
206 # define NORETURN /* nothing */
210 /* GCC 2.5 and later versions define a function attribute "noreturn",
211 which is the preferred way to declare that a function never returns.
212 However GCC 2.7 appears to be the first version in which this fully
213 works everywhere we use it. */
215 #ifndef ATTR_NORETURN
216 # if defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 7
217 # define ATTR_NORETURN __attribute__ ((noreturn))
219 # define ATTR_NORETURN /* nothing */
224 # if defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 4 && defined (__ANSI_PROTOTYPES)
225 # define ATTR_FORMAT(type, x, y) __attribute__ ((format(type, x, y)))
227 # define ATTR_FORMAT(type, x, y) /* nothing */
231 /* Needed for various prototypes */
238 /* From blockframe.c */
240 extern int inside_entry_func
PARAMS ((CORE_ADDR
));
242 extern int inside_entry_file
PARAMS ((CORE_ADDR addr
));
244 extern int inside_main_func
PARAMS ((CORE_ADDR pc
));
246 /* From ch-lang.c, for the moment. (FIXME) */
248 extern char *chill_demangle
PARAMS ((const char *));
252 extern void notice_quit
PARAMS ((void));
254 extern int strcmp_iw
PARAMS ((const char *, const char *));
256 extern char *safe_strerror
PARAMS ((int));
258 extern char *safe_strsignal
PARAMS ((int));
260 extern void init_malloc
PARAMS ((void *));
262 extern void request_quit
PARAMS ((int));
264 extern void do_cleanups
PARAMS ((struct cleanup
*));
265 extern void do_final_cleanups
PARAMS ((struct cleanup
*));
266 extern void do_my_cleanups
PARAMS ((struct cleanup
**, struct cleanup
*));
267 extern void do_run_cleanups
PARAMS ((struct cleanup
*));
269 extern void discard_cleanups
PARAMS ((struct cleanup
*));
270 extern void discard_final_cleanups
PARAMS ((struct cleanup
*));
271 extern void discard_my_cleanups
PARAMS ((struct cleanup
**, struct cleanup
*));
273 typedef void (*make_cleanup_func
) PARAMS ((void *));
275 extern struct cleanup
*make_cleanup
PARAMS ((make_cleanup_func
, void *));
277 extern struct cleanup
*make_final_cleanup
PARAMS ((make_cleanup_func
, void *));
279 extern struct cleanup
*make_my_cleanup
PARAMS ((struct cleanup
**,
280 make_cleanup_func
, void *));
282 extern struct cleanup
*make_run_cleanup
PARAMS ((make_cleanup_func
, void *));
284 extern struct cleanup
*save_cleanups
PARAMS ((void));
285 extern struct cleanup
*save_final_cleanups
PARAMS ((void));
286 extern struct cleanup
*save_my_cleanups
PARAMS ((struct cleanup
**));
288 extern void restore_cleanups
PARAMS ((struct cleanup
*));
289 extern void restore_final_cleanups
PARAMS ((struct cleanup
*));
290 extern void restore_my_cleanups
PARAMS ((struct cleanup
**, struct cleanup
*));
292 extern void free_current_contents
PARAMS ((char **));
294 extern void null_cleanup
PARAMS ((PTR
));
296 extern int myread
PARAMS ((int, char *, int));
298 extern int query
PARAMS((char *, ...))
299 ATTR_FORMAT(printf
, 1, 2);
301 #if !defined (USE_MMALLOC)
302 extern PTR mmalloc
PARAMS ((PTR
, size_t));
303 extern PTR mrealloc
PARAMS ((PTR
, PTR
, size_t));
304 extern void mfree
PARAMS ((PTR
, PTR
));
307 /* From demangle.c */
309 extern void set_demangling_style
PARAMS ((char *));
314 typedef int (use_struct_convention_fn
) PARAMS ((int gcc_p
, struct type
*value_type
));
315 extern use_struct_convention_fn generic_use_struct_convention
;
317 typedef unsigned char *(breakpoint_from_pc_fn
) PARAMS ((CORE_ADDR
*pcptr
, int *lenptr
));
321 /* Annotation stuff. */
323 extern int annotation_level
; /* in stack.c */
325 extern void begin_line
PARAMS ((void));
327 extern void wrap_here
PARAMS ((char *));
329 extern void reinitialize_more_filter
PARAMS ((void));
339 typedef struct tui_stream
341 enum streamtype ts_streamtype
;
347 extern GDB_FILE
*gdb_stdout
;
348 extern GDB_FILE
*gdb_stderr
;
351 typedef FILE GDB_FILE
;
352 #define gdb_stdout stdout
353 #define gdb_stderr stderr
358 #include "tuiCommand.h"
361 #include "tuiLayout.h"
365 extern void gdb_fclose
PARAMS ((GDB_FILE
**));
367 extern void gdb_flush
PARAMS ((GDB_FILE
*));
369 extern GDB_FILE
*gdb_fopen
PARAMS ((char * name
, char * mode
));
371 extern void fputs_filtered
PARAMS ((const char *, GDB_FILE
*));
373 extern void fputs_unfiltered
PARAMS ((const char *, GDB_FILE
*));
375 extern int fputc_filtered
PARAMS ((int c
, GDB_FILE
*));
377 extern int fputc_unfiltered
PARAMS ((int c
, GDB_FILE
*));
379 extern int putchar_unfiltered
PARAMS ((int c
));
381 extern void puts_filtered
PARAMS ((const char *));
383 extern void puts_unfiltered
PARAMS ((const char *));
385 extern void puts_debug
PARAMS ((char *prefix
, char *string
, char *suffix
));
387 extern void vprintf_filtered
PARAMS ((const char *, va_list))
388 ATTR_FORMAT(printf
, 1, 0);
390 extern void vfprintf_filtered
PARAMS ((GDB_FILE
*, const char *, va_list))
391 ATTR_FORMAT(printf
, 2, 0);
393 extern void fprintf_filtered
PARAMS ((GDB_FILE
*, const char *, ...))
394 ATTR_FORMAT(printf
, 2, 3);
396 extern void fprintfi_filtered
PARAMS ((int, GDB_FILE
*, const char *, ...))
397 ATTR_FORMAT(printf
, 3, 4);
399 extern void printf_filtered
PARAMS ((const char *, ...))
400 ATTR_FORMAT(printf
, 1, 2);
402 extern void printfi_filtered
PARAMS ((int, const char *, ...))
403 ATTR_FORMAT(printf
, 2, 3);
405 extern void vprintf_unfiltered
PARAMS ((const char *, va_list))
406 ATTR_FORMAT(printf
, 1, 0);
408 extern void vfprintf_unfiltered
PARAMS ((GDB_FILE
*, const char *, va_list))
409 ATTR_FORMAT(printf
, 2, 0);
411 extern void fprintf_unfiltered
PARAMS ((GDB_FILE
*, const char *, ...))
412 ATTR_FORMAT(printf
, 2, 3);
414 extern void printf_unfiltered
PARAMS ((const char *, ...))
415 ATTR_FORMAT(printf
, 1, 2);
417 extern int gdb_file_isatty
PARAMS ((GDB_FILE
*));
419 extern GDB_FILE
*gdb_file_init_astring
PARAMS ((int));
421 extern void gdb_file_deallocate
PARAMS ((GDB_FILE
**));
423 extern char *gdb_file_get_strbuf
PARAMS ((GDB_FILE
*));
425 extern void gdb_file_adjust_strbuf
PARAMS ((int, GDB_FILE
*));
427 extern void print_spaces
PARAMS ((int, GDB_FILE
*));
429 extern void print_spaces_filtered
PARAMS ((int, GDB_FILE
*));
431 extern char *n_spaces
PARAMS ((int));
433 extern void gdb_printchar
PARAMS ((int, GDB_FILE
*, int));
435 extern void gdb_print_address
PARAMS ((void *, GDB_FILE
*));
437 typedef bfd_vma t_addr
;
438 typedef bfd_vma t_reg
;
439 extern char* paddr
PARAMS ((t_addr addr
));
441 extern char* preg
PARAMS ((t_reg reg
));
443 extern char* paddr_nz
PARAMS ((t_addr addr
));
445 extern char* preg_nz
PARAMS ((t_reg reg
));
447 extern void fprintf_symbol_filtered
PARAMS ((GDB_FILE
*, char *,
448 enum language
, int));
450 extern NORETURN
void perror_with_name
PARAMS ((char *)) ATTR_NORETURN
;
452 extern void print_sys_errmsg
PARAMS ((char *, int));
454 /* From regex.c or libc. BSD 4.4 declares this with the argument type as
455 "const char *" in unistd.h, so we can't declare the argument
458 extern char *re_comp
PARAMS ((const char *));
462 extern void symbol_file_command
PARAMS ((char *, int));
466 extern char *skip_quoted
PARAMS ((char *));
468 extern char *gdb_readline
PARAMS ((char *));
470 extern char *command_line_input
PARAMS ((char *, int, char *));
472 extern void print_prompt
PARAMS ((void));
474 extern int input_from_terminal_p
PARAMS ((void));
476 extern int info_verbose
;
478 /* From printcmd.c */
480 extern void set_next_address
PARAMS ((CORE_ADDR
));
482 extern void print_address_symbolic
PARAMS ((CORE_ADDR
, GDB_FILE
*, int,
485 extern void print_address_numeric
PARAMS ((CORE_ADDR
, int, GDB_FILE
*));
487 extern void print_address
PARAMS ((CORE_ADDR
, GDB_FILE
*));
491 extern int openp
PARAMS ((char *, int, char *, int, int, char **));
493 extern int source_full_path_of
PARAMS ((char *, char **));
495 extern void mod_path
PARAMS ((char *, char **));
497 extern void directory_command
PARAMS ((char *, int));
499 extern void init_source_path
PARAMS ((void));
501 extern char *symtab_to_filename
PARAMS ((struct symtab
*));
505 extern int read_relative_register_raw_bytes
PARAMS ((int, char *));
507 /* From readline (but not in any readline .h files). */
509 extern char *tilde_expand
PARAMS ((char *));
511 /* Control types for commands */
513 enum misc_command_type
521 enum command_control_type
531 /* Structure for saved commands lines
532 (for breakpoints, defined commands, etc). */
536 struct command_line
*next
;
538 enum command_control_type control_type
;
540 struct command_line
**body_list
;
543 extern struct command_line
*read_command_lines
PARAMS ((char *, int));
545 extern void free_command_lines
PARAMS ((struct command_line
**));
547 /* String containing the current directory (what getwd would return). */
549 extern char *current_directory
;
551 /* Default radixes for input and output. Only some values supported. */
552 extern unsigned input_radix
;
553 extern unsigned output_radix
;
555 /* Possibilities for prettyprint parameters to routines which print
556 things. Like enum language, this should be in value.h, but needs
557 to be here for the same reason. FIXME: If we can eliminate this
558 as an arg to LA_VAL_PRINT, then we can probably move it back to
563 Val_no_prettyprint
= 0,
565 /* Use the default setting which the user has specified. */
570 /* Host machine definition. This will be a symlink to one of the
571 xm-*.h files, built by the `configure' script. */
575 /* Native machine support. This will be a symlink to one of the
576 nm-*.h files, built by the `configure' script. */
580 /* Target machine definition. This will be a symlink to one of the
581 tm-*.h files, built by the `configure' script. */
585 /* If the xm.h file did not define the mode string used to open the
586 files, assume that binary files are opened the same way as text
589 #include "fopen-same.h"
592 /* Microsoft C can't deal with const pointers */
597 #define CONST_PTR const
601 * Allow things in gdb to be declared "volatile". If compiling ANSI, it
602 * just works. If compiling with gcc but non-ansi, redefine to __volatile__.
603 * If non-ansi, non-gcc, then eliminate "volatile" entirely, making those
604 * objects be read-write rather than read-only.
610 # define volatile __volatile__
612 # define volatile /*nothing*/
615 #endif /* volatile */
617 /* Defaults for system-wide constants (if not defined by xm.h, we fake it).
618 FIXME: Assumes 2's complement arithmetic */
620 #if !defined (UINT_MAX)
621 #define UINT_MAX ((unsigned int)(~0)) /* 0xFFFFFFFF for 32-bits */
624 #if !defined (INT_MAX)
625 #define INT_MAX ((int)(UINT_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */
628 #if !defined (INT_MIN)
629 #define INT_MIN ((int)((int) ~0 ^ INT_MAX)) /* 0x80000000 for 32-bits */
632 #if !defined (ULONG_MAX)
633 #define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF for 32-bits */
636 #if !defined (LONG_MAX)
637 #define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */
644 /* This is to make sure that LONGEST is at least as big as CORE_ADDR. */
646 #define LONGEST BFD_HOST_64_BIT
647 #define ULONGEST BFD_HOST_U_64_BIT
651 # ifdef CC_HAS_LONG_LONG
652 # define LONGEST long long
653 # define ULONGEST unsigned long long
655 /* BFD_HOST_64_BIT is defined for some hosts that don't have long long
656 (e.g. i386-windows) so try it. */
657 # ifdef BFD_HOST_64_BIT
658 # define LONGEST BFD_HOST_64_BIT
659 # define ULONGEST BFD_HOST_U_64_BIT
661 # define LONGEST long
662 # define ULONGEST unsigned long
666 #endif /* No BFD64 */
668 #endif /* ! LONGEST */
670 /* Convert a LONGEST to an int. This is used in contexts (e.g. number of
671 arguments to a function, number in a value history, register number, etc.)
672 where the value must not be larger than can fit in an int. */
674 extern int longest_to_int
PARAMS ((LONGEST
));
676 /* Assorted functions we can declare, now that const and volatile are
679 extern char *savestring
PARAMS ((const char *, int));
681 extern char *msavestring
PARAMS ((void *, const char *, int));
683 extern char *strsave
PARAMS ((const char *));
685 extern char *mstrsave
PARAMS ((void *, const char *));
687 #ifdef _MSC_VER /* FIXME; was long, but this causes compile errors in msvc if already defined */
688 extern PTR xmmalloc
PARAMS ((PTR
, size_t));
690 extern PTR xmrealloc
PARAMS ((PTR
, PTR
, size_t));
692 extern PTR xmmalloc
PARAMS ((PTR
, long));
694 extern PTR xmrealloc
PARAMS ((PTR
, PTR
, long));
697 extern int parse_escape
PARAMS ((char **));
699 /* compat - handle old targets that just define REGISTER_NAMES */
700 #ifndef REGISTER_NAME
701 extern char *gdb_register_names
[];
702 #define REGISTER_NAME(i) gdb_register_names[i]
705 /* Message to be printed before the error message, when an error occurs. */
707 extern char *error_pre_print
;
709 /* Message to be printed before the error message, when an error occurs. */
711 extern char *quit_pre_print
;
713 /* Message to be printed before the warning message, when a warning occurs. */
715 extern char *warning_pre_print
;
717 extern NORETURN
void error
PARAMS((const char *, ...)) ATTR_NORETURN
;
719 extern void error_begin
PARAMS ((void));
721 extern NORETURN
void fatal
PARAMS((char *, ...)) ATTR_NORETURN
;
723 extern NORETURN
void nomem
PARAMS ((long)) ATTR_NORETURN
;
725 /* Reasons for calling return_to_top_level. */
727 /* User interrupt. */
730 /* Any other error. */
734 #define RETURN_MASK_QUIT (1 << (int)RETURN_QUIT)
735 #define RETURN_MASK_ERROR (1 << (int)RETURN_ERROR)
736 #define RETURN_MASK_ALL (RETURN_MASK_QUIT | RETURN_MASK_ERROR)
737 typedef int return_mask
;
740 return_to_top_level
PARAMS ((enum return_reason
)) ATTR_NORETURN
;
743 catch_errors
PARAMS ((int (*) (char *), void *, char *, return_mask
));
745 extern void warning_begin
PARAMS ((void));
747 extern void warning
PARAMS ((const char *, ...))
748 ATTR_FORMAT(printf
, 1, 2);
750 /* Global functions from other, non-gdb GNU thingies.
751 Libiberty thingies are no longer declared here. We include libiberty.h
754 #ifndef GETENV_PROVIDED
755 extern char *getenv
PARAMS ((const char *));
758 /* From other system libraries */
765 #if defined(_MSC_VER) && !defined(__cplusplus)
766 /* msvc defines these in stdlib.h for c code */
773 #define min(a, b) ((a) < (b) ? (a) : (b))
776 #define max(a, b) ((a) > (b) ? (a) : (b))
780 /* We take the address of fclose later, but some stdio's forget
781 to declare this. We can't always declare it since there's
782 no way to declare the parameters without upsetting some compiler
785 #ifndef FCLOSE_PROVIDED
786 extern int fclose
PARAMS ((FILE *));
790 extern double atof
PARAMS ((const char *)); /* X3.159-1989 4.10.1.1 */
793 #ifndef MALLOC_INCOMPATIBLE
795 #ifdef NEED_DECLARATION_MALLOC
796 extern PTR
malloc ();
799 #ifdef NEED_DECLARATION_REALLOC
800 extern PTR
realloc ();
803 #ifdef NEED_DECLARATION_FREE
807 #endif /* MALLOC_INCOMPATIBLE */
809 /* Various possibilities for alloca. */
812 # define alloca __builtin_alloca
813 # else /* Not GNU C */
814 # ifdef HAVE_ALLOCA_H
821 /* We need to be careful not to declare this in a way which conflicts with
822 bison. Bison never declares it as char *, but under various circumstances
823 (like __hpux) we need to use void *. */
824 # if defined (__STDC__) || defined (__hpux)
825 extern void *alloca ();
826 # else /* Don't use void *. */
827 extern char *alloca ();
828 # endif /* Don't use void *. */
829 # endif /* Not _AIX */
830 # endif /* Not HAVE_ALLOCA_H */
831 # endif /* Not GNU C */
832 #endif /* alloca not defined */
834 /* HOST_BYTE_ORDER must be defined to one of these. */
840 #if !defined (BIG_ENDIAN)
841 #define BIG_ENDIAN 4321
844 #if !defined (LITTLE_ENDIAN)
845 #define LITTLE_ENDIAN 1234
848 /* Dynamic target-system-dependent parameters for GDB. */
851 /* Static target-system-dependent parameters for GDB. */
853 /* Number of bits in a char or unsigned char for the target machine.
854 Just like CHAR_BIT in <limits.h> but describes the target machine. */
855 #if !defined (TARGET_CHAR_BIT)
856 #define TARGET_CHAR_BIT 8
859 /* Number of bits in a short or unsigned short for the target machine. */
860 #if !defined (TARGET_SHORT_BIT)
861 #define TARGET_SHORT_BIT (2 * TARGET_CHAR_BIT)
864 /* Number of bits in an int or unsigned int for the target machine. */
865 #if !defined (TARGET_INT_BIT)
866 #define TARGET_INT_BIT (4 * TARGET_CHAR_BIT)
869 /* Number of bits in a long or unsigned long for the target machine. */
870 #if !defined (TARGET_LONG_BIT)
871 #define TARGET_LONG_BIT (4 * TARGET_CHAR_BIT)
874 /* Number of bits in a long long or unsigned long long for the target machine. */
875 #if !defined (TARGET_LONG_LONG_BIT)
876 #define TARGET_LONG_LONG_BIT (2 * TARGET_LONG_BIT)
879 /* Number of bits in a float for the target machine. */
880 #if !defined (TARGET_FLOAT_BIT)
881 #define TARGET_FLOAT_BIT (4 * TARGET_CHAR_BIT)
884 /* Number of bits in a double for the target machine. */
885 #if !defined (TARGET_DOUBLE_BIT)
886 #define TARGET_DOUBLE_BIT (8 * TARGET_CHAR_BIT)
889 /* Number of bits in a long double for the target machine. */
890 #if !defined (TARGET_LONG_DOUBLE_BIT)
891 #define TARGET_LONG_DOUBLE_BIT (2 * TARGET_DOUBLE_BIT)
894 /* Number of bits in a pointer for the target machine */
895 #if !defined (TARGET_PTR_BIT)
896 #define TARGET_PTR_BIT TARGET_INT_BIT
899 /* If we picked up a copy of CHAR_BIT from a configuration file
900 (which may get it by including <limits.h>) then use it to set
901 the number of bits in a host char. If not, use the same size
904 #if defined (CHAR_BIT)
905 #define HOST_CHAR_BIT CHAR_BIT
907 #define HOST_CHAR_BIT TARGET_CHAR_BIT
910 /* The bit byte-order has to do just with numbering of bits in
911 debugging symbols and such. Conceptually, it's quite separate
912 from byte/word byte order. */
914 #if !defined (BITS_BIG_ENDIAN)
915 #define BITS_BIG_ENDIAN (TARGET_BYTE_ORDER == BIG_ENDIAN)
920 extern LONGEST extract_signed_integer
PARAMS ((void *, int));
922 extern ULONGEST extract_unsigned_integer
PARAMS ((void *, int));
924 extern int extract_long_unsigned_integer
PARAMS ((void *, int, LONGEST
*));
926 extern CORE_ADDR extract_address
PARAMS ((void *, int));
928 extern void store_signed_integer
PARAMS ((PTR
, int, LONGEST
));
930 extern void store_unsigned_integer
PARAMS ((PTR
, int, ULONGEST
));
932 extern void store_address
PARAMS ((PTR
, int, LONGEST
));
934 /* Setup definitions for host and target floating point formats. We need to
935 consider the format for `float', `double', and `long double' for both target
936 and host. We need to do this so that we know what kind of conversions need
937 to be done when converting target numbers to and from the hosts DOUBLEST
940 /* This is used to indicate that we don't know the format of the floating point
941 number. Typically, this is useful for native ports, where the actual format
942 is irrelevant, since no conversions will be taking place. */
944 extern const struct floatformat floatformat_unknown
;
946 #if HOST_BYTE_ORDER == BIG_ENDIAN
947 # ifndef HOST_FLOAT_FORMAT
948 # define HOST_FLOAT_FORMAT &floatformat_ieee_single_big
950 # ifndef HOST_DOUBLE_FORMAT
951 # define HOST_DOUBLE_FORMAT &floatformat_ieee_double_big
953 #else /* LITTLE_ENDIAN */
954 # ifndef HOST_FLOAT_FORMAT
955 # define HOST_FLOAT_FORMAT &floatformat_ieee_single_little
957 # ifndef HOST_DOUBLE_FORMAT
958 # define HOST_DOUBLE_FORMAT &floatformat_ieee_double_little
962 #ifndef HOST_LONG_DOUBLE_FORMAT
963 #define HOST_LONG_DOUBLE_FORMAT &floatformat_unknown
966 #ifndef TARGET_FLOAT_FORMAT
967 #define TARGET_FLOAT_FORMAT (TARGET_BYTE_ORDER == BIG_ENDIAN \
968 ? &floatformat_ieee_single_big \
969 : &floatformat_ieee_single_little)
971 #ifndef TARGET_DOUBLE_FORMAT
972 #define TARGET_DOUBLE_FORMAT (TARGET_BYTE_ORDER == BIG_ENDIAN \
973 ? &floatformat_ieee_double_big \
974 : &floatformat_ieee_double_little)
977 #ifndef TARGET_LONG_DOUBLE_FORMAT
978 # define TARGET_LONG_DOUBLE_FORMAT &floatformat_unknown
981 /* Use `long double' if the host compiler supports it. (Note that this is not
982 necessarily any longer than `double'. On SunOS/gcc, it's the same as
983 double.) This is necessary because GDB internally converts all floating
984 point values to the widest type supported by the host.
986 There are problems however, when the target `long double' is longer than the
987 host's `long double'. In general, we'll probably reduce the precision of
988 any such values and print a warning. */
990 #ifdef HAVE_LONG_DOUBLE
991 typedef long double DOUBLEST
;
993 typedef double DOUBLEST
;
996 extern void floatformat_to_doublest
PARAMS ((const struct floatformat
*,
997 char *, DOUBLEST
*));
998 extern void floatformat_from_doublest
PARAMS ((const struct floatformat
*,
999 DOUBLEST
*, char *));
1000 extern DOUBLEST extract_floating
PARAMS ((void *, int));
1002 extern void store_floating
PARAMS ((void *, int, DOUBLEST
));
1004 /* On some machines there are bits in addresses which are not really
1005 part of the address, but are used by the kernel, the hardware, etc.
1006 for special purposes. ADDR_BITS_REMOVE takes out any such bits
1007 so we get a "real" address such as one would find in a symbol
1008 table. This is used only for addresses of instructions, and even then
1009 I'm not sure it's used in all contexts. It exists to deal with there
1010 being a few stray bits in the PC which would mislead us, not as some sort
1011 of generic thing to handle alignment or segmentation (it's possible it
1012 should be in TARGET_READ_PC instead). */
1013 #if !defined (ADDR_BITS_REMOVE)
1014 #define ADDR_BITS_REMOVE(addr) (addr)
1015 #endif /* No ADDR_BITS_REMOVE. */
1019 extern CORE_ADDR push_bytes
PARAMS ((CORE_ADDR
, char *, int));
1021 extern CORE_ADDR push_word
PARAMS ((CORE_ADDR
, ULONGEST
));
1023 /* Some parts of gdb might be considered optional, in the sense that they
1024 are not essential for being able to build a working, usable debugger
1025 for a specific environment. For example, the maintenance commands
1026 are there for the benefit of gdb maintainers. As another example,
1027 some environments really don't need gdb's that are able to read N
1028 different object file formats. In order to make it possible (but
1029 not necessarily recommended) to build "stripped down" versions of
1030 gdb, the following defines control selective compilation of those
1031 parts of gdb which can be safely left out when necessary. Note that
1032 the default is to include everything. */
1034 #ifndef MAINTENANCE_CMDS
1035 #define MAINTENANCE_CMDS 1
1038 #ifdef MAINTENANCE_CMDS
1039 extern int watchdog
;
1042 /* Hooks for alternate command interfaces. */
1045 struct target_waitstatus
;
1046 struct cmd_list_element
;
1049 extern void (*init_ui_hook
) PARAMS ((char *argv0
));
1050 extern void (*command_loop_hook
) PARAMS ((void));
1051 extern void (*fputs_unfiltered_hook
) PARAMS ((const char *linebuffer
,
1053 extern void (*print_frame_info_listing_hook
) PARAMS ((struct symtab
*s
,
1054 int line
, int stopline
,
1056 extern struct frame_info
*parse_frame_specification
PARAMS ((char *frame_exp
));
1057 extern int (*query_hook
) PARAMS ((const char *, va_list));
1058 extern void (*warning_hook
) PARAMS ((const char *, va_list));
1059 extern void (*flush_hook
) PARAMS ((GDB_FILE
*stream
));
1060 extern void (*create_breakpoint_hook
) PARAMS ((struct breakpoint
*b
));
1061 extern void (*delete_breakpoint_hook
) PARAMS ((struct breakpoint
*bpt
));
1062 extern void (*modify_breakpoint_hook
) PARAMS ((struct breakpoint
*bpt
));
1063 extern void (*target_output_hook
) PARAMS ((char *));
1064 extern void (*interactive_hook
) PARAMS ((void));
1065 extern void (*registers_changed_hook
) PARAMS ((void));
1066 extern void (*readline_begin_hook
) PARAMS ((char *, ...));
1067 extern char * (*readline_hook
) PARAMS ((char *));
1068 extern void (*readline_end_hook
) PARAMS ((void));
1069 extern void (*pc_changed_hook
) PARAMS ((void));
1070 extern void (*context_hook
) PARAMS ((int));
1071 extern int (*target_wait_hook
) PARAMS ((int pid
,
1072 struct target_waitstatus
*status
));
1074 extern void (*call_command_hook
) PARAMS ((struct cmd_list_element
*c
,
1075 char *cmd
, int from_tty
));
1077 extern NORETURN
void (*error_hook
) PARAMS ((void)) ATTR_NORETURN
;
1081 /* Inhibit window interface if non-zero. */
1083 extern int use_windows
;
1085 /* Symbolic definitions of filename-related things. */
1086 /* FIXME, this doesn't work very well if host and executable
1087 filesystems conventions are different. */
1089 #ifndef DIRNAME_SEPARATOR
1090 #define DIRNAME_SEPARATOR ':'
1094 #if defined(__GO32__)||defined(_WIN32)
1095 #define SLASH_P(X) ((X)=='\\')
1097 #define SLASH_P(X) ((X)=='/')
1102 #if defined(__GO32__)||defined(_WIN32)
1103 #define SLASH_CHAR '\\'
1105 #define SLASH_CHAR '/'
1109 #ifndef SLASH_STRING
1110 #if defined(__GO32__)||defined(_WIN32)
1111 #define SLASH_STRING "\\"
1113 #define SLASH_STRING "/"
1118 #define ROOTED_P(X) (SLASH_P((X)[0]))
1121 /* On some systems, PIDGET is defined to extract the inferior pid from
1122 an internal pid that has the thread id and pid in seperate bit
1123 fields. If not defined, then just use the entire internal pid as
1127 #define PIDGET(pid) (pid)
1130 /* If under Cygwin, provide backwards compatibility with older
1131 Cygwin compilers that don't define the current cpp define. */
1138 #endif /* #ifndef DEFS_H */