* mips-tdep.c, remote-mips.c, values.c, mdebugread.c,
[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 69
28444bf3 70#ifndef min
bd5635a1 71#define min(a, b) ((a) < (b) ? (a) : (b))
28444bf3
DP
72#endif
73#ifndef max
bd5635a1 74#define max(a, b) ((a) > (b) ? (a) : (b))
28444bf3 75#endif
bd5635a1 76
2e4964ad
FF
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
bd5d07d9 80#define STRCMP(a,b) (*(a) == *(b) ? strcmp ((a), (b)) : (int)*(a) - (int)*(b))
2e4964ad
FF
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
dd577ca5 84/* The character GNU C++ uses to build identifiers that must be unique from
bd5635a1
RP
85 the program's identifiers (such as $this and $$vptr). */
86#define CPLUS_MARKER '$' /* May be overridden to '.' for SysV */
87
81afee37
FF
88/* Check if a character is one of the commonly used C++ marker characters. */
89extern int is_cplus_marker PARAMS ((int));
bd5635a1
RP
90
91extern int quit_flag;
92extern int immediate_quit;
51b80b00 93extern int sevenbit_strings;
d747e0af 94
6f54efdc 95extern void quit PARAMS ((void));
bd5635a1 96
28444bf3
DP
97#ifdef QUIT
98/* do twice to force compiler warning */
99#define FIXME "FIXME"
100#define FIXME "ignoring redefinition of QUIT"
101#else
c023fbf4
KH
102#define QUIT { \
103 if (quit_flag) quit (); \
104 if (interactive_hook) interactive_hook (); \
105 PROGRESS (1); \
106}
28444bf3 107#endif
bd5635a1 108
e58de8a2
FF
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"). */
bd5635a1
RP
114
115enum 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,
e58de8a2
FF
122 class_alias, class_obscure, class_user, class_maintenance,
123 class_pseudo
bd5635a1
RP
124};
125
bd5d07d9
FF
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
131enum language
132{
133 language_unknown, /* Language not known */
134 language_auto, /* Placeholder for automatic setting */
135 language_c, /* C */
136 language_cplus, /* C++ */
bd5d07d9 137 language_chill, /* Chill */
e52bfe0c 138 language_fortran, /* Fortran */
754e5da2 139 language_m2, /* Modula-2 */
0e4ca328
PB
140 language_asm, /* Assembly language */
141 language_scm /* Scheme / Guile */
bd5d07d9
FF
142};
143
bd5635a1
RP
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
154struct cleanup
155{
156 struct cleanup *next;
d747e0af
MT
157 void (*function) PARAMS ((PTR));
158 PTR arg;
bd5635a1
RP
159};
160
413cba82
JL
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__) \
b6d70e15 171 && (__GNUC__ == 1 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7))
413cba82
JL
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",
b6d70e15
SC
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. */
413cba82
JL
182
183#ifndef ATTR_NORETURN
b6d70e15 184# if defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 7
413cba82
JL
185# define ATTR_NORETURN __attribute__ ((noreturn))
186# else
187# define ATTR_NORETURN /* nothing */
188# endif
189#endif
190
191#ifndef ATTR_FORMAT
b6d70e15 192# if defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 4 && defined (__ANSI_PROTOTYPES)
413cba82
JL
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
637b1661
SG
199/* Needed for various prototypes */
200
201#ifdef __STDC__
202struct symtab;
203struct breakpoint;
204#endif
205
d747e0af
MT
206/* From blockframe.c */
207
6f54efdc 208extern int inside_entry_func PARAMS ((CORE_ADDR));
d747e0af 209
6f54efdc 210extern int inside_entry_file PARAMS ((CORE_ADDR addr));
d747e0af 211
6f54efdc 212extern int inside_main_func PARAMS ((CORE_ADDR pc));
d747e0af 213
7532cf10
FF
214/* From ch-lang.c, for the moment. (FIXME) */
215
6f54efdc 216extern char *chill_demangle PARAMS ((const char *));
7532cf10 217
d747e0af
MT
218/* From utils.c */
219
b607efe7
FF
220extern void notice_quit PARAMS ((void));
221
6f54efdc 222extern int strcmp_iw PARAMS ((const char *, const char *));
d630b615 223
6f54efdc 224extern char *safe_strerror PARAMS ((int));
e146177e 225
6f54efdc 226extern char *safe_strsignal PARAMS ((int));
e146177e 227
6f54efdc 228extern void init_malloc PARAMS ((void *));
d747e0af 229
6f54efdc 230extern void request_quit PARAMS ((int));
d747e0af 231
6f54efdc 232extern void do_cleanups PARAMS ((struct cleanup *));
d747e0af 233
6f54efdc 234extern void discard_cleanups PARAMS ((struct cleanup *));
d747e0af
MT
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:
241extern struct cleanup *
84d59861 242make_cleanup PARAMS ((void (*function) (void *), void *));
d747e0af
MT
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
6f54efdc 249extern struct cleanup *make_cleanup ();
d747e0af 250
6f54efdc 251extern struct cleanup *save_cleanups PARAMS ((void));
d747e0af 252
6f54efdc 253extern void restore_cleanups PARAMS ((struct cleanup *));
d747e0af 254
6f54efdc 255extern void free_current_contents PARAMS ((char **));
d747e0af 256
b607efe7 257extern void null_cleanup PARAMS ((PTR));
d747e0af 258
6f54efdc 259extern int myread PARAMS ((int, char *, int));
d747e0af 260
413cba82
JL
261extern int query PARAMS((char *, ...))
262 ATTR_FORMAT(printf, 1, 2);
b607efe7
FF
263
264/* From demangle.c */
265
266extern void set_demangling_style PARAMS ((char *));
267
6c803036 268\f
96f7edbd
JK
269/* Annotation stuff. */
270
6c803036
JK
271extern int annotation_level; /* in stack.c */
272\f
6f54efdc 273extern void begin_line PARAMS ((void));
51b80b00 274
6f54efdc 275extern void wrap_here PARAMS ((char *));
d747e0af 276
6f54efdc 277extern void reinitialize_more_filter PARAMS ((void));
d747e0af 278
04f566a3
JK
279typedef FILE GDB_FILE;
280#define gdb_stdout stdout
281#define gdb_stderr stderr
282
6f54efdc 283extern void gdb_flush PARAMS ((GDB_FILE *));
04f566a3 284
6f54efdc 285extern GDB_FILE *gdb_fopen PARAMS ((char * name, char * mode));
04f566a3 286
6f54efdc 287extern void fputs_filtered PARAMS ((const char *, GDB_FILE *));
04f566a3 288
6f54efdc 289extern void fputs_unfiltered PARAMS ((const char *, GDB_FILE *));
d747e0af 290
8989d4fc 291extern int fputc_unfiltered PARAMS ((int c, GDB_FILE *));
04f566a3 292
8989d4fc 293extern int putchar_unfiltered PARAMS ((int c));
d747e0af 294
81afee37 295extern void puts_filtered PARAMS ((const char *));
d747e0af 296
81afee37 297extern void puts_unfiltered PARAMS ((const char *));
04f566a3 298
81afee37 299extern void vprintf_filtered PARAMS ((const char *, va_list))
413cba82 300 ATTR_FORMAT(printf, 1, 0);
51b80b00 301
81afee37 302extern void vfprintf_filtered PARAMS ((FILE *, const char *, va_list))
413cba82 303 ATTR_FORMAT(printf, 2, 0);
a8e033f2 304
81afee37 305extern void fprintf_filtered PARAMS ((FILE *, const char *, ...))
413cba82 306 ATTR_FORMAT(printf, 2, 3);
d747e0af 307
81afee37 308extern void fprintfi_filtered PARAMS ((int, FILE *, const char *, ...))
413cba82 309 ATTR_FORMAT(printf, 3, 4);
a8e033f2 310
81afee37 311extern void printf_filtered PARAMS ((const char *, ...))
413cba82 312 ATTR_FORMAT(printf, 1, 2);
d747e0af 313
81afee37 314extern void printfi_filtered PARAMS ((int, const char *, ...))
413cba82 315 ATTR_FORMAT(printf, 2, 3);
a8e033f2 316
81afee37 317extern void vprintf_unfiltered PARAMS ((const char *, va_list))
413cba82 318 ATTR_FORMAT(printf, 1, 0);
04f566a3 319
81afee37 320extern void vfprintf_unfiltered PARAMS ((FILE *, const char *, va_list))
413cba82 321 ATTR_FORMAT(printf, 2, 0);
04f566a3 322
81afee37 323extern void fprintf_unfiltered PARAMS ((FILE *, const char *, ...))
413cba82 324 ATTR_FORMAT(printf, 2, 3);
d747e0af 325
81afee37 326extern void printf_unfiltered PARAMS ((const char *, ...))
413cba82 327 ATTR_FORMAT(printf, 1, 2);
04f566a3 328
6f54efdc 329extern void print_spaces PARAMS ((int, GDB_FILE *));
04f566a3 330
6f54efdc 331extern void print_spaces_filtered PARAMS ((int, GDB_FILE *));
d747e0af 332
6f54efdc 333extern char *n_spaces PARAMS ((int));
d747e0af 334
6f54efdc 335extern void gdb_printchar PARAMS ((int, GDB_FILE *, int));
d747e0af 336
833e0d94
JK
337extern void gdb_print_address PARAMS ((void *, GDB_FILE *));
338
28444bf3
DP
339typedef bfd_vma t_addr;
340typedef bfd_vma t_reg;
341extern char* paddr PARAMS ((t_addr addr));
342
343extern char* preg PARAMS ((t_reg reg));
344
6f54efdc
SS
345extern void fprintf_symbol_filtered PARAMS ((GDB_FILE *, char *,
346 enum language, int));
d747e0af 347
6f54efdc 348extern void perror_with_name PARAMS ((char *));
d747e0af 349
6f54efdc 350extern void print_sys_errmsg PARAMS ((char *, int));
d747e0af 351
1bef45ea
JK
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 *". */
d747e0af 355
6f54efdc 356extern char *re_comp PARAMS ((const char *));
d747e0af
MT
357
358/* From symfile.c */
359
6f54efdc 360extern void symbol_file_command PARAMS ((char *, int));
d747e0af 361
eba08643 362/* From top.c */
d747e0af 363
6f54efdc 364extern char *skip_quoted PARAMS ((char *));
d630b615 365
6f54efdc 366extern char *gdb_readline PARAMS ((char *));
d747e0af 367
6f54efdc 368extern char *command_line_input PARAMS ((char *, int, char *));
d747e0af 369
6f54efdc 370extern void print_prompt PARAMS ((void));
d747e0af 371
6f54efdc 372extern int input_from_terminal_p PARAMS ((void));
d747e0af 373
eba08643
C
374extern int info_verbose;
375
bd5635a1 376/* From printcmd.c */
d747e0af 377
6f54efdc 378extern void set_next_address PARAMS ((CORE_ADDR));
d747e0af 379
6f54efdc
SS
380extern void print_address_symbolic PARAMS ((CORE_ADDR, GDB_FILE *, int,
381 char *));
d747e0af 382
6f54efdc 383extern void print_address_numeric PARAMS ((CORE_ADDR, int, GDB_FILE *));
833e0d94 384
6f54efdc 385extern void print_address PARAMS ((CORE_ADDR, GDB_FILE *));
bd5635a1 386
e1ce8aa5 387/* From source.c */
d747e0af 388
6f54efdc 389extern int openp PARAMS ((char *, int, char *, int, int, char **));
d747e0af 390
6f54efdc 391extern void mod_path PARAMS ((char *, char **));
d747e0af 392
6f54efdc 393extern void directory_command PARAMS ((char *, int));
d747e0af 394
6f54efdc 395extern void init_source_path PARAMS ((void));
d747e0af 396
637b1661
SG
397extern char *symtab_to_filename PARAMS ((struct symtab *));
398
d747e0af
MT
399/* From findvar.c */
400
6f54efdc 401extern int read_relative_register_raw_bytes PARAMS ((int, char *));
e1ce8aa5 402
bd5635a1 403/* From readline (but not in any readline .h files). */
d747e0af 404
6f54efdc 405extern char *tilde_expand PARAMS ((char *));
bd5635a1 406
78751d4f
PS
407/* Control types for commands */
408
409enum misc_command_type
410{
411 ok_command,
412 end_command,
413 else_command,
414 nop_command
415};
416
417enum command_control_type
418{
419 simple_control,
420 break_control,
421 continue_control,
422 while_control,
423 if_control,
424 invalid_control
425};
426
bd5635a1
RP
427/* Structure for saved commands lines
428 (for breakpoints, defined commands, etc). */
429
430struct command_line
431{
432 struct command_line *next;
433 char *line;
78751d4f
PS
434 enum command_control_type control_type;
435 int body_count;
436 struct command_line **body_list;
bd5635a1
RP
437};
438
91550191 439extern struct command_line *read_command_lines PARAMS ((char *, int));
d747e0af 440
6f54efdc 441extern void free_command_lines PARAMS ((struct command_line **));
bd5635a1
RP
442
443/* String containing the current directory (what getwd would return). */
444
d747e0af 445extern char *current_directory;
bd5635a1
RP
446
447/* Default radixes for input and output. Only some values supported. */
448extern unsigned input_radix;
449extern unsigned output_radix;
450
a8a69e63
FF
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
457enum 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
0a5d35ed
SG
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
e58de8a2
FF
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
c023fbf4
KH
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
e146177e
SEF
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
b51843d8
FF
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
0a5d35ed 496/*
b51843d8
FF
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
0a5d35ed
SG
500 * objects be read-write rather than read-only.
501 */
502
0a5d35ed
SG
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
3f550b59
FF
513/* Defaults for system-wide constants (if not defined by xm.h, we fake it).
514 FIXME: Assumes 2's complement arithmetic */
0a5d35ed 515
bd5635a1 516#if !defined (UINT_MAX)
38dc5e12 517#define UINT_MAX ((unsigned int)(~0)) /* 0xFFFFFFFF for 32-bits */
bd5635a1
RP
518#endif
519
e1ce8aa5 520#if !defined (INT_MAX)
dd577ca5 521#define INT_MAX ((int)(UINT_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */
e1ce8aa5
JK
522#endif
523
524#if !defined (INT_MIN)
3f550b59 525#define INT_MIN ((int)((int) ~0 ^ INT_MAX)) /* 0x80000000 for 32-bits */
38dc5e12
SG
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 */
e1ce8aa5
JK
534#endif
535
7343d716
JK
536#ifdef BFD64
537
538/* This is to make sure that LONGEST is at least as big as CORE_ADDR. */
539
70126bf9 540#define LONGEST BFD_HOST_64_BIT
7343d716
JK
541
542#else /* No BFD64 */
543
7efb57c3 544/* LONGEST should not be a typedef, because "unsigned LONGEST" needs to work.
3f550b59 545 CC_HAS_LONG_LONG is defined if the host compiler supports "long long" */
d747e0af
MT
546
547#ifndef LONGEST
7efb57c3
FF
548# ifdef CC_HAS_LONG_LONG
549# define LONGEST long long
550# else
551# define LONGEST long
552# endif
553#endif
554
7343d716
JK
555#endif /* No BFD64 */
556
7efb57c3
FF
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
fb0f4231 561extern int longest_to_int PARAMS ((LONGEST));
d747e0af 562
0a5d35ed
SG
563/* Assorted functions we can declare, now that const and volatile are
564 defined. */
d747e0af 565
6f54efdc 566extern char *savestring PARAMS ((const char *, int));
d747e0af 567
6f54efdc 568extern char *msavestring PARAMS ((void *, const char *, int));
318bf84f 569
6f54efdc 570extern char *strsave PARAMS ((const char *));
d747e0af 571
6f54efdc 572extern char *mstrsave PARAMS ((void *, const char *));
318bf84f 573
28444bf3
DP
574#ifdef _WIN32 /* FIXME; was long, but this causes compile errors in msvc if already defined */
575extern PTR xmmalloc PARAMS ((PTR, size_t));
576
577extern PTR xmrealloc PARAMS ((PTR, PTR, size_t));
578#else
6f54efdc 579extern PTR xmmalloc PARAMS ((PTR, long));
318bf84f 580
6f54efdc 581extern PTR xmrealloc PARAMS ((PTR, PTR, long));
28444bf3 582#endif
318bf84f 583
6f54efdc 584extern int parse_escape PARAMS ((char **));
d747e0af 585
86db943c 586extern char *reg_names[];
d747e0af 587
833e0d94
JK
588/* Message to be printed before the error message, when an error occurs. */
589
590extern char *error_pre_print;
591
8989d4fc
JK
592/* Message to be printed before the error message, when an error occurs. */
593
594extern char *quit_pre_print;
595
833e0d94
JK
596/* Message to be printed before the warning message, when a warning occurs. */
597
598extern char *warning_pre_print;
599
85c613aa 600extern NORETURN void error PARAMS((char *, ...)) ATTR_NORETURN;
a0cf4681
JK
601
602extern void error_begin PARAMS ((void));
d747e0af 603
85c613aa 604extern NORETURN void fatal PARAMS((char *, ...)) ATTR_NORETURN;
d747e0af 605
6f54efdc 606extern NORETURN void nomem PARAMS ((long)) ATTR_NORETURN;
318bf84f 607
2fcdae93
PS
608/* Reasons for calling return_to_top_level. */
609enum 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)
620typedef int return_mask;
621
6f54efdc
SS
622extern NORETURN void
623return_to_top_level PARAMS ((enum return_reason)) ATTR_NORETURN;
2fcdae93 624
6f54efdc
SS
625extern int
626catch_errors PARAMS ((int (*) (char *), void *, char *, return_mask));
d747e0af 627
8989d4fc 628extern void warning_begin PARAMS ((void));
d747e0af 629
413cba82
JL
630extern void warning PARAMS ((char *, ...))
631 ATTR_FORMAT(printf, 1, 2);
d747e0af 632
97e7b66f
DE
633/* Global functions from other, non-gdb GNU thingies.
634 Libiberty thingies are no longer declared here. We include libiberty.h
635 above, instead. */
d747e0af 636
6b009ef6 637#ifndef GETENV_PROVIDED
6f54efdc 638extern char *getenv PARAMS ((const char *));
6b009ef6 639#endif
d747e0af 640
e146177e
SEF
641/* From other system libraries */
642
b51843d8 643#ifdef HAVE_STDDEF_H
d747e0af 644#include <stddef.h>
b51843d8
FF
645#endif
646
647#ifdef HAVE_STDLIB_H
28444bf3
DP
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
e3be225e 653#include <stdlib.h>
0a5d35ed 654#endif
28444bf3
DP
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
d747e0af 661
6b009ef6
SC
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
b607efe7 669extern int fclose PARAMS ((FILE *));
6b009ef6 670#endif
e146177e 671
8989d4fc 672#ifndef atof
b607efe7 673extern double atof PARAMS ((const char *)); /* X3.159-1989 4.10.1.1 */
8989d4fc 674#endif
51b57ded 675
d747e0af 676#ifndef MALLOC_INCOMPATIBLE
318bf84f 677
b51843d8 678#ifdef NEED_DECLARATION_MALLOC
e3be225e 679extern PTR malloc ();
b51843d8 680#endif
d747e0af 681
b51843d8 682#ifdef NEED_DECLARATION_REALLOC
e3be225e 683extern PTR realloc ();
b51843d8 684#endif
318bf84f 685
b51843d8 686#ifdef NEED_DECLARATION_FREE
e3be225e 687extern void free ();
b51843d8 688#endif
d747e0af 689
e3be225e 690#endif /* MALLOC_INCOMPATIBLE */
d747e0af 691
0a5d35ed
SG
692/* Various possibilities for alloca. */
693#ifndef alloca
694# ifdef __GNUC__
695# define alloca __builtin_alloca
7343d716 696# else /* Not GNU C */
0a5d35ed 697# ifdef sparc
22fd4704 698# include <alloca.h> /* NOTE: Doesn't declare alloca() */
e676a15f 699# endif
7343d716
JK
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 *. */
0f552c5f 707 extern char *alloca ();
7343d716
JK
708# endif /* Don't use void *. */
709# endif /* Not GNU C */
710#endif /* alloca not defined */
e2aab031 711
479f0f18 712/* HOST_BYTE_ORDER must be defined to one of these. */
a10c0d36 713
d8efbc66
FF
714#ifdef HAVE_ENDIAN_H
715#include <endian.h>
716#endif
717
0a5d35ed
SG
718#if !defined (BIG_ENDIAN)
719#define BIG_ENDIAN 4321
720#endif
a10c0d36 721
0a5d35ed
SG
722#if !defined (LITTLE_ENDIAN)
723#define LITTLE_ENDIAN 1234
724#endif
a10c0d36 725
2fcdae93 726/* Target-system-dependent parameters for GDB. */
7d9884b9 727
479f0f18
SG
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
734extern int target_byte_order;
735#endif
736
737extern void set_endian_from_file PARAMS ((bfd *));
738
04f566a3
JK
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
04f566a3
JK
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
7d9884b9
JG
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)
479f0f18
SG
801#ifndef TARGET_BYTE_ORDER_SELECTABLE
802
7d9884b9
JG
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. */
479f0f18
SG
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) */
7d9884b9
JG
816#endif /* BITS_BIG_ENDIAN not defined. */
817
e3c16900 818/* In findvar.c. */
e3c16900 819
6f54efdc
SS
820extern LONGEST extract_signed_integer PARAMS ((void *, int));
821
822extern unsigned LONGEST extract_unsigned_integer PARAMS ((void *, int));
823
a243a22f
SG
824extern int extract_long_unsigned_integer PARAMS ((void *, int, LONGEST *));
825
6f54efdc
SS
826extern CORE_ADDR extract_address PARAMS ((void *, int));
827
828extern void store_signed_integer PARAMS ((void *, int, LONGEST));
829
830extern void store_unsigned_integer PARAMS ((void *, int, unsigned LONGEST));
831
832extern void store_address PARAMS ((void *, int, CORE_ADDR));
833
a243a22f
SG
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
844extern 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
a243a22f
SG
882#else /* TARGET_BYTE_ORDER_SELECTABLE */
883# ifndef TARGET_FLOAT_FORMAT
c6fbd98b
SG
884# define TARGET_FLOAT_FORMAT (target_byte_order == BIG_ENDIAN \
885 ? &floatformat_ieee_single_big \
886 : &floatformat_ieee_single_little)
a243a22f
SG
887# endif
888# ifndef TARGET_DOUBLE_FORMAT
c6fbd98b
SG
889# define TARGET_DOUBLE_FORMAT (target_byte_order == BIG_ENDIAN \
890 ? &floatformat_ieee_double_big \
891 : &floatformat_ieee_double_little)
a243a22f
SG
892# endif
893#endif
894
c6fbd98b
SG
895#ifndef TARGET_LONG_DOUBLE_FORMAT
896# define TARGET_LONG_DOUBLE_FORMAT &floatformat_unknown
897#endif
898
a243a22f
SG
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
909typedef long double DOUBLEST;
a243a22f
SG
910#else
911typedef double DOUBLEST;
912#endif
913
91550191
SG
914extern void floatformat_to_doublest PARAMS ((const struct floatformat *,
915 char *, DOUBLEST *));
916extern void floatformat_from_doublest PARAMS ((const struct floatformat *,
917 DOUBLEST *, char *));
a243a22f 918extern DOUBLEST extract_floating PARAMS ((void *, int));
04f566a3 919
a243a22f 920extern void store_floating PARAMS ((void *, int, DOUBLEST));
e3c16900 921\f
7d9884b9
JG
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
04f566a3 926 table. This is used only for addresses of instructions, and even then
e3c16900
JK
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
04f566a3
JK
929 of generic thing to handle alignment or segmentation (it's possible it
930 should be in TARGET_READ_PC instead). */
7d9884b9
JG
931#if !defined (ADDR_BITS_REMOVE)
932#define ADDR_BITS_REMOVE(addr) (addr)
7d9884b9
JG
933#endif /* No ADDR_BITS_REMOVE. */
934
d747e0af
MT
935/* From valops.c */
936
6f54efdc 937extern CORE_ADDR push_bytes PARAMS ((CORE_ADDR, char *, int));
d747e0af 938
6f54efdc 939extern CORE_ADDR push_word PARAMS ((CORE_ADDR, unsigned LONGEST));
d747e0af 940
0239d9b3
FF
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
45993f61
SC
956#ifdef MAINTENANCE_CMDS
957extern int watchdog;
958#endif
959
09722039
SG
960#include "dis-asm.h" /* Get defs for disassemble_info */
961
18b46e7c
SS
962extern int dis_asm_read_memory PARAMS ((bfd_vma memaddr, bfd_byte *myaddr,
963 int len, disassemble_info *info));
964
965extern void dis_asm_memory_error PARAMS ((int status, bfd_vma memaddr,
966 disassemble_info *info));
967
968extern void dis_asm_print_address PARAMS ((bfd_vma addr,
969 disassemble_info *info));
970
971extern int (*tm_print_insn) PARAMS ((bfd_vma, disassemble_info*));
91550191 972extern disassemble_info tm_print_insn_info;
18b46e7c
SS
973
974/* Hooks for alternate command interfaces. */
975
09722039
SG
976#ifdef __STDC__
977struct target_waitstatus;
978struct cmd_list_element;
979#endif
980
8164ec2e
SG
981extern void (*init_ui_hook) PARAMS ((void));
982extern void (*command_loop_hook) PARAMS ((void));
18b46e7c
SS
983extern void (*fputs_unfiltered_hook) PARAMS ((const char *linebuffer,
984 FILE *stream));
985extern void (*print_frame_info_listing_hook) PARAMS ((struct symtab *s,
986 int line, int stopline,
987 int noerror));
91550191 988extern int (*query_hook) PARAMS ((const char *, va_list));
8164ec2e
SG
989extern void (*flush_hook) PARAMS ((FILE *stream));
990extern void (*create_breakpoint_hook) PARAMS ((struct breakpoint *b));
991extern void (*delete_breakpoint_hook) PARAMS ((struct breakpoint *bpt));
326ae3e2 992extern void (*modify_breakpoint_hook) PARAMS ((struct breakpoint *bpt));
b6d70e15 993extern void (*target_output_hook) PARAMS ((char *));
637b1661 994extern void (*interactive_hook) PARAMS ((void));
16041d53 995extern void (*registers_changed_hook) PARAMS ((void));
91550191
SG
996extern void (*readline_begin_hook) PARAMS ((char *, ...));
997extern char * (*readline_hook) PARAMS ((char *));
998extern void (*readline_end_hook) PARAMS ((void));
479f0f18
SG
999
1000extern int (*target_wait_hook) PARAMS ((int pid,
1001 struct target_waitstatus *status));
1002
1003extern void (*call_command_hook) PARAMS ((struct cmd_list_element *c,
1004 char *cmd, int from_tty));
1005
b607efe7 1006extern NORETURN void (*error_hook) PARAMS ((void)) ATTR_NORETURN;
45993f61
SC
1007
1008
1009
754e5da2
SG
1010/* Inhibit window interface if non-zero. */
1011
c5197511 1012extern int use_windows;
754e5da2 1013
45993f61
SC
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
9e77e83d 1023#if defined(__GO32__)||defined(_WIN32)
b6d70e15
SC
1024#define SLASH_P(X) ((X)=='\\')
1025#else
45993f61
SC
1026#define SLASH_P(X) ((X)=='/')
1027#endif
b6d70e15 1028#endif
45993f61
SC
1029
1030#ifndef SLASH_CHAR
9e77e83d 1031#if defined(__GO32__)||defined(_WIN32)
b6d70e15
SC
1032#define SLASH_CHAR '\\'
1033#else
45993f61
SC
1034#define SLASH_CHAR '/'
1035#endif
b6d70e15 1036#endif
45993f61
SC
1037
1038#ifndef SLASH_STRING
9e77e83d 1039#if defined(__GO32__)||defined(_WIN32)
b6d70e15
SC
1040#define SLASH_STRING "\\"
1041#else
45993f61
SC
1042#define SLASH_STRING "/"
1043#endif
b6d70e15 1044#endif
45993f61
SC
1045
1046#ifndef ROOTED_P
1047#define ROOTED_P(X) (SLASH_P((X)[0]))
1048#endif
1049
09722039 1050#endif /* #ifndef DEFS_H */
This page took 0.294177 seconds and 4 git commands to generate.