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