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