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