* command.h, defs.h, eval.h, expression.h, remote-sa.sparc.c,
[deliverable/binutils-gdb.git] / gdb / defs.h
CommitLineData
7d9884b9 1/* Basic, host-specific, and target-specific definitions for GDB.
bd5635a1
RP
2 Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc.
3
4This file is part of GDB.
5
a10c0d36 6This program is free software; you can redistribute it and/or modify
bd5635a1 7it under the terms of the GNU General Public License as published by
a10c0d36
JG
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
bd5635a1 10
a10c0d36 11This program is distributed in the hope that it will be useful,
bd5635a1
RP
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
a10c0d36
JG
17along with this program; if not, write to the Free Software
18Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
bd5635a1 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
bd5635a1
RP
33extern int errno; /* System call error return status */
34
35extern int quit_flag;
36extern int immediate_quit;
37extern void quit ();
38
39#define QUIT { if (quit_flag) quit (); }
40
41/* Notes on classes: class_alias is for alias commands which are not
42 abbreviations of the original command. */
43
44enum command_class
45{
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
52};
53
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
57 argument to give it.
58
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. */
63
64struct cleanup
65{
66 struct cleanup *next;
67 void (*function) ();
68 int arg;
69};
70
71/* From utils.c. */
72extern void do_cleanups ();
73extern void discard_cleanups ();
74extern struct cleanup *make_cleanup ();
75extern struct cleanup *save_cleanups ();
76extern void restore_cleanups ();
77extern void free_current_contents ();
78extern int myread ();
79extern int query ();
e1ce8aa5
JK
80extern void wrap_here (
81#ifdef __STDC__
82 char *
83#endif
84 );
bd5635a1
RP
85extern void reinitialize_more_filter ();
86extern void fputs_filtered ();
87extern void puts_filtered ();
88extern void fprintf_filtered ();
89extern void printf_filtered ();
90extern void print_spaces ();
91extern void print_spaces_filtered ();
92extern char *n_spaces ();
93extern void printchar ();
94extern void fprint_symbol ();
95extern void fputs_demangled ();
96extern void perror_with_name ();
97extern void print_sys_errmsg ();
98
99/* From printcmd.c */
100extern void print_address_symbolic ();
101extern void print_address ();
102
e1ce8aa5
JK
103/* From source.c */
104void mod_path (
105#ifdef __STDC__
106 char *, char **
107#endif
108 );
109
bd5635a1
RP
110/* From readline (but not in any readline .h files). */
111extern char *tilde_expand ();
112
113/* Structure for saved commands lines
114 (for breakpoints, defined commands, etc). */
115
116struct command_line
117{
118 struct command_line *next;
119 char *line;
120};
121
122extern struct command_line *read_command_lines ();
123extern void free_command_lines ();
124
125/* String containing the current directory (what getwd would return). */
126
127char *current_directory;
128
129/* Default radixes for input and output. Only some values supported. */
130extern unsigned input_radix;
131extern unsigned output_radix;
132
133/* Baud rate specified for communication with serial target systems. */
134char *baud_rate;
135
0a5d35ed
SG
136/* Languages represented in the symbol table and elsewhere. */
137
138enum language
139{
140 language_unknown, /* Language not known */
141 language_auto, /* Placeholder for automatic setting */
142 language_c, /* C */
143 language_cplus, /* C++ */
144 language_m2 /* Modula-2 */
145};
146
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). */
151
152#define local_hex_format() (current_language->la_hex_format)
153char *local_hex_format_custom(); /* language.c */
154
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". */
159
160char *local_hex_string (); /* language.c */
161char *local_hex_string_custom (); /* language.c */
162\f
163/* Host machine definition. This will be a symlink to one of the
164 xm-*.h files, built by the `configure' script. */
165
166#include "xm.h"
167
168/*
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.
173 */
174
175#ifndef const
176#ifndef __STDC__
177# ifdef __GNUC__
178# define const __const__
179# else
180# define const /*nothing*/
181# endif /* GNUC */
182#endif /* STDC */
183#endif /* const */
184
185#ifndef volatile
186#ifndef __STDC__
187# ifdef __GNUC__
188# define volatile __volatile__
189# else
190# define volatile /*nothing*/
191# endif /* GNUC */
192#endif /* STDC */
193#endif /* volatile */
194
195/* Defaults for system-wide constants (if not defined by xm.h, we fake it). */
196
bd5635a1
RP
197#if !defined (UINT_MAX)
198#define UINT_MAX 0xffffffff
199#endif
200
201#if !defined (LONG_MAX)
202#define LONG_MAX 0x7fffffff
203#endif
204
e1ce8aa5
JK
205#if !defined (INT_MAX)
206#define INT_MAX 0x7fffffff
207#endif
208
209#if !defined (INT_MIN)
210/* Two's complement, 32 bit. */
211#define INT_MIN -0x80000000
212#endif
213
e2aab031
FF
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. */
bd5635a1
RP
216#if !defined (TARGET_CHAR_BIT)
217#define TARGET_CHAR_BIT 8
218#endif
c1ace5b5 219
e2aab031
FF
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)
223#endif
224
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)
228#endif
229
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)
233#endif
234
235/* Number of bits in a long long or unsigned long long for the target machine. */
d166df9b 236#if !defined (TARGET_LONG_LONG_BIT)
e2aab031
FF
237#define TARGET_LONG_LONG_BIT (2 * TARGET_LONG_BIT)
238#endif
239
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)
243#endif
244
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)
248#endif
249
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)
253#endif
254
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)
258#endif
259
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)
d166df9b
JK
263#endif
264
e1ce8aa5
JK
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
268 in an int. */
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. */
278
0a5d35ed
SG
279/* Assorted functions we can declare, now that const and volatile are
280 defined. */
281extern char *savestring ();
282extern char *strsave ();
283extern char *concat ();
284#ifdef __STDC__
285extern void *xmalloc (), *xrealloc ();
286#else
287extern char *xmalloc (), *xrealloc ();
288#endif
289extern void free ();
290extern int parse_escape ();
291extern char *reg_names[];
292/* Indicate that these routines do not return to the caller. */
293extern volatile void error(), fatal();
294extern void warning_setup(), warning();
e2aab031 295
0a5d35ed
SG
296/* Various possibilities for alloca. */
297#ifndef alloca
298# ifdef __GNUC__
299# define alloca __builtin_alloca
300# else
301# ifdef sparc
302# include <alloca.h>
303# endif
304 extern char *alloca ();
305# endif
306#endif
e2aab031 307
0a5d35ed 308/* TARGET_BYTE_ORDER and HOST_BYTE_ORDER should be defined to one of these. */
a10c0d36 309
0a5d35ed
SG
310#if !defined (BIG_ENDIAN)
311#define BIG_ENDIAN 4321
312#endif
a10c0d36 313
0a5d35ed
SG
314#if !defined (LITTLE_ENDIAN)
315#define LITTLE_ENDIAN 1234
316#endif
a10c0d36 317
0a5d35ed 318/* Target-system-dependent parameters for GDB.
7d9884b9
JG
319
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. */
323
324/* Target machine definition. This will be a symlink to one of the
325 tm-*.h files, built by the `configure' script. */
326
327#ifndef TM_FILE_OVERRIDE
328#include "tm.h"
329#endif
330
7d9884b9
JG
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. */
334
335#if !defined (BITS_BIG_ENDIAN)
336#if TARGET_BYTE_ORDER == BIG_ENDIAN
337#define BITS_BIG_ENDIAN 1
338#endif /* Big endian. */
339
340#if TARGET_BYTE_ORDER == LITTLE_ENDIAN
341#define BITS_BIG_ENDIAN 0
342#endif /* Little endian. */
343#endif /* BITS_BIG_ENDIAN not defined. */
344
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) \
350 { \
351 char tmp; \
352 char *p = (char *)(buffer); \
353 char *q = ((char *)(buffer)) + len - 1; \
354 for (; p < q; p++, q--) \
355 { \
356 tmp = *q; \
357 *q = *p; \
358 *p = tmp; \
359 } \
360 }
361#endif /* Target and host byte order differ. */
362
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
368 them. */
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. */
373
374#if !defined (SYS_SIGLIST_MISSING)
375#define SYS_SIGLIST_MISSING defined (USG)
376#endif /* No SYS_SIGLIST_MISSING */
a10c0d36 377
c1ace5b5 378#endif /* no DEFS_H */
This page took 0.055218 seconds and 4 git commands to generate.