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 */
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.
42 # define const __const__
44 # define const /*nothing*/
52 # define volatile __volatile__
54 # define volatile /*nothing*/
59 extern char *savestring ();
60 extern char *strsave ();
61 extern char *concat ();
63 extern void *xmalloc (), *xrealloc ();
65 extern char *xmalloc (), *xrealloc ();
68 extern int parse_escape ();
69 extern char *reg_names
[];
70 /* Indicate that these routines do not return to the caller. */
71 extern volatile void error(), fatal();
72 extern void warning_setup(), warning();
74 /* Various possibilities for alloca. */
77 # define alloca __builtin_alloca
82 extern char *alloca ();
86 extern int errno
; /* System call error return status */
89 extern int immediate_quit
;
92 #define QUIT { if (quit_flag) quit (); }
94 /* Notes on classes: class_alias is for alias commands which are not
95 abbreviations of the original command. */
99 /* Special args to help_list */
100 all_classes
= -2, all_commands
= -1,
101 /* Classes of commands */
102 no_class
= -1, class_run
= 0, class_vars
, class_stack
,
103 class_files
, class_support
, class_info
, class_breakpoint
,
104 class_alias
, class_obscure
, class_user
107 /* the cleanup list records things that have to be undone
108 if an error happens (descriptors to be closed, memory to be freed, etc.)
109 Each link in the chain records a function to call and an
112 Use make_cleanup to add an element to the cleanup chain.
113 Use do_cleanups to do all cleanup actions back to a given
114 point in the chain. Use discard_cleanups to remove cleanups
115 from the chain back to a given point, not doing them. */
119 struct cleanup
*next
;
125 extern void do_cleanups ();
126 extern void discard_cleanups ();
127 extern struct cleanup
*make_cleanup ();
128 extern struct cleanup
*save_cleanups ();
129 extern void restore_cleanups ();
130 extern void free_current_contents ();
131 extern int myread ();
133 extern void wrap_here (
138 extern void reinitialize_more_filter ();
139 extern void fputs_filtered ();
140 extern void puts_filtered ();
141 extern void fprintf_filtered ();
142 extern void printf_filtered ();
143 extern void print_spaces ();
144 extern void print_spaces_filtered ();
145 extern char *n_spaces ();
146 extern void printchar ();
147 extern void fprint_symbol ();
148 extern void fputs_demangled ();
149 extern void perror_with_name ();
150 extern void print_sys_errmsg ();
152 /* From printcmd.c */
153 extern void print_address_symbolic ();
154 extern void print_address ();
163 /* From readline (but not in any readline .h files). */
164 extern char *tilde_expand ();
166 /* Structure for saved commands lines
167 (for breakpoints, defined commands, etc). */
171 struct command_line
*next
;
175 extern struct command_line
*read_command_lines ();
176 extern void free_command_lines ();
178 /* String containing the current directory (what getwd would return). */
180 char *current_directory
;
182 /* Default radixes for input and output. Only some values supported. */
183 extern unsigned input_radix
;
184 extern unsigned output_radix
;
186 /* Baud rate specified for communication with serial target systems. */
189 #if !defined (UINT_MAX)
190 #define UINT_MAX 0xffffffff
193 #if !defined (LONG_MAX)
194 #define LONG_MAX 0x7fffffff
197 #if !defined (INT_MAX)
198 #define INT_MAX 0x7fffffff
201 #if !defined (INT_MIN)
202 /* Two's complement, 32 bit. */
203 #define INT_MIN -0x80000000
206 /* Number of bits in a char or unsigned char for the target machine.
207 Just like CHAR_BIT in <limits.h> but describes the target machine. */
208 #if !defined (TARGET_CHAR_BIT)
209 #define TARGET_CHAR_BIT 8
212 /* Number of bits in a short or unsigned short for the target machine. */
213 #if !defined (TARGET_SHORT_BIT)
214 #define TARGET_SHORT_BIT (sizeof (short) * TARGET_CHAR_BIT)
217 /* Number of bits in an int or unsigned int for the target machine. */
218 #if !defined (TARGET_INT_BIT)
219 #define TARGET_INT_BIT (sizeof (int) * TARGET_CHAR_BIT)
222 /* Number of bits in a long or unsigned long for the target machine. */
223 #if !defined (TARGET_LONG_BIT)
224 #define TARGET_LONG_BIT (sizeof (long) * TARGET_CHAR_BIT)
227 /* Number of bits in a long long or unsigned long long for the target machine. */
228 #if !defined (TARGET_LONG_LONG_BIT)
229 #define TARGET_LONG_LONG_BIT (2 * TARGET_LONG_BIT)
232 /* Number of bits in a float for the target machine. */
233 #if !defined (TARGET_FLOAT_BIT)
234 #define TARGET_FLOAT_BIT (sizeof (float) * TARGET_CHAR_BIT)
237 /* Number of bits in a double for the target machine. */
238 #if !defined (TARGET_DOUBLE_BIT)
239 #define TARGET_DOUBLE_BIT (sizeof (double) * TARGET_CHAR_BIT)
242 /* Number of bits in a long double for the target machine. */
243 #if !defined (TARGET_LONG_DOUBLE_BIT)
244 #define TARGET_LONG_DOUBLE_BIT (2 * TARGET_DOUBLE_BIT)
247 /* Number of bits in a "complex" for the target machine. */
248 #if !defined (TARGET_COMPLEX_BIT)
249 #define TARGET_COMPLEX_BIT (2 * TARGET_FLOAT_BIT)
252 /* Number of bits in a "double complex" for the target machine. */
253 #if !defined (TARGET_DOUBLE_COMPLEX_BIT)
254 #define TARGET_DOUBLE_COMPLEX_BIT (2 * TARGET_DOUBLE_BIT)
257 /* Convert a LONGEST to an int. This is used in contexts (e.g. number
258 of arguments to a function, number in a value history, register
259 number, etc.) where the value must not be larger than can fit
261 #if !defined (longest_to_int)
262 #if defined (LONG_LONG)
263 #define longest_to_int(x) (((x) > INT_MAX || (x) < INT_MIN) \
264 ? error ("Value out of range.") : (int) (x))
265 #else /* No LONG_LONG. */
266 /* Assume sizeof (int) == sizeof (long). */
267 #define longest_to_int(x) ((int) (x))
268 #endif /* No LONG_LONG. */
269 #endif /* No longest_to_int. */
271 /* Languages represented in the symbol table and elsewhere. */
275 language_unknown
, /* Language not known */
276 language_auto
, /* Placeholder for automatic setting */
278 language_cplus
, /* C++ */
279 language_m2
, /* Modula-2 */
282 /* Return a format string for printf that will print a number in the local
283 (language-specific) hexadecimal format. Result is static and is
284 overwritten by the next call. local_hex_format_custom takes printf
285 options like "08" or "l" (to produce e.g. %08x or %lx). */
287 #define local_hex_format() (current_language->la_hex_format)
288 char *local_hex_format_custom(); /* language.c */
290 /* Return a string that contains a number formatted in the local
291 (language-specific) hexadecimal format. Result is static and is
292 overwritten by the next call. local_hex_string_custom takes printf
293 options like "08" or "l". */
295 char *local_hex_string (); /* language.c */
296 char *local_hex_string_custom (); /* language.c */
298 /* System-dependent parameters for GDB.
300 The standard thing is to include defs.h. However, files that are
301 specific to a particular target can define TM_FILE_OVERRIDE before
302 including defs.h, then can include any particular tm-file they desire. */
304 /* Target machine definition. This will be a symlink to one of the
305 tm-*.h files, built by the `configure' script. */
307 #ifndef TM_FILE_OVERRIDE
311 /* Host machine definition. This will be a symlink to one of the
312 xm-*.h files, built by the `configure' script. */
316 /* TARGET_BYTE_ORDER and HOST_BYTE_ORDER should be defined to one of these. */
317 #if !defined (BIG_ENDIAN)
318 #define BIG_ENDIAN 4321
321 #if !defined (LITTLE_ENDIAN)
322 #define LITTLE_ENDIAN 1234
325 /* The bit byte-order has to do just with numbering of bits in
326 debugging symbols and such. Conceptually, it's quite separate
327 from byte/word byte order. */
329 #if !defined (BITS_BIG_ENDIAN)
330 #if TARGET_BYTE_ORDER == BIG_ENDIAN
331 #define BITS_BIG_ENDIAN 1
332 #endif /* Big endian. */
334 #if TARGET_BYTE_ORDER == LITTLE_ENDIAN
335 #define BITS_BIG_ENDIAN 0
336 #endif /* Little endian. */
337 #endif /* BITS_BIG_ENDIAN not defined. */
339 /* Swap LEN bytes at BUFFER between target and host byte-order. */
340 #if TARGET_BYTE_ORDER == HOST_BYTE_ORDER
341 #define SWAP_TARGET_AND_HOST(buffer,len)
342 #else /* Target and host byte order differ. */
343 #define SWAP_TARGET_AND_HOST(buffer,len) \
346 char *p = (char *)(buffer); \
347 char *q = ((char *)(buffer)) + len - 1; \
348 for (; p < q; p++, q--) \
355 #endif /* Target and host byte order differ. */
357 /* On some machines there are bits in addresses which are not really
358 part of the address, but are used by the kernel, the hardware, etc.
359 for special purposes. ADDR_BITS_REMOVE takes out any such bits
360 so we get a "real" address such as one would find in a symbol
361 table. ADDR_BITS_SET sets those bits the way the system wants
363 #if !defined (ADDR_BITS_REMOVE)
364 #define ADDR_BITS_REMOVE(addr) (addr)
365 #define ADDR_BITS_SET(addr) (addr)
366 #endif /* No ADDR_BITS_REMOVE. */
368 #if !defined (SYS_SIGLIST_MISSING)
369 #define SYS_SIGLIST_MISSING defined (USG)
370 #endif /* No SYS_SIGLIST_MISSING */
372 #endif /* no DEFS_H */
This page took 0.036603 seconds and 4 git commands to generate.