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