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