1 /* Basic, host-specific, and target-specific definitions for GDB.
2 Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program 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 2 of the License, or
9 (at your option) any later version.
11 This program 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.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
23 /* An address in the program being debugged. Host byte order. */
24 typedef unsigned int CORE_ADDR;
26 #define min(a, b) ((a) < (b) ? (a) : (b))
27 #define max(a, b) ((a) > (b) ? (a) : (b))
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 */
33 extern int errno; /* System call error return status */
36 extern int immediate_quit;
39 #define QUIT { if (quit_flag) quit (); }
41 /* Notes on classes: class_alias is for alias commands which are not
42 abbreviations of the original command. */
46 /* Special args to help_list */
47 all_classes = -2, all_commands = -1,
48 /* Classes of commands */
49 no_class = -1, class_run = 0, class_vars, class_stack,
50 class_files, class_support, class_info, class_breakpoint,
51 class_alias, class_obscure, class_user
54 /* the cleanup list records things that have to be undone
55 if an error happens (descriptors to be closed, memory to be freed, etc.)
56 Each link in the chain records a function to call and an
59 Use make_cleanup to add an element to the cleanup chain.
60 Use do_cleanups to do all cleanup actions back to a given
61 point in the chain. Use discard_cleanups to remove cleanups
62 from the chain back to a given point, not doing them. */
72 extern void do_cleanups ();
73 extern void discard_cleanups ();
74 extern struct cleanup *make_cleanup ();
75 extern struct cleanup *save_cleanups ();
76 extern void restore_cleanups ();
77 extern void free_current_contents ();
80 extern void wrap_here (
85 extern void reinitialize_more_filter ();
86 extern void fputs_filtered ();
87 extern void puts_filtered ();
88 extern void fprintf_filtered ();
89 extern void printf_filtered ();
90 extern void print_spaces ();
91 extern void print_spaces_filtered ();
92 extern char *n_spaces ();
93 extern void printchar ();
94 extern void fprint_symbol ();
95 extern void fputs_demangled ();
96 extern void perror_with_name ();
97 extern void print_sys_errmsg ();
100 extern void print_address_symbolic ();
101 extern void print_address ();
110 /* From readline (but not in any readline .h files). */
111 extern char *tilde_expand ();
113 /* Structure for saved commands lines
114 (for breakpoints, defined commands, etc). */
118 struct command_line *next;
122 extern struct command_line *read_command_lines ();
123 extern void free_command_lines ();
125 /* String containing the current directory (what getwd would return). */
127 char *current_directory;
129 /* Default radixes for input and output. Only some values supported. */
130 extern unsigned input_radix;
131 extern unsigned output_radix;
133 /* Baud rate specified for communication with serial target systems. */
136 /* Languages represented in the symbol table and elsewhere. */
140 language_unknown, /* Language not known */
141 language_auto, /* Placeholder for automatic setting */
143 language_cplus, /* C++ */
144 language_m2 /* Modula-2 */
147 /* Return a format string for printf that will print a number in the local
148 (language-specific) hexadecimal format. Result is static and is
149 overwritten by the next call. local_hex_format_custom takes printf
150 options like "08" or "l" (to produce e.g. %08x or %lx). */
152 #define local_hex_format() (current_language->la_hex_format)
153 char *local_hex_format_custom(); /* language.c */
155 /* Return a string that contains a number formatted in the local
156 (language-specific) hexadecimal format. Result is static and is
157 overwritten by the next call. local_hex_string_custom takes printf
158 options like "08" or "l". */
160 char *local_hex_string (); /* language.c */
161 char *local_hex_string_custom (); /* language.c */
163 /* Host machine definition. This will be a symlink to one of the
164 xm-*.h files, built by the `configure' script. */
169 * Allow things in gdb to be declared "const". If compiling ANSI, it
170 * just works. If compiling with gcc but non-ansi, redefine to __const__.
171 * If non-ansi, non-gcc, then eliminate "const" entirely, making those
172 * objects be read-write rather than read-only.
178 # define const __const__
180 # define const /*nothing*/
188 # define volatile __volatile__
190 # define volatile /*nothing*/
193 #endif /* volatile */
195 /* Defaults for system-wide constants (if not defined by xm.h, we fake it). */
197 #if !defined (UINT_MAX)
198 #define UINT_MAX 0xffffffff
201 #if !defined (LONG_MAX)
202 #define LONG_MAX 0x7fffffff
205 #if !defined (INT_MAX)
206 #define INT_MAX 0x7fffffff
209 #if !defined (INT_MIN)
210 /* Two's complement, 32 bit. */
211 #define INT_MIN -0x80000000
214 /* Number of bits in a char or unsigned char for the target machine.
215 Just like CHAR_BIT in <limits.h> but describes the target machine. */
216 #if !defined (TARGET_CHAR_BIT)
217 #define TARGET_CHAR_BIT 8
220 /* Number of bits in a short or unsigned short for the target machine. */
221 #if !defined (TARGET_SHORT_BIT)
222 #define TARGET_SHORT_BIT (sizeof (short) * TARGET_CHAR_BIT)
225 /* Number of bits in an int or unsigned int for the target machine. */
226 #if !defined (TARGET_INT_BIT)
227 #define TARGET_INT_BIT (sizeof (int) * TARGET_CHAR_BIT)
230 /* Number of bits in a long or unsigned long for the target machine. */
231 #if !defined (TARGET_LONG_BIT)
232 #define TARGET_LONG_BIT (sizeof (long) * TARGET_CHAR_BIT)
235 /* Number of bits in a long long or unsigned long long for the target machine. */
236 #if !defined (TARGET_LONG_LONG_BIT)
237 #define TARGET_LONG_LONG_BIT (2 * TARGET_LONG_BIT)
240 /* Number of bits in a float for the target machine. */
241 #if !defined (TARGET_FLOAT_BIT)
242 #define TARGET_FLOAT_BIT (sizeof (float) * TARGET_CHAR_BIT)
245 /* Number of bits in a double for the target machine. */
246 #if !defined (TARGET_DOUBLE_BIT)
247 #define TARGET_DOUBLE_BIT (sizeof (double) * TARGET_CHAR_BIT)
250 /* Number of bits in a long double for the target machine. */
251 #if !defined (TARGET_LONG_DOUBLE_BIT)
252 #define TARGET_LONG_DOUBLE_BIT (2 * TARGET_DOUBLE_BIT)
255 /* Number of bits in a "complex" for the target machine. */
256 #if !defined (TARGET_COMPLEX_BIT)
257 #define TARGET_COMPLEX_BIT (2 * TARGET_FLOAT_BIT)
260 /* Number of bits in a "double complex" for the target machine. */
261 #if !defined (TARGET_DOUBLE_COMPLEX_BIT)
262 #define TARGET_DOUBLE_COMPLEX_BIT (2 * TARGET_DOUBLE_BIT)
265 /* Convert a LONGEST to an int. This is used in contexts (e.g. number
266 of arguments to a function, number in a value history, register
267 number, etc.) where the value must not be larger than can fit
269 #if !defined (longest_to_int)
270 #if defined (LONG_LONG)
271 #define longest_to_int(x) (((x) > INT_MAX || (x) < INT_MIN) \
272 ? error ("Value out of range.") : (int) (x))
273 #else /* No LONG_LONG. */
274 /* Assume sizeof (int) == sizeof (long). */
275 #define longest_to_int(x) ((int) (x))
276 #endif /* No LONG_LONG. */
277 #endif /* No longest_to_int. */
279 /* Assorted functions we can declare, now that const and volatile are
281 extern char *savestring ();
282 extern char *strsave ();
283 extern char *concat ();
285 extern void *xmalloc (), *xrealloc ();
287 extern char *xmalloc (), *xrealloc ();
290 extern int parse_escape ();
291 extern char *reg_names[];
292 /* Indicate that these routines do not return to the caller. */
293 extern volatile void error(), fatal();
294 extern void warning_setup(), warning();
296 /* Various possibilities for alloca. */
299 # define alloca __builtin_alloca
304 extern char *alloca ();
308 /* TARGET_BYTE_ORDER and HOST_BYTE_ORDER should be defined to one of these. */
310 #if !defined (BIG_ENDIAN)
311 #define BIG_ENDIAN 4321
314 #if !defined (LITTLE_ENDIAN)
315 #define LITTLE_ENDIAN 1234
318 /* Target-system-dependent parameters for GDB.
320 The standard thing is to include defs.h. However, files that are
321 specific to a particular target can define TM_FILE_OVERRIDE before
322 including defs.h, then can include any particular tm-file they desire. */
324 /* Target machine definition. This will be a symlink to one of the
325 tm-*.h files, built by the `configure' script. */
327 #ifndef TM_FILE_OVERRIDE
331 /* The bit byte-order has to do just with numbering of bits in
332 debugging symbols and such. Conceptually, it's quite separate
333 from byte/word byte order. */
335 #if !defined (BITS_BIG_ENDIAN)
336 #if TARGET_BYTE_ORDER == BIG_ENDIAN
337 #define BITS_BIG_ENDIAN 1
338 #endif /* Big endian. */
340 #if TARGET_BYTE_ORDER == LITTLE_ENDIAN
341 #define BITS_BIG_ENDIAN 0
342 #endif /* Little endian. */
343 #endif /* BITS_BIG_ENDIAN not defined. */
345 /* Swap LEN bytes at BUFFER between target and host byte-order. */
346 #if TARGET_BYTE_ORDER == HOST_BYTE_ORDER
347 #define SWAP_TARGET_AND_HOST(buffer,len)
348 #else /* Target and host byte order differ. */
349 #define SWAP_TARGET_AND_HOST(buffer,len) \
352 char *p = (char *)(buffer); \
353 char *q = ((char *)(buffer)) + len - 1; \
354 for (; p < q; p++, q--) \
361 #endif /* Target and host byte order differ. */
363 /* On some machines there are bits in addresses which are not really
364 part of the address, but are used by the kernel, the hardware, etc.
365 for special purposes. ADDR_BITS_REMOVE takes out any such bits
366 so we get a "real" address such as one would find in a symbol
367 table. ADDR_BITS_SET sets those bits the way the system wants
369 #if !defined (ADDR_BITS_REMOVE)
370 #define ADDR_BITS_REMOVE(addr) (addr)
371 #define ADDR_BITS_SET(addr) (addr)
372 #endif /* No ADDR_BITS_REMOVE. */
374 #if !defined (SYS_SIGLIST_MISSING)
375 #define SYS_SIGLIST_MISSING defined (USG)
376 #endif /* No SYS_SIGLIST_MISSING */
378 #endif /* no DEFS_H */