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