Roll in Tiemann changes for gcc -ansi. Fix assorted bugs. See ChangeLog.
[deliverable/binutils-gdb.git] / gdb / defs.h
CommitLineData
bd5635a1
RP
1/* Basic definitions for GDB, the GNU debugger.
2 Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc.
3
4This file is part of GDB.
5
6GDB is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 1, or (at your option)
9any later version.
10
11GDB is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GDB; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
c1ace5b5
JK
20#if !defined (DEFS_H)
21#define DEFS_H
22
bd5635a1
RP
23/* An address in the program being debugged. Host byte order. */
24typedef unsigned int CORE_ADDR;
25
26#define min(a, b) ((a) < (b) ? (a) : (b))
27#define max(a, b) ((a) > (b) ? (a) : (b))
28
29/* The character C++ uses to build identifiers that must be unique from
30 the program's identifiers (such as $this and $$vptr). */
31#define CPLUS_MARKER '$' /* May be overridden to '.' for SysV */
32
33/*
34 * Allow things in gdb to be declared "const". If compiling ANSI, it
35 * just works. If compiling with gcc but non-ansi, redefine to __const__.
36 * If non-ansi, non-gcc, then eliminate "const" entirely, making those
37 * objects be read-write rather than read-only.
38 */
d11c44f1 39#ifndef const
bd5635a1
RP
40#ifndef __STDC__
41# ifdef __GNUC__
42# define const __const__
bd5635a1
RP
43# else
44# define const /*nothing*/
d11c44f1
JG
45# endif /* GNUC */
46#endif /* STDC */
47#endif /* const */
48
49#ifndef volatile
50#ifndef __STDC__
51# ifdef __GNUC__
52# define volatile __volatile__
53# else
bd5635a1
RP
54# define volatile /*nothing*/
55# endif /* GNUC */
56#endif /* STDC */
d11c44f1 57#endif /* volatile */
bd5635a1
RP
58
59extern char *savestring ();
60extern char *strsave ();
61extern char *concat ();
62#ifdef __STDC__
63extern void *xmalloc (), *xrealloc ();
64#else
65extern char *xmalloc (), *xrealloc ();
66#endif
67extern void free ();
68extern int parse_escape ();
69extern char *reg_names[];
70/* Indicate that these routines do not return to the caller. */
71extern volatile void error(), fatal();
72
73/* Various possibilities for alloca. */
d11c44f1
JG
74#ifndef alloca
75# ifdef __GNUC__
76# define alloca __builtin_alloca
77# else
78# ifdef sparc
79# include <alloca.h>
80# endif
81 extern char *alloca ();
bd5635a1 82# endif
d11c44f1 83#endif
bd5635a1
RP
84
85extern int errno; /* System call error return status */
86
87extern int quit_flag;
88extern int immediate_quit;
89extern void quit ();
90
91#define QUIT { if (quit_flag) quit (); }
92
93/* Notes on classes: class_alias is for alias commands which are not
94 abbreviations of the original command. */
95
96enum command_class
97{
98 /* Special args to help_list */
99 all_classes = -2, all_commands = -1,
100 /* Classes of commands */
101 no_class = -1, class_run = 0, class_vars, class_stack,
102 class_files, class_support, class_info, class_breakpoint,
103 class_alias, class_obscure, class_user
104};
105
106/* the cleanup list records things that have to be undone
107 if an error happens (descriptors to be closed, memory to be freed, etc.)
108 Each link in the chain records a function to call and an
109 argument to give it.
110
111 Use make_cleanup to add an element to the cleanup chain.
112 Use do_cleanups to do all cleanup actions back to a given
113 point in the chain. Use discard_cleanups to remove cleanups
114 from the chain back to a given point, not doing them. */
115
116struct cleanup
117{
118 struct cleanup *next;
119 void (*function) ();
120 int arg;
121};
122
123/* From utils.c. */
124extern void do_cleanups ();
125extern void discard_cleanups ();
126extern struct cleanup *make_cleanup ();
127extern struct cleanup *save_cleanups ();
128extern void restore_cleanups ();
129extern void free_current_contents ();
130extern int myread ();
131extern int query ();
132extern int lines_to_list ();
e1ce8aa5
JK
133extern void wrap_here (
134#ifdef __STDC__
135 char *
136#endif
137 );
bd5635a1
RP
138extern void reinitialize_more_filter ();
139extern void fputs_filtered ();
140extern void puts_filtered ();
141extern void fprintf_filtered ();
142extern void printf_filtered ();
143extern void print_spaces ();
144extern void print_spaces_filtered ();
145extern char *n_spaces ();
146extern void printchar ();
147extern void fprint_symbol ();
148extern void fputs_demangled ();
149extern void perror_with_name ();
150extern void print_sys_errmsg ();
151
152/* From printcmd.c */
153extern void print_address_symbolic ();
154extern void print_address ();
155
e1ce8aa5
JK
156/* From source.c */
157void mod_path (
158#ifdef __STDC__
159 char *, char **
160#endif
161 );
162
bd5635a1
RP
163/* From readline (but not in any readline .h files). */
164extern char *tilde_expand ();
165
166/* Structure for saved commands lines
167 (for breakpoints, defined commands, etc). */
168
169struct command_line
170{
171 struct command_line *next;
172 char *line;
173};
174
175extern struct command_line *read_command_lines ();
176extern void free_command_lines ();
177
178/* String containing the current directory (what getwd would return). */
179
180char *current_directory;
181
182/* Default radixes for input and output. Only some values supported. */
183extern unsigned input_radix;
184extern unsigned output_radix;
185
186/* Baud rate specified for communication with serial target systems. */
187char *baud_rate;
188
189#if !defined (UINT_MAX)
190#define UINT_MAX 0xffffffff
191#endif
192
193#if !defined (LONG_MAX)
194#define LONG_MAX 0x7fffffff
195#endif
196
e1ce8aa5
JK
197#if !defined (INT_MAX)
198#define INT_MAX 0x7fffffff
199#endif
200
201#if !defined (INT_MIN)
202/* Two's complement, 32 bit. */
203#define INT_MIN -0x80000000
204#endif
205
bd5635a1
RP
206/* Just like CHAR_BIT in <limits.h> but describes the target machine. */
207#if !defined (TARGET_CHAR_BIT)
208#define TARGET_CHAR_BIT 8
209#endif
c1ace5b5 210
d166df9b
JK
211/* Number of bits in a long long or unsigned long long
212 for the target machine. */
213#if !defined (TARGET_LONG_LONG_BIT)
214#define TARGET_LONG_LONG_BIT 64
215#endif
216
e1ce8aa5
JK
217/* Convert a LONGEST to an int. This is used in contexts (e.g. number
218 of arguments to a function, number in a value history, register
219 number, etc.) where the value must not be larger than can fit
220 in an int. */
221#if !defined (longest_to_int)
222#if defined (LONG_LONG)
223#define longest_to_int(x) (((x) > INT_MAX || (x) < INT_MIN) \
224 ? error ("Value out of range.") : (int) (x))
225#else /* No LONG_LONG. */
226/* Assume sizeof (int) == sizeof (long). */
227#define longest_to_int(x) ((int) (x))
228#endif /* No LONG_LONG. */
229#endif /* No longest_to_int. */
230
c1ace5b5 231#endif /* no DEFS_H */
This page took 0.034858 seconds and 4 git commands to generate.