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