Commit | Line | Data |
---|---|---|
9846de1b | 1 | /* *INDENT-OFF* */ /* ATTR_FORMAT confuses indent, avoid running it for now */ |
c906108c | 2 | /* Basic, host-specific, and target-specific definitions for GDB. |
d9fcf2fb | 3 | Copyright (C) 1986, 1989, 1991-1996, 1998-2000 |
c906108c SS |
4 | Free Software Foundation, Inc. |
5 | ||
c5aa993b | 6 | This file is part of GDB. |
c906108c | 7 | |
c5aa993b JM |
8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2 of the License, or | |
11 | (at your option) any later version. | |
c906108c | 12 | |
c5aa993b JM |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
c906108c | 17 | |
c5aa993b JM |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 59 Temple Place - Suite 330, | |
21 | Boston, MA 02111-1307, USA. */ | |
c906108c SS |
22 | |
23 | #ifndef DEFS_H | |
24 | #define DEFS_H | |
25 | ||
26 | #include "config.h" /* Generated by configure */ | |
27 | #include <stdio.h> | |
28 | #include <errno.h> /* System call error return status */ | |
29 | #include <limits.h> | |
30 | ||
31 | #ifdef HAVE_STDDEF_H | |
917317f4 | 32 | #include <stddef.h> |
c906108c | 33 | #else |
917317f4 | 34 | #include <sys/types.h> /* for size_t */ |
c906108c SS |
35 | #endif |
36 | ||
104c1213 JM |
37 | #ifdef HAVE_UNISTD_H |
38 | #include <unistd.h> | |
39 | #endif | |
40 | ||
c906108c SS |
41 | /* Just in case they're not defined in stdio.h. */ |
42 | ||
43 | #ifndef SEEK_SET | |
44 | #define SEEK_SET 0 | |
45 | #endif | |
46 | #ifndef SEEK_CUR | |
47 | #define SEEK_CUR 1 | |
48 | #endif | |
49 | ||
50 | /* First include ansidecl.h so we can use the various macro definitions | |
51 | here and in all subsequent file inclusions. */ | |
52 | ||
53 | #include "ansidecl.h" | |
54 | ||
917317f4 | 55 | #include <stdarg.h> /* for va_list */ |
c906108c SS |
56 | |
57 | #include "libiberty.h" | |
58 | ||
c906108c SS |
59 | #include "progress.h" |
60 | ||
61 | #ifdef USE_MMALLOC | |
62 | #include "mmalloc.h" | |
63 | #endif | |
64 | ||
65 | /* For BFD64 and bfd_vma. */ | |
66 | #include "bfd.h" | |
67 | ||
6166d547 AC |
68 | |
69 | /* The target is partially multi-arched. Both "tm.h" and the | |
70 | multi-arch vector provide definitions. "tm.h" normally overrides | |
71 | the multi-arch vector (but there are a few exceptions). */ | |
72 | ||
73 | #define GDB_MULTI_ARCH_PARTIAL 1 | |
74 | ||
75 | /* The target is multi-arched. The MULTI-ARCH vector provides all | |
76 | definitions. "tm.h" is included and may provide definitions of | |
77 | non- multi-arch macros.. */ | |
78 | ||
79 | #define GDB_MULTI_ARCH_TM 2 | |
80 | ||
81 | /* The target is pure multi-arch. The MULTI-ARCH vector provides all | |
82 | definitions. "tm.h" is NOT included. */ | |
83 | ||
84 | #define GDB_MULTI_ARCH_PURE 3 | |
85 | ||
86 | ||
87 | ||
c906108c SS |
88 | /* An address in the program being debugged. Host byte order. Rather |
89 | than duplicate all the logic in BFD which figures out what type | |
90 | this is (long, long long, etc.) and whether it needs to be 64 | |
91 | bits (the host/target interactions are subtle), we just use | |
92 | bfd_vma. */ | |
93 | ||
94 | typedef bfd_vma CORE_ADDR; | |
95 | ||
104c1213 JM |
96 | /* This is to make sure that LONGEST is at least as big as CORE_ADDR. */ |
97 | ||
98 | #ifndef LONGEST | |
99 | ||
100 | #ifdef BFD64 | |
101 | ||
102 | #define LONGEST BFD_HOST_64_BIT | |
103 | #define ULONGEST BFD_HOST_U_64_BIT | |
104 | ||
105 | #else /* No BFD64 */ | |
106 | ||
917317f4 JM |
107 | #ifdef CC_HAS_LONG_LONG |
108 | #define LONGEST long long | |
109 | #define ULONGEST unsigned long long | |
110 | #else | |
111 | #ifdef BFD_HOST_64_BIT | |
104c1213 JM |
112 | /* BFD_HOST_64_BIT is defined for some hosts that don't have long long |
113 | (e.g. i386-windows) so try it. */ | |
917317f4 JM |
114 | #define LONGEST BFD_HOST_64_BIT |
115 | #define ULONGEST BFD_HOST_U_64_BIT | |
116 | #else | |
117 | #define LONGEST long | |
118 | #define ULONGEST unsigned long | |
119 | #endif | |
120 | #endif | |
104c1213 JM |
121 | |
122 | #endif /* No BFD64 */ | |
123 | ||
124 | #endif /* ! LONGEST */ | |
125 | ||
c906108c SS |
126 | #ifndef min |
127 | #define min(a, b) ((a) < (b) ? (a) : (b)) | |
128 | #endif | |
129 | #ifndef max | |
130 | #define max(a, b) ((a) > (b) ? (a) : (b)) | |
131 | #endif | |
132 | ||
1a0559af AC |
133 | /* Macros to do string compares. |
134 | ||
135 | NOTE: cagney/2000-03-14: | |
136 | ||
137 | While old code can continue to refer to these macros, new code is | |
138 | probably better off using strcmp() directly vis: ``strcmp() == 0'' | |
139 | and ``strcmp() != 0''. | |
140 | ||
141 | This is because modern compilers can directly inline strcmp() | |
142 | making the original justification for these macros - avoid function | |
143 | call overhead by pre-testing the first characters | |
144 | (``*X==*Y?...:0'') - redundant. | |
145 | ||
146 | ``Even if [...] testing the first character does have a modest | |
147 | performance improvement, I'd rather that whenever a performance | |
148 | issue is found that we spend the effort on algorithmic | |
149 | optimizations than micro-optimizing.'' J.T. */ | |
c906108c SS |
150 | |
151 | #define STRCMP(a,b) (*(a) == *(b) ? strcmp ((a), (b)) : (int)*(a) - (int)*(b)) | |
152 | #define STREQ(a,b) (*(a) == *(b) ? !strcmp ((a), (b)) : 0) | |
153 | #define STREQN(a,b,c) (*(a) == *(b) ? !strncmp ((a), (b), (c)) : 0) | |
154 | ||
155 | /* The character GNU C++ uses to build identifiers that must be unique from | |
156 | the program's identifiers (such as $this and $$vptr). */ | |
157 | #define CPLUS_MARKER '$' /* May be overridden to '.' for SysV */ | |
158 | ||
159 | /* Check if a character is one of the commonly used C++ marker characters. */ | |
917317f4 | 160 | extern int is_cplus_marker (int); |
c906108c SS |
161 | |
162 | /* use tui interface if non-zero */ | |
163 | extern int tui_version; | |
164 | ||
165 | #if defined(TUI) | |
166 | /* all invocations of TUIDO should have two sets of parens */ | |
167 | #define TUIDO(x) tuiDo x | |
168 | #else | |
169 | #define TUIDO(x) | |
170 | #endif | |
171 | ||
172 | /* enable xdb commands if set */ | |
173 | extern int xdb_commands; | |
174 | ||
175 | /* enable dbx commands if set */ | |
176 | extern int dbx_commands; | |
177 | ||
178 | extern int quit_flag; | |
179 | extern int immediate_quit; | |
180 | extern int sevenbit_strings; | |
181 | ||
917317f4 | 182 | extern void quit (void); |
c906108c | 183 | |
1a0559af AC |
184 | /* FIXME: cagney/2000-03-13: It has been suggested that the peformance |
185 | benefits of having a ``QUIT'' macro rather than a function are | |
186 | marginal. If the overhead of a QUIT function call is proving | |
187 | significant then its calling frequency should probably be reduced | |
188 | [kingdon]. A profile analyzing the current situtation is | |
189 | needed. */ | |
190 | ||
c906108c SS |
191 | #ifdef QUIT |
192 | /* do twice to force compiler warning */ | |
193 | #define QUIT_FIXME "FIXME" | |
194 | #define QUIT_FIXME "ignoring redefinition of QUIT" | |
195 | #else | |
196 | #define QUIT { \ | |
197 | if (quit_flag) quit (); \ | |
198 | if (interactive_hook) interactive_hook (); \ | |
199 | PROGRESS (1); \ | |
200 | } | |
201 | #endif | |
202 | ||
c906108c SS |
203 | /* Languages represented in the symbol table and elsewhere. |
204 | This should probably be in language.h, but since enum's can't | |
205 | be forward declared to satisfy opaque references before their | |
206 | actual definition, needs to be here. */ | |
207 | ||
917317f4 JM |
208 | enum language |
209 | { | |
210 | language_unknown, /* Language not known */ | |
211 | language_auto, /* Placeholder for automatic setting */ | |
212 | language_c, /* C */ | |
213 | language_cplus, /* C++ */ | |
214 | language_java, /* Java */ | |
215 | language_chill, /* Chill */ | |
216 | language_fortran, /* Fortran */ | |
217 | language_m2, /* Modula-2 */ | |
218 | language_asm, /* Assembly language */ | |
750ba382 PM |
219 | language_scm, /* Scheme / Guile */ |
220 | language_pascal /* Pascal */ | |
917317f4 | 221 | }; |
c906108c SS |
222 | |
223 | enum precision_type | |
917317f4 JM |
224 | { |
225 | single_precision, | |
226 | double_precision, | |
227 | unspecified_precision | |
228 | }; | |
229 | ||
c906108c SS |
230 | /* the cleanup list records things that have to be undone |
231 | if an error happens (descriptors to be closed, memory to be freed, etc.) | |
232 | Each link in the chain records a function to call and an | |
233 | argument to give it. | |
234 | ||
235 | Use make_cleanup to add an element to the cleanup chain. | |
236 | Use do_cleanups to do all cleanup actions back to a given | |
237 | point in the chain. Use discard_cleanups to remove cleanups | |
238 | from the chain back to a given point, not doing them. */ | |
239 | ||
240 | struct cleanup | |
917317f4 JM |
241 | { |
242 | struct cleanup *next; | |
243 | void (*function) (PTR); | |
244 | PTR arg; | |
245 | }; | |
c906108c SS |
246 | |
247 | ||
248 | /* The ability to declare that a function never returns is useful, but | |
249 | not really required to compile GDB successfully, so the NORETURN and | |
250 | ATTR_NORETURN macros normally expand into nothing. */ | |
251 | ||
252 | /* If compiling with older versions of GCC, a function may be declared | |
253 | "volatile" to indicate that it does not return. */ | |
254 | ||
255 | #ifndef NORETURN | |
917317f4 | 256 | #if defined(__GNUC__) \ |
c906108c | 257 | && (__GNUC__ == 1 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)) |
917317f4 JM |
258 | #define NORETURN volatile |
259 | #else | |
260 | #define NORETURN /* nothing */ | |
261 | #endif | |
c906108c SS |
262 | #endif |
263 | ||
264 | /* GCC 2.5 and later versions define a function attribute "noreturn", | |
265 | which is the preferred way to declare that a function never returns. | |
266 | However GCC 2.7 appears to be the first version in which this fully | |
267 | works everywhere we use it. */ | |
268 | ||
269 | #ifndef ATTR_NORETURN | |
7d418785 | 270 | #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) |
917317f4 JM |
271 | #define ATTR_NORETURN __attribute__ ((noreturn)) |
272 | #else | |
273 | #define ATTR_NORETURN /* nothing */ | |
274 | #endif | |
c906108c SS |
275 | #endif |
276 | ||
277 | #ifndef ATTR_FORMAT | |
7d418785 | 278 | #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 4)) |
917317f4 JM |
279 | #define ATTR_FORMAT(type, x, y) __attribute__ ((format(type, x, y))) |
280 | #else | |
281 | #define ATTR_FORMAT(type, x, y) /* nothing */ | |
282 | #endif | |
c906108c SS |
283 | #endif |
284 | ||
285 | /* Needed for various prototypes */ | |
286 | ||
c906108c SS |
287 | struct symtab; |
288 | struct breakpoint; | |
c906108c SS |
289 | |
290 | /* From blockframe.c */ | |
291 | ||
917317f4 | 292 | extern int inside_entry_func (CORE_ADDR); |
c906108c | 293 | |
917317f4 | 294 | extern int inside_entry_file (CORE_ADDR addr); |
c906108c | 295 | |
917317f4 | 296 | extern int inside_main_func (CORE_ADDR pc); |
c906108c SS |
297 | |
298 | /* From ch-lang.c, for the moment. (FIXME) */ | |
299 | ||
917317f4 | 300 | extern char *chill_demangle (const char *); |
c906108c SS |
301 | |
302 | /* From utils.c */ | |
303 | ||
917317f4 | 304 | extern void initialize_utils (void); |
392a587b | 305 | |
917317f4 | 306 | extern void notice_quit (void); |
c906108c | 307 | |
917317f4 | 308 | extern int strcmp_iw (const char *, const char *); |
c906108c | 309 | |
917317f4 | 310 | extern int subset_compare (char *, char *); |
7a292a7a | 311 | |
917317f4 | 312 | extern char *safe_strerror (int); |
c906108c | 313 | |
917317f4 | 314 | extern void init_malloc (void *); |
c906108c | 315 | |
917317f4 | 316 | extern void request_quit (int); |
c906108c | 317 | |
917317f4 JM |
318 | extern void do_cleanups (struct cleanup *); |
319 | extern void do_final_cleanups (struct cleanup *); | |
320 | extern void do_my_cleanups (struct cleanup **, struct cleanup *); | |
321 | extern void do_run_cleanups (struct cleanup *); | |
322 | extern void do_exec_cleanups (struct cleanup *); | |
323 | extern void do_exec_error_cleanups (struct cleanup *); | |
c906108c | 324 | |
917317f4 JM |
325 | extern void discard_cleanups (struct cleanup *); |
326 | extern void discard_final_cleanups (struct cleanup *); | |
327 | extern void discard_exec_error_cleanups (struct cleanup *); | |
328 | extern void discard_my_cleanups (struct cleanup **, struct cleanup *); | |
c906108c | 329 | |
e4005526 AC |
330 | /* NOTE: cagney/2000-03-04: This typedef is strictly for the |
331 | make_cleanup function declarations below. Do not use this typedef | |
332 | as a cast when passing functions into the make_cleanup() code. | |
333 | Instead either use a bounce function or add a wrapper function. | |
334 | Calling a f(char*) function with f(void*) is non-portable. */ | |
335 | typedef void (make_cleanup_ftype) (void *); | |
336 | ||
337 | extern struct cleanup *make_cleanup (make_cleanup_ftype *, void *); | |
c906108c | 338 | |
917317f4 | 339 | extern struct cleanup *make_cleanup_freeargv (char **); |
7a292a7a | 340 | |
d9fcf2fb JM |
341 | struct ui_file; |
342 | extern struct cleanup *make_cleanup_ui_file_delete (struct ui_file *); | |
11cf8741 | 343 | |
f5ff8c83 AC |
344 | extern struct cleanup *make_cleanup_close (int fd); |
345 | ||
5c65bbb6 AC |
346 | extern struct cleanup *make_cleanup_bfd_close (bfd *abfd); |
347 | ||
e4005526 | 348 | extern struct cleanup *make_final_cleanup (make_cleanup_ftype *, void *); |
c906108c | 349 | |
917317f4 | 350 | extern struct cleanup *make_my_cleanup (struct cleanup **, |
e4005526 | 351 | make_cleanup_ftype *, void *); |
c906108c | 352 | |
e4005526 | 353 | extern struct cleanup *make_run_cleanup (make_cleanup_ftype *, void *); |
c906108c | 354 | |
e4005526 AC |
355 | extern struct cleanup *make_exec_cleanup (make_cleanup_ftype *, void *); |
356 | extern struct cleanup *make_exec_error_cleanup (make_cleanup_ftype *, void *); | |
43ff13b4 | 357 | |
917317f4 JM |
358 | extern struct cleanup *save_cleanups (void); |
359 | extern struct cleanup *save_final_cleanups (void); | |
360 | extern struct cleanup *save_my_cleanups (struct cleanup **); | |
c906108c | 361 | |
917317f4 JM |
362 | extern void restore_cleanups (struct cleanup *); |
363 | extern void restore_final_cleanups (struct cleanup *); | |
364 | extern void restore_my_cleanups (struct cleanup **, struct cleanup *); | |
c906108c | 365 | |
2f9429ae | 366 | extern void free_current_contents (void *); |
c906108c | 367 | |
e54a9244 | 368 | extern void null_cleanup (void *); |
c906108c | 369 | |
917317f4 | 370 | extern int myread (int, char *, int); |
c906108c | 371 | |
917317f4 | 372 | extern int query (char *, ...) ATTR_FORMAT (printf, 1, 2); |
c906108c SS |
373 | |
374 | #if !defined (USE_MMALLOC) | |
082faf24 AC |
375 | /* NOTE: cagney/2000-03-04: The mmalloc functions need to use PTR |
376 | rather than void* so that they are consistent with | |
377 | ../mmalloc/mmalloc.h. */ | |
378 | extern PTR mcalloc (PTR, size_t, size_t); | |
917317f4 JM |
379 | extern PTR mmalloc (PTR, size_t); |
380 | extern PTR mrealloc (PTR, PTR, size_t); | |
381 | extern void mfree (PTR, PTR); | |
c906108c SS |
382 | #endif |
383 | ||
917317f4 | 384 | extern void init_page_info (void); |
392a587b | 385 | |
ac2e2ef7 AC |
386 | extern CORE_ADDR host_pointer_to_address (void *ptr); |
387 | extern void *address_to_host_pointer (CORE_ADDR addr); | |
388 | ||
c906108c SS |
389 | /* From demangle.c */ |
390 | ||
917317f4 | 391 | extern void set_demangling_style (char *); |
c906108c SS |
392 | |
393 | /* From tm.h */ | |
394 | ||
395 | struct type; | |
917317f4 | 396 | typedef int (use_struct_convention_fn) (int gcc_p, struct type * value_type); |
c906108c SS |
397 | extern use_struct_convention_fn generic_use_struct_convention; |
398 | ||
917317f4 | 399 | typedef unsigned char *(breakpoint_from_pc_fn) (CORE_ADDR * pcptr, int *lenptr); |
c906108c SS |
400 | \f |
401 | /* Annotation stuff. */ | |
402 | ||
917317f4 | 403 | extern int annotation_level; /* in stack.c */ |
c906108c | 404 | \f |
917317f4 | 405 | extern void begin_line (void); |
c906108c | 406 | |
917317f4 | 407 | extern void wrap_here (char *); |
c906108c | 408 | |
917317f4 | 409 | extern void reinitialize_more_filter (void); |
c906108c | 410 | |
0f71a2f6 | 411 | /* Normal results */ |
d9fcf2fb | 412 | extern struct ui_file *gdb_stdout; |
0f71a2f6 | 413 | /* Serious error notifications */ |
d9fcf2fb | 414 | extern struct ui_file *gdb_stderr; |
0f71a2f6 JM |
415 | /* Log/debug/trace messages that should bypass normal stdout/stderr |
416 | filtering. For momement, always call this stream using | |
417 | *_unfiltered. In the very near future that restriction shall be | |
418 | removed - either call shall be unfiltered. (cagney 1999-06-13). */ | |
d9fcf2fb | 419 | extern struct ui_file *gdb_stdlog; |
43ff13b4 JM |
420 | /* Target output that should bypass normal stdout/stderr filtering. |
421 | For momement, always call this stream using *_unfiltered. In the | |
422 | very near future that restriction shall be removed - either call | |
423 | shall be unfiltered. (cagney 1999-07-02). */ | |
d9fcf2fb | 424 | extern struct ui_file *gdb_stdtarg; |
c906108c | 425 | |
c906108c SS |
426 | #if defined(TUI) |
427 | #include "tui.h" | |
428 | #include "tuiCommand.h" | |
429 | #include "tuiData.h" | |
430 | #include "tuiIO.h" | |
431 | #include "tuiLayout.h" | |
432 | #include "tuiWin.h" | |
433 | #endif | |
434 | ||
d9fcf2fb | 435 | #include "ui-file.h" |
c906108c | 436 | |
917317f4 | 437 | /* More generic printf like operations */ |
c906108c | 438 | |
d9fcf2fb | 439 | extern void fputs_filtered (const char *, struct ui_file *); |
c906108c | 440 | |
d9fcf2fb | 441 | extern void fputs_unfiltered (const char *, struct ui_file *); |
c906108c | 442 | |
d9fcf2fb | 443 | extern int fputc_filtered (int c, struct ui_file *); |
c906108c | 444 | |
d9fcf2fb | 445 | extern int fputc_unfiltered (int c, struct ui_file *); |
c906108c | 446 | |
917317f4 | 447 | extern int putchar_unfiltered (int c); |
c906108c | 448 | |
917317f4 | 449 | extern void puts_filtered (const char *); |
c906108c | 450 | |
917317f4 | 451 | extern void puts_unfiltered (const char *); |
c906108c | 452 | |
917317f4 | 453 | extern void puts_debug (char *prefix, char *string, char *suffix); |
c906108c | 454 | |
917317f4 | 455 | extern void vprintf_filtered (const char *, va_list) ATTR_FORMAT (printf, 1, 0); |
c906108c | 456 | |
d9fcf2fb | 457 | extern void vfprintf_filtered (struct ui_file *, const char *, va_list) ATTR_FORMAT (printf, 2, 0); |
c906108c | 458 | |
d9fcf2fb | 459 | extern void fprintf_filtered (struct ui_file *, const char *, ...) ATTR_FORMAT (printf, 2, 3); |
c906108c | 460 | |
d9fcf2fb | 461 | extern void fprintfi_filtered (int, struct ui_file *, const char *, ...) ATTR_FORMAT (printf, 3, 4); |
c906108c | 462 | |
917317f4 | 463 | extern void printf_filtered (const char *, ...) ATTR_FORMAT (printf, 1, 2); |
c906108c | 464 | |
917317f4 | 465 | extern void printfi_filtered (int, const char *, ...) ATTR_FORMAT (printf, 2, 3); |
c906108c | 466 | |
917317f4 | 467 | extern void vprintf_unfiltered (const char *, va_list) ATTR_FORMAT (printf, 1, 0); |
c906108c | 468 | |
d9fcf2fb | 469 | extern void vfprintf_unfiltered (struct ui_file *, const char *, va_list) ATTR_FORMAT (printf, 2, 0); |
c906108c | 470 | |
d9fcf2fb | 471 | extern void fprintf_unfiltered (struct ui_file *, const char *, ...) ATTR_FORMAT (printf, 2, 3); |
917317f4 JM |
472 | |
473 | extern void printf_unfiltered (const char *, ...) ATTR_FORMAT (printf, 1, 2); | |
c906108c | 474 | |
d9fcf2fb | 475 | extern void print_spaces (int, struct ui_file *); |
c906108c | 476 | |
d9fcf2fb | 477 | extern void print_spaces_filtered (int, struct ui_file *); |
c906108c | 478 | |
917317f4 | 479 | extern char *n_spaces (int); |
c906108c | 480 | |
d9fcf2fb | 481 | extern void fputstr_filtered (const char *str, int quotr, struct ui_file * stream); |
43e526b9 | 482 | |
d9fcf2fb | 483 | extern void fputstr_unfiltered (const char *str, int quotr, struct ui_file * stream); |
43e526b9 | 484 | |
d9fcf2fb | 485 | extern void fputstrn_unfiltered (const char *str, int n, int quotr, struct ui_file * stream); |
c906108c | 486 | |
d4f3574e | 487 | /* Display the host ADDR on STREAM formatted as ``0x%x''. */ |
d9fcf2fb | 488 | extern void gdb_print_host_address (void *addr, struct ui_file *stream); |
c906108c | 489 | |
104c1213 JM |
490 | /* Convert a CORE_ADDR into a HEX string. paddr() is like %08lx. |
491 | paddr_nz() is like %lx. paddr_u() is like %lu. paddr_width() is | |
492 | for ``%*''. */ | |
d4f3574e | 493 | extern int strlen_paddr (void); |
917317f4 JM |
494 | extern char *paddr (CORE_ADDR addr); |
495 | extern char *paddr_nz (CORE_ADDR addr); | |
496 | extern char *paddr_u (CORE_ADDR addr); | |
497 | extern char *paddr_d (LONGEST addr); | |
c906108c | 498 | |
5683e87a AC |
499 | extern char *phex (ULONGEST l, int sizeof_l); |
500 | extern char *phex_nz (ULONGEST l, int sizeof_l); | |
c906108c | 501 | |
d9fcf2fb | 502 | extern void fprintf_symbol_filtered (struct ui_file *, char *, |
917317f4 | 503 | enum language, int); |
c906108c | 504 | |
917317f4 | 505 | extern NORETURN void perror_with_name (char *) ATTR_NORETURN; |
c906108c | 506 | |
917317f4 | 507 | extern void print_sys_errmsg (char *, int); |
c906108c SS |
508 | |
509 | /* From regex.c or libc. BSD 4.4 declares this with the argument type as | |
510 | "const char *" in unistd.h, so we can't declare the argument | |
511 | as "char *". */ | |
512 | ||
917317f4 | 513 | extern char *re_comp (const char *); |
c906108c SS |
514 | |
515 | /* From symfile.c */ | |
516 | ||
917317f4 JM |
517 | extern void symbol_file_command (char *, int); |
518 | ||
519 | /* Remote targets may wish to use this as their load function. */ | |
520 | extern void generic_load (char *name, int from_tty); | |
521 | ||
522 | /* Summarise a download */ | |
d9fcf2fb | 523 | extern void print_transfer_performance (struct ui_file *stream, |
917317f4 JM |
524 | unsigned long data_count, |
525 | unsigned long write_count, | |
526 | unsigned long time_count); | |
c906108c SS |
527 | |
528 | /* From top.c */ | |
529 | ||
6426a772 JM |
530 | typedef void initialize_file_ftype (void); |
531 | ||
917317f4 | 532 | extern char *skip_quoted (char *); |
c906108c | 533 | |
917317f4 | 534 | extern char *gdb_readline (char *); |
c906108c | 535 | |
917317f4 | 536 | extern char *command_line_input (char *, int, char *); |
c906108c | 537 | |
917317f4 | 538 | extern void print_prompt (void); |
c906108c | 539 | |
917317f4 | 540 | extern int input_from_terminal_p (void); |
c906108c SS |
541 | |
542 | extern int info_verbose; | |
543 | ||
544 | /* From printcmd.c */ | |
545 | ||
917317f4 | 546 | extern void set_next_address (CORE_ADDR); |
c906108c | 547 | |
d9fcf2fb | 548 | extern void print_address_symbolic (CORE_ADDR, struct ui_file *, int, |
917317f4 | 549 | char *); |
c906108c | 550 | |
dfcd3bfb | 551 | extern int build_address_symbolic (CORE_ADDR addr, |
7b83ea04 AC |
552 | int do_demangle, |
553 | char **name, | |
554 | int *offset, | |
555 | char **filename, | |
556 | int *line, | |
dfcd3bfb JM |
557 | int *unmapped); |
558 | ||
d9fcf2fb | 559 | extern void print_address_numeric (CORE_ADDR, int, struct ui_file *); |
c906108c | 560 | |
d9fcf2fb | 561 | extern void print_address (CORE_ADDR, struct ui_file *); |
c906108c SS |
562 | |
563 | /* From source.c */ | |
564 | ||
917317f4 | 565 | extern int openp (char *, int, char *, int, int, char **); |
c906108c | 566 | |
917317f4 | 567 | extern int source_full_path_of (char *, char **); |
c906108c | 568 | |
917317f4 | 569 | extern void mod_path (char *, char **); |
c906108c | 570 | |
917317f4 | 571 | extern void directory_command (char *, int); |
c906108c | 572 | |
917317f4 | 573 | extern void init_source_path (void); |
c906108c | 574 | |
917317f4 | 575 | extern char *symtab_to_filename (struct symtab *); |
c906108c | 576 | |
104c1213 JM |
577 | /* From exec.c */ |
578 | ||
579 | extern void exec_set_section_offsets (bfd_signed_vma text_off, | |
580 | bfd_signed_vma data_off, | |
581 | bfd_signed_vma bss_off); | |
582 | ||
c906108c SS |
583 | /* From findvar.c */ |
584 | ||
917317f4 | 585 | extern int read_relative_register_raw_bytes (int, char *); |
c906108c | 586 | |
53a5351d JM |
587 | /* Possible lvalue types. Like enum language, this should be in |
588 | value.h, but needs to be here for the same reason. */ | |
589 | ||
590 | enum lval_type | |
591 | { | |
592 | /* Not an lval. */ | |
593 | not_lval, | |
594 | /* In memory. Could be a saved register. */ | |
595 | lval_memory, | |
596 | /* In a register. */ | |
597 | lval_register, | |
598 | /* In a gdb internal variable. */ | |
599 | lval_internalvar, | |
600 | /* Part of a gdb internal variable (structure field). */ | |
601 | lval_internalvar_component, | |
602 | /* In a register series in a frame not the current one, which may have been | |
603 | partially saved or saved in different places (otherwise would be | |
604 | lval_register or lval_memory). */ | |
605 | lval_reg_frame_relative | |
606 | }; | |
607 | ||
392a587b | 608 | struct frame_info; |
53a5351d | 609 | |
c906108c SS |
610 | /* From readline (but not in any readline .h files). */ |
611 | ||
917317f4 | 612 | extern char *tilde_expand (char *); |
c906108c SS |
613 | |
614 | /* Control types for commands */ | |
615 | ||
616 | enum misc_command_type | |
917317f4 JM |
617 | { |
618 | ok_command, | |
619 | end_command, | |
620 | else_command, | |
621 | nop_command | |
622 | }; | |
c906108c SS |
623 | |
624 | enum command_control_type | |
917317f4 JM |
625 | { |
626 | simple_control, | |
627 | break_control, | |
628 | continue_control, | |
629 | while_control, | |
630 | if_control, | |
631 | invalid_control | |
632 | }; | |
c906108c SS |
633 | |
634 | /* Structure for saved commands lines | |
635 | (for breakpoints, defined commands, etc). */ | |
636 | ||
637 | struct command_line | |
917317f4 JM |
638 | { |
639 | struct command_line *next; | |
640 | char *line; | |
641 | enum command_control_type control_type; | |
642 | int body_count; | |
643 | struct command_line **body_list; | |
644 | }; | |
c906108c | 645 | |
917317f4 | 646 | extern struct command_line *read_command_lines (char *, int); |
c906108c | 647 | |
917317f4 | 648 | extern void free_command_lines (struct command_line **); |
c906108c | 649 | |
7b83ea04 AC |
650 | /* To continue the execution commands when running gdb asynchronously. |
651 | A continuation structure contains a pointer to a function to be called | |
43ff13b4 JM |
652 | to finish the command, once the target has stopped. Such mechanism is |
653 | used bt the finish and until commands, and in the remote protocol | |
654 | when opening an extended-remote connection. */ | |
655 | ||
656 | struct continuation_arg | |
917317f4 JM |
657 | { |
658 | struct continuation_arg *next; | |
57e687d9 MS |
659 | union continuation_data { |
660 | void *pointer; | |
661 | int integer; | |
662 | long longint; | |
663 | } data; | |
917317f4 | 664 | }; |
43ff13b4 JM |
665 | |
666 | struct continuation | |
917317f4 JM |
667 | { |
668 | void (*continuation_hook) (struct continuation_arg *); | |
669 | struct continuation_arg *arg_list; | |
670 | struct continuation *next; | |
671 | }; | |
672 | struct continuation continuation; | |
43ff13b4 JM |
673 | |
674 | /* In infrun.c. */ | |
675 | extern struct continuation *cmd_continuation; | |
c2d11a7d JM |
676 | /* Used only by the step_1 function. */ |
677 | extern struct continuation *intermediate_continuation; | |
43ff13b4 JM |
678 | |
679 | /* From utils.c */ | |
917317f4 JM |
680 | extern void add_continuation (void (*)(struct continuation_arg *), |
681 | struct continuation_arg *); | |
682 | extern void do_all_continuations (void); | |
683 | extern void discard_all_continuations (void); | |
43ff13b4 | 684 | |
c2d11a7d JM |
685 | extern void add_intermediate_continuation (void (*)(struct continuation_arg *), |
686 | struct continuation_arg *); | |
687 | extern void do_all_intermediate_continuations (void); | |
688 | extern void discard_all_intermediate_continuations (void); | |
689 | ||
c906108c SS |
690 | /* String containing the current directory (what getwd would return). */ |
691 | ||
692 | extern char *current_directory; | |
693 | ||
694 | /* Default radixes for input and output. Only some values supported. */ | |
695 | extern unsigned input_radix; | |
696 | extern unsigned output_radix; | |
697 | ||
698 | /* Possibilities for prettyprint parameters to routines which print | |
699 | things. Like enum language, this should be in value.h, but needs | |
700 | to be here for the same reason. FIXME: If we can eliminate this | |
701 | as an arg to LA_VAL_PRINT, then we can probably move it back to | |
702 | value.h. */ | |
703 | ||
704 | enum val_prettyprint | |
917317f4 JM |
705 | { |
706 | Val_no_prettyprint = 0, | |
707 | Val_prettyprint, | |
708 | /* Use the default setting which the user has specified. */ | |
709 | Val_pretty_default | |
710 | }; | |
c906108c | 711 | \f |
917317f4 | 712 | |
c906108c SS |
713 | /* Host machine definition. This will be a symlink to one of the |
714 | xm-*.h files, built by the `configure' script. */ | |
715 | ||
716 | #include "xm.h" | |
717 | ||
718 | /* Native machine support. This will be a symlink to one of the | |
719 | nm-*.h files, built by the `configure' script. */ | |
720 | ||
721 | #include "nm.h" | |
722 | ||
723 | /* Target machine definition. This will be a symlink to one of the | |
724 | tm-*.h files, built by the `configure' script. */ | |
725 | ||
6166d547 | 726 | #if (GDB_MULTI_ARCH < GDB_MULTI_ARCH_PURE) |
c906108c | 727 | #include "tm.h" |
6166d547 AC |
728 | #endif |
729 | ||
730 | /* GDB_MULTI_ARCH is normally set by configure.in using information | |
731 | from configure.tgt or the config/%/%.mt Makefile fragment. Since | |
732 | some targets have defined it in their tm.h file, don't provide a | |
733 | default until after "tm.h" has been included. (In the above #if, | |
734 | GDB_MULTI_ARCH will be interpreted as zero if it is not | |
735 | defined). */ | |
736 | ||
737 | #ifndef GDB_MULTI_ARCH | |
738 | #define GDB_MULTI_ARCH 0 | |
739 | #endif | |
740 | ||
c906108c SS |
741 | |
742 | /* If the xm.h file did not define the mode string used to open the | |
743 | files, assume that binary files are opened the same way as text | |
744 | files */ | |
745 | #ifndef FOPEN_RB | |
746 | #include "fopen-same.h" | |
747 | #endif | |
748 | ||
749 | /* Microsoft C can't deal with const pointers */ | |
750 | ||
751 | #ifdef _MSC_VER | |
752 | #define CONST_PTR | |
753 | #else | |
754 | #define CONST_PTR const | |
755 | #endif | |
756 | ||
757 | /* | |
758 | * Allow things in gdb to be declared "volatile". If compiling ANSI, it | |
759 | * just works. If compiling with gcc but non-ansi, redefine to __volatile__. | |
760 | * If non-ansi, non-gcc, then eliminate "volatile" entirely, making those | |
761 | * objects be read-write rather than read-only. | |
762 | */ | |
763 | ||
764 | #ifndef volatile | |
765 | #ifndef __STDC__ | |
917317f4 JM |
766 | #ifdef __GNUC__ |
767 | #define volatile __volatile__ | |
768 | #else | |
769 | #define volatile /* nothing */ | |
770 | #endif /* GNUC */ | |
c906108c SS |
771 | #endif /* STDC */ |
772 | #endif /* volatile */ | |
773 | ||
774 | /* Defaults for system-wide constants (if not defined by xm.h, we fake it). | |
775 | FIXME: Assumes 2's complement arithmetic */ | |
776 | ||
777 | #if !defined (UINT_MAX) | |
917317f4 | 778 | #define UINT_MAX ((unsigned int)(~0)) /* 0xFFFFFFFF for 32-bits */ |
c906108c SS |
779 | #endif |
780 | ||
781 | #if !defined (INT_MAX) | |
917317f4 | 782 | #define INT_MAX ((int)(UINT_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */ |
c906108c SS |
783 | #endif |
784 | ||
785 | #if !defined (INT_MIN) | |
786 | #define INT_MIN ((int)((int) ~0 ^ INT_MAX)) /* 0x80000000 for 32-bits */ | |
787 | #endif | |
788 | ||
789 | #if !defined (ULONG_MAX) | |
790 | #define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF for 32-bits */ | |
791 | #endif | |
792 | ||
793 | #if !defined (LONG_MAX) | |
794 | #define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */ | |
795 | #endif | |
796 | ||
4ce44c66 JM |
797 | #if !defined (ULONGEST_MAX) |
798 | #define ULONGEST_MAX (~(ULONGEST)0) /* 0xFFFFFFFFFFFFFFFF for 32-bits */ | |
799 | #endif | |
800 | ||
801 | #if !defined (LONGEST_MAX) /* 0x7FFFFFFFFFFFFFFF for 32-bits */ | |
802 | #define LONGEST_MAX ((LONGEST)(ULONGEST_MAX >> 1)) | |
803 | #endif | |
804 | ||
c906108c SS |
805 | /* Convert a LONGEST to an int. This is used in contexts (e.g. number of |
806 | arguments to a function, number in a value history, register number, etc.) | |
807 | where the value must not be larger than can fit in an int. */ | |
808 | ||
917317f4 | 809 | extern int longest_to_int (LONGEST); |
c906108c | 810 | |
7b83ea04 | 811 | /* Assorted functions we can declare, now that const and volatile are |
c906108c SS |
812 | defined. */ |
813 | ||
917317f4 | 814 | extern char *savestring (const char *, int); |
c906108c | 815 | |
917317f4 | 816 | extern char *msavestring (void *, const char *, int); |
c906108c | 817 | |
917317f4 | 818 | extern char *strsave (const char *); |
c906108c | 819 | |
917317f4 | 820 | extern char *mstrsave (void *, const char *); |
c906108c | 821 | |
917317f4 JM |
822 | /* FIXME; was long, but this causes compile errors in msvc if already |
823 | defined */ | |
824 | #ifdef _MSC_VER | |
825 | extern PTR xmmalloc (PTR, size_t); | |
826 | extern PTR xmrealloc (PTR, PTR, size_t); | |
c906108c | 827 | #else |
917317f4 JM |
828 | extern PTR xmmalloc (PTR, long); |
829 | extern PTR xmrealloc (PTR, PTR, long); | |
c906108c SS |
830 | #endif |
831 | ||
917317f4 | 832 | extern int parse_escape (char **); |
c906108c | 833 | |
c906108c SS |
834 | /* Message to be printed before the error message, when an error occurs. */ |
835 | ||
836 | extern char *error_pre_print; | |
837 | ||
838 | /* Message to be printed before the error message, when an error occurs. */ | |
839 | ||
840 | extern char *quit_pre_print; | |
841 | ||
842 | /* Message to be printed before the warning message, when a warning occurs. */ | |
843 | ||
844 | extern char *warning_pre_print; | |
845 | ||
4ce44c66 | 846 | extern NORETURN void verror (const char *fmt, va_list ap) ATTR_NORETURN; |
c906108c | 847 | |
4ce44c66 | 848 | extern NORETURN void error (const char *fmt, ...) ATTR_NORETURN; |
c906108c | 849 | |
4ce44c66 JM |
850 | /* DEPRECATED: Use error(), verror() or error_stream(). */ |
851 | extern NORETURN void error_begin (void); | |
c906108c | 852 | |
d9fcf2fb | 853 | extern NORETURN void error_stream (struct ui_file *) ATTR_NORETURN; |
2acceee2 | 854 | |
4ce44c66 JM |
855 | /* Returns a freshly allocate buffer containing the last error |
856 | message. */ | |
917317f4 | 857 | extern char *error_last_message (void); |
2acceee2 | 858 | |
4ce44c66 JM |
859 | extern NORETURN void internal_verror (const char *, va_list ap) ATTR_NORETURN; |
860 | ||
861 | extern NORETURN void internal_error (char *, ...) ATTR_NORETURN; | |
862 | ||
917317f4 | 863 | extern NORETURN void nomem (long) ATTR_NORETURN; |
c906108c | 864 | |
99eeeb0f ND |
865 | /* Reasons for calling return_to_top_level. Note: enum value 0 is |
866 | reserved for internal use as the return value from an initial | |
867 | setjmp(). */ | |
c906108c | 868 | |
917317f4 JM |
869 | enum return_reason |
870 | { | |
871 | /* User interrupt. */ | |
99eeeb0f | 872 | RETURN_QUIT = 1, |
917317f4 JM |
873 | /* Any other error. */ |
874 | RETURN_ERROR | |
875 | }; | |
c906108c | 876 | |
43ff13b4 JM |
877 | #define ALL_CLEANUPS ((struct cleanup *)0) |
878 | ||
99eeeb0f ND |
879 | #define RETURN_MASK(reason) (1 << (int)(reason)) |
880 | #define RETURN_MASK_QUIT RETURN_MASK (RETURN_QUIT) | |
881 | #define RETURN_MASK_ERROR RETURN_MASK (RETURN_ERROR) | |
882 | #define RETURN_MASK_ALL (RETURN_MASK_QUIT | RETURN_MASK_ERROR) | |
c906108c SS |
883 | typedef int return_mask; |
884 | ||
917317f4 | 885 | extern NORETURN void return_to_top_level (enum return_reason) ATTR_NORETURN; |
c906108c | 886 | |
11cf8741 JM |
887 | /* If CATCH_ERRORS_FTYPE throws an error, catch_errors() returns zero |
888 | otherwize the result from CATCH_ERRORS_FTYPE is returned. It is | |
889 | probably useful for CATCH_ERRORS_FTYPE to always return a non-zero | |
890 | value. It's unfortunate that, catch_errors() does not return an | |
891 | indication of the exact exception that it caught - quit_flag might | |
892 | help. */ | |
893 | ||
917317f4 JM |
894 | typedef int (catch_errors_ftype) (PTR); |
895 | extern int catch_errors (catch_errors_ftype *, PTR, char *, return_mask); | |
c906108c | 896 | |
11cf8741 JM |
897 | /* Template to catch_errors() that wraps calls to command |
898 | functions. */ | |
899 | ||
900 | typedef void (catch_command_errors_ftype) (char *, int); | |
901 | extern int catch_command_errors (catch_command_errors_ftype *func, char *command, int from_tty, return_mask); | |
902 | ||
917317f4 | 903 | extern void warning_begin (void); |
c906108c | 904 | |
917317f4 | 905 | extern void warning (const char *, ...) ATTR_FORMAT (printf, 1, 2); |
c906108c SS |
906 | |
907 | /* Global functions from other, non-gdb GNU thingies. | |
908 | Libiberty thingies are no longer declared here. We include libiberty.h | |
909 | above, instead. */ | |
910 | ||
911 | #ifndef GETENV_PROVIDED | |
917317f4 | 912 | extern char *getenv (const char *); |
c906108c SS |
913 | #endif |
914 | ||
915 | /* From other system libraries */ | |
916 | ||
917 | #ifdef HAVE_STDDEF_H | |
918 | #include <stddef.h> | |
919 | #endif | |
920 | ||
921 | #ifdef HAVE_STDLIB_H | |
922 | #if defined(_MSC_VER) && !defined(__cplusplus) | |
923 | /* msvc defines these in stdlib.h for c code */ | |
924 | #undef min | |
925 | #undef max | |
926 | #endif | |
927 | #include <stdlib.h> | |
928 | #endif | |
929 | #ifndef min | |
930 | #define min(a, b) ((a) < (b) ? (a) : (b)) | |
931 | #endif | |
932 | #ifndef max | |
933 | #define max(a, b) ((a) > (b) ? (a) : (b)) | |
934 | #endif | |
935 | ||
936 | ||
937 | /* We take the address of fclose later, but some stdio's forget | |
938 | to declare this. We can't always declare it since there's | |
939 | no way to declare the parameters without upsetting some compiler | |
940 | somewhere. */ | |
941 | ||
942 | #ifndef FCLOSE_PROVIDED | |
917317f4 | 943 | extern int fclose (FILE *); |
c906108c SS |
944 | #endif |
945 | ||
946 | #ifndef atof | |
917317f4 | 947 | extern double atof (const char *); /* X3.159-1989 4.10.1.1 */ |
c906108c SS |
948 | #endif |
949 | ||
950 | #ifndef MALLOC_INCOMPATIBLE | |
951 | ||
952 | #ifdef NEED_DECLARATION_MALLOC | |
953 | extern PTR malloc (); | |
954 | #endif | |
955 | ||
956 | #ifdef NEED_DECLARATION_REALLOC | |
957 | extern PTR realloc (); | |
958 | #endif | |
959 | ||
960 | #ifdef NEED_DECLARATION_FREE | |
961 | extern void free (); | |
962 | #endif | |
963 | ||
964 | #endif /* MALLOC_INCOMPATIBLE */ | |
965 | ||
966 | /* Various possibilities for alloca. */ | |
967 | #ifndef alloca | |
917317f4 JM |
968 | #ifdef __GNUC__ |
969 | #define alloca __builtin_alloca | |
970 | #else /* Not GNU C */ | |
971 | #ifdef HAVE_ALLOCA_H | |
972 | #include <alloca.h> | |
973 | #else | |
974 | #ifdef _AIX | |
975 | #pragma alloca | |
976 | #else | |
c906108c SS |
977 | |
978 | /* We need to be careful not to declare this in a way which conflicts with | |
979 | bison. Bison never declares it as char *, but under various circumstances | |
980 | (like __hpux) we need to use void *. */ | |
917317f4 JM |
981 | #if defined (__STDC__) || defined (__hpux) |
982 | extern void *alloca (); | |
983 | #else /* Don't use void *. */ | |
984 | extern char *alloca (); | |
985 | #endif /* Don't use void *. */ | |
986 | #endif /* Not _AIX */ | |
987 | #endif /* Not HAVE_ALLOCA_H */ | |
988 | #endif /* Not GNU C */ | |
c906108c SS |
989 | #endif /* alloca not defined */ |
990 | ||
991 | /* HOST_BYTE_ORDER must be defined to one of these. */ | |
992 | ||
993 | #ifdef HAVE_ENDIAN_H | |
994 | #include <endian.h> | |
995 | #endif | |
996 | ||
997 | #if !defined (BIG_ENDIAN) | |
998 | #define BIG_ENDIAN 4321 | |
999 | #endif | |
1000 | ||
1001 | #if !defined (LITTLE_ENDIAN) | |
1002 | #define LITTLE_ENDIAN 1234 | |
1003 | #endif | |
1004 | ||
1005 | /* Dynamic target-system-dependent parameters for GDB. */ | |
1006 | #include "gdbarch.h" | |
33489c5b AC |
1007 | #if (GDB_MULTI_ARCH == 0) |
1008 | /* Multi-arch targets _should_ be including "arch-utils.h" directly | |
1009 | into their *-tdep.c file. This is a prop to help old non- | |
1010 | multi-arch targets to continue to compile. */ | |
1011 | #include "arch-utils.h" | |
1012 | #endif | |
c906108c SS |
1013 | |
1014 | /* Static target-system-dependent parameters for GDB. */ | |
1015 | ||
1016 | /* Number of bits in a char or unsigned char for the target machine. | |
1017 | Just like CHAR_BIT in <limits.h> but describes the target machine. */ | |
1018 | #if !defined (TARGET_CHAR_BIT) | |
1019 | #define TARGET_CHAR_BIT 8 | |
1020 | #endif | |
1021 | ||
1022 | /* Number of bits in a short or unsigned short for the target machine. */ | |
1023 | #if !defined (TARGET_SHORT_BIT) | |
1024 | #define TARGET_SHORT_BIT (2 * TARGET_CHAR_BIT) | |
1025 | #endif | |
1026 | ||
1027 | /* Number of bits in an int or unsigned int for the target machine. */ | |
1028 | #if !defined (TARGET_INT_BIT) | |
1029 | #define TARGET_INT_BIT (4 * TARGET_CHAR_BIT) | |
1030 | #endif | |
1031 | ||
1032 | /* Number of bits in a long or unsigned long for the target machine. */ | |
1033 | #if !defined (TARGET_LONG_BIT) | |
1034 | #define TARGET_LONG_BIT (4 * TARGET_CHAR_BIT) | |
1035 | #endif | |
1036 | ||
1037 | /* Number of bits in a long long or unsigned long long for the target machine. */ | |
1038 | #if !defined (TARGET_LONG_LONG_BIT) | |
1039 | #define TARGET_LONG_LONG_BIT (2 * TARGET_LONG_BIT) | |
1040 | #endif | |
1041 | ||
1042 | /* Number of bits in a float for the target machine. */ | |
1043 | #if !defined (TARGET_FLOAT_BIT) | |
1044 | #define TARGET_FLOAT_BIT (4 * TARGET_CHAR_BIT) | |
1045 | #endif | |
1046 | ||
1047 | /* Number of bits in a double for the target machine. */ | |
1048 | #if !defined (TARGET_DOUBLE_BIT) | |
1049 | #define TARGET_DOUBLE_BIT (8 * TARGET_CHAR_BIT) | |
1050 | #endif | |
1051 | ||
1052 | /* Number of bits in a long double for the target machine. */ | |
1053 | #if !defined (TARGET_LONG_DOUBLE_BIT) | |
1054 | #define TARGET_LONG_DOUBLE_BIT (2 * TARGET_DOUBLE_BIT) | |
1055 | #endif | |
1056 | ||
1057 | /* Number of bits in a pointer for the target machine */ | |
1058 | #if !defined (TARGET_PTR_BIT) | |
1059 | #define TARGET_PTR_BIT TARGET_INT_BIT | |
1060 | #endif | |
1061 | ||
c4093a6a JM |
1062 | /* Number of bits in a BFD_VMA for the target object file format. */ |
1063 | #if !defined (TARGET_BFD_VMA_BIT) | |
1064 | #define TARGET_BFD_VMA_BIT TARGET_PTR_BIT | |
1065 | #endif | |
1066 | ||
c906108c SS |
1067 | /* If we picked up a copy of CHAR_BIT from a configuration file |
1068 | (which may get it by including <limits.h>) then use it to set | |
1069 | the number of bits in a host char. If not, use the same size | |
1070 | as the target. */ | |
1071 | ||
1072 | #if defined (CHAR_BIT) | |
1073 | #define HOST_CHAR_BIT CHAR_BIT | |
1074 | #else | |
1075 | #define HOST_CHAR_BIT TARGET_CHAR_BIT | |
1076 | #endif | |
1077 | ||
1078 | /* The bit byte-order has to do just with numbering of bits in | |
1079 | debugging symbols and such. Conceptually, it's quite separate | |
1080 | from byte/word byte order. */ | |
1081 | ||
1082 | #if !defined (BITS_BIG_ENDIAN) | |
1083 | #define BITS_BIG_ENDIAN (TARGET_BYTE_ORDER == BIG_ENDIAN) | |
1084 | #endif | |
1085 | ||
1086 | /* In findvar.c. */ | |
1087 | ||
917317f4 | 1088 | extern LONGEST extract_signed_integer (void *, int); |
c906108c | 1089 | |
917317f4 | 1090 | extern ULONGEST extract_unsigned_integer (void *, int); |
c906108c | 1091 | |
917317f4 | 1092 | extern int extract_long_unsigned_integer (void *, int, LONGEST *); |
c906108c | 1093 | |
917317f4 | 1094 | extern CORE_ADDR extract_address (void *, int); |
c906108c | 1095 | |
4478b372 JB |
1096 | extern CORE_ADDR extract_typed_address (void *buf, struct type *type); |
1097 | ||
a9ac8f51 | 1098 | extern void store_signed_integer (void *, int, LONGEST); |
c906108c | 1099 | |
a9ac8f51 | 1100 | extern void store_unsigned_integer (void *, int, ULONGEST); |
c906108c | 1101 | |
a9ac8f51 | 1102 | extern void store_address (void *, int, LONGEST); |
c906108c | 1103 | |
4478b372 JB |
1104 | extern void store_typed_address (void *buf, struct type *type, CORE_ADDR addr); |
1105 | ||
c906108c SS |
1106 | /* Setup definitions for host and target floating point formats. We need to |
1107 | consider the format for `float', `double', and `long double' for both target | |
1108 | and host. We need to do this so that we know what kind of conversions need | |
1109 | to be done when converting target numbers to and from the hosts DOUBLEST | |
1110 | data type. */ | |
1111 | ||
1112 | /* This is used to indicate that we don't know the format of the floating point | |
1113 | number. Typically, this is useful for native ports, where the actual format | |
1114 | is irrelevant, since no conversions will be taking place. */ | |
1115 | ||
1116 | extern const struct floatformat floatformat_unknown; | |
1117 | ||
1118 | #if HOST_BYTE_ORDER == BIG_ENDIAN | |
917317f4 JM |
1119 | #ifndef HOST_FLOAT_FORMAT |
1120 | #define HOST_FLOAT_FORMAT &floatformat_ieee_single_big | |
1121 | #endif | |
1122 | #ifndef HOST_DOUBLE_FORMAT | |
1123 | #define HOST_DOUBLE_FORMAT &floatformat_ieee_double_big | |
1124 | #endif | |
1125 | #else /* LITTLE_ENDIAN */ | |
1126 | #ifndef HOST_FLOAT_FORMAT | |
1127 | #define HOST_FLOAT_FORMAT &floatformat_ieee_single_little | |
1128 | #endif | |
1129 | #ifndef HOST_DOUBLE_FORMAT | |
1130 | #define HOST_DOUBLE_FORMAT &floatformat_ieee_double_little | |
1131 | #endif | |
c906108c SS |
1132 | #endif |
1133 | ||
1134 | #ifndef HOST_LONG_DOUBLE_FORMAT | |
1135 | #define HOST_LONG_DOUBLE_FORMAT &floatformat_unknown | |
1136 | #endif | |
1137 | ||
c906108c SS |
1138 | /* Use `long double' if the host compiler supports it. (Note that this is not |
1139 | necessarily any longer than `double'. On SunOS/gcc, it's the same as | |
1140 | double.) This is necessary because GDB internally converts all floating | |
1141 | point values to the widest type supported by the host. | |
1142 | ||
1143 | There are problems however, when the target `long double' is longer than the | |
1144 | host's `long double'. In general, we'll probably reduce the precision of | |
1145 | any such values and print a warning. */ | |
1146 | ||
1147 | #ifdef HAVE_LONG_DOUBLE | |
1148 | typedef long double DOUBLEST; | |
1149 | #else | |
1150 | typedef double DOUBLEST; | |
1151 | #endif | |
1152 | ||
917317f4 JM |
1153 | extern void floatformat_to_doublest (const struct floatformat *, |
1154 | char *, DOUBLEST *); | |
1155 | extern void floatformat_from_doublest (const struct floatformat *, | |
1156 | DOUBLEST *, char *); | |
1157 | extern DOUBLEST extract_floating (void *, int); | |
c906108c | 1158 | |
917317f4 | 1159 | extern void store_floating (void *, int, DOUBLEST); |
c906108c SS |
1160 | \f |
1161 | /* On some machines there are bits in addresses which are not really | |
1162 | part of the address, but are used by the kernel, the hardware, etc. | |
1163 | for special purposes. ADDR_BITS_REMOVE takes out any such bits | |
1164 | so we get a "real" address such as one would find in a symbol | |
1165 | table. This is used only for addresses of instructions, and even then | |
1166 | I'm not sure it's used in all contexts. It exists to deal with there | |
1167 | being a few stray bits in the PC which would mislead us, not as some sort | |
1168 | of generic thing to handle alignment or segmentation (it's possible it | |
cd0fc7c3 | 1169 | should be in TARGET_READ_PC instead). */ |
c906108c SS |
1170 | #if !defined (ADDR_BITS_REMOVE) |
1171 | #define ADDR_BITS_REMOVE(addr) (addr) | |
1172 | #endif /* No ADDR_BITS_REMOVE. */ | |
1173 | ||
1174 | /* From valops.c */ | |
1175 | ||
917317f4 | 1176 | extern CORE_ADDR push_bytes (CORE_ADDR, char *, int); |
c906108c | 1177 | |
917317f4 | 1178 | extern CORE_ADDR push_word (CORE_ADDR, ULONGEST); |
c906108c | 1179 | |
c906108c | 1180 | extern int watchdog; |
c906108c SS |
1181 | |
1182 | /* Hooks for alternate command interfaces. */ | |
8b93c638 | 1183 | |
fb40c209 AC |
1184 | #ifdef UI_OUT |
1185 | /* The name of the interpreter if specified on the command line. */ | |
1186 | extern char *interpreter_p; | |
1187 | #endif | |
1188 | ||
1189 | /* If a given interpreter matches INTERPRETER_P then it should update | |
1190 | command_loop_hook and init_ui_hook with the per-interpreter | |
1191 | implementation. */ | |
1192 | /* FIXME: command_loop_hook and init_ui_hook should be moved here. */ | |
1193 | ||
c906108c SS |
1194 | struct target_waitstatus; |
1195 | struct cmd_list_element; | |
c906108c | 1196 | |
0f71a2f6 JM |
1197 | /* Should the asynchronous variant of the interpreter (using the |
1198 | event-loop) be enabled? */ | |
6426a772 | 1199 | extern int event_loop_p; |
917317f4 JM |
1200 | |
1201 | extern void (*init_ui_hook) (char *argv0); | |
1202 | extern void (*command_loop_hook) (void); | |
c2d11a7d | 1203 | extern void (*show_load_progress) (const char *section, |
7b83ea04 AC |
1204 | unsigned long section_sent, |
1205 | unsigned long section_size, | |
1206 | unsigned long total_sent, | |
c2d11a7d | 1207 | unsigned long total_size); |
917317f4 JM |
1208 | extern void (*print_frame_info_listing_hook) (struct symtab * s, |
1209 | int line, int stopline, | |
1210 | int noerror); | |
1211 | extern struct frame_info *parse_frame_specification (char *frame_exp); | |
1212 | extern int (*query_hook) (const char *, va_list); | |
1213 | extern void (*warning_hook) (const char *, va_list); | |
d9fcf2fb | 1214 | extern void (*flush_hook) (struct ui_file * stream); |
917317f4 JM |
1215 | extern void (*create_breakpoint_hook) (struct breakpoint * b); |
1216 | extern void (*delete_breakpoint_hook) (struct breakpoint * bpt); | |
1217 | extern void (*modify_breakpoint_hook) (struct breakpoint * bpt); | |
1218 | extern void (*interactive_hook) (void); | |
1219 | extern void (*registers_changed_hook) (void); | |
1220 | extern void (*readline_begin_hook) (char *,...); | |
1221 | extern char *(*readline_hook) (char *); | |
1222 | extern void (*readline_end_hook) (void); | |
1223 | extern void (*register_changed_hook) (int regno); | |
1224 | extern void (*memory_changed_hook) (CORE_ADDR addr, int len); | |
1225 | extern void (*context_hook) (int); | |
1226 | extern int (*target_wait_hook) (int pid, struct target_waitstatus * status); | |
1227 | ||
1228 | extern void (*attach_hook) (void); | |
1229 | extern void (*detach_hook) (void); | |
1230 | extern void (*call_command_hook) (struct cmd_list_element * c, | |
1231 | char *cmd, int from_tty); | |
1232 | ||
1233 | extern void (*set_hook) (struct cmd_list_element * c); | |
1234 | ||
1235 | extern NORETURN void (*error_hook) (void) ATTR_NORETURN; | |
1236 | ||
1237 | extern void (*error_begin_hook) (void); | |
1238 | ||
1239 | extern int (*ui_load_progress_hook) (const char *section, unsigned long num); | |
c906108c SS |
1240 | |
1241 | ||
1242 | /* Inhibit window interface if non-zero. */ | |
1243 | ||
1244 | extern int use_windows; | |
1245 | ||
1246 | /* Symbolic definitions of filename-related things. */ | |
1247 | /* FIXME, this doesn't work very well if host and executable | |
1248 | filesystems conventions are different. */ | |
1249 | ||
1250 | #ifndef DIRNAME_SEPARATOR | |
1251 | #define DIRNAME_SEPARATOR ':' | |
1252 | #endif | |
1253 | ||
1254 | #ifndef SLASH_P | |
1255 | #if defined(__GO32__)||defined(_WIN32) | |
1256 | #define SLASH_P(X) ((X)=='\\') | |
1257 | #else | |
1258 | #define SLASH_P(X) ((X)=='/') | |
1259 | #endif | |
1260 | #endif | |
1261 | ||
1262 | #ifndef SLASH_CHAR | |
1263 | #if defined(__GO32__)||defined(_WIN32) | |
1264 | #define SLASH_CHAR '\\' | |
1265 | #else | |
1266 | #define SLASH_CHAR '/' | |
1267 | #endif | |
1268 | #endif | |
1269 | ||
1270 | #ifndef SLASH_STRING | |
1271 | #if defined(__GO32__)||defined(_WIN32) | |
1272 | #define SLASH_STRING "\\" | |
1273 | #else | |
1274 | #define SLASH_STRING "/" | |
1275 | #endif | |
1276 | #endif | |
1277 | ||
1278 | #ifndef ROOTED_P | |
1279 | #define ROOTED_P(X) (SLASH_P((X)[0])) | |
1280 | #endif | |
1281 | ||
1282 | /* On some systems, PIDGET is defined to extract the inferior pid from | |
1283 | an internal pid that has the thread id and pid in seperate bit | |
1284 | fields. If not defined, then just use the entire internal pid as | |
1285 | the actual pid. */ | |
1286 | ||
1287 | #ifndef PIDGET | |
ed9a39eb JM |
1288 | #define PIDGET(PID) (PID) |
1289 | #define TIDGET(PID) 0 | |
09f99d3f | 1290 | #define MERGEPID(PID, TID) (PID) |
c906108c SS |
1291 | #endif |
1292 | ||
1293 | /* If under Cygwin, provide backwards compatibility with older | |
1294 | Cygwin compilers that don't define the current cpp define. */ | |
1295 | #ifdef __CYGWIN32__ | |
1296 | #ifndef __CYGWIN__ | |
1297 | #define __CYGWIN__ | |
1298 | #endif | |
1299 | #endif | |
1300 | ||
96baa820 JM |
1301 | /* Define well known filenos if the system does not define them. */ |
1302 | #ifndef STDIN_FILENO | |
1303 | #define STDIN_FILENO 0 | |
1304 | #endif | |
1305 | #ifndef STDOUT_FILENO | |
1306 | #define STDOUT_FILENO 1 | |
1307 | #endif | |
1308 | #ifndef STDERR_FILENO | |
1309 | #define STDERR_FILENO 2 | |
1310 | #endif | |
1311 | ||
104c1213 JM |
1312 | /* If this definition isn't overridden by the header files, assume |
1313 | that isatty and fileno exist on this system. */ | |
1314 | #ifndef ISATTY | |
1315 | #define ISATTY(FP) (isatty (fileno (FP))) | |
1316 | #endif | |
1317 | ||
c4093a6a JM |
1318 | \f |
1319 | /* FIXME: cagney/1999-12-13: The following will be moved to gdb.h / | |
1320 | libgdb.h or gdblib.h. */ | |
1321 | ||
1322 | /* Return-code (RC) from a gdb library call. (The abreviation RC is | |
1323 | taken from the sim/common directory.) */ | |
1324 | ||
1325 | enum gdb_rc { | |
1326 | /* The operation failed. The failure message can be fetched by | |
1327 | calling ``char *error_last_message(void)''. The value is | |
1328 | determined by the catch_errors() interface. */ | |
1329 | /* NOTE: Since ``defs.h:catch_errors()'' does not return an error / | |
1330 | internal / quit indication it is not possible to return that | |
1331 | here. */ | |
1332 | GDB_RC_FAIL = 0, | |
1333 | /* No error occured but nothing happened. Due to the catch_errors() | |
1334 | interface, this must be non-zero. */ | |
1335 | GDB_RC_NONE = 1, | |
1336 | /* The operation was successful. Due to the catch_errors() | |
1337 | interface, this must be non-zero. */ | |
1338 | GDB_RC_OK = 2 | |
1339 | }; | |
1340 | ||
1341 | ||
1342 | /* Print the specified breakpoint on GDB_STDOUT. (Eventually this | |
1343 | function will ``print'' the object on ``output''). */ | |
1344 | enum gdb_rc gdb_breakpoint_query (/* struct {ui,gdb}_out *output, */ int bnum); | |
1345 | ||
c3f6f71d JM |
1346 | /* Create a breakpoint at ADDRESS (a GDB source and line). */ |
1347 | enum gdb_rc gdb_breakpoint (char *address, char *condition, | |
1348 | int hardwareflag, int tempflag, | |
1349 | int thread, int ignore_count); | |
0fda6bd2 | 1350 | enum gdb_rc gdb_thread_select (/* output object */ char *tidstr); |
c3f6f71d | 1351 | |
8b93c638 JM |
1352 | #ifdef UI_OUT |
1353 | /* Print a list of known thread ids. */ | |
1354 | enum gdb_rc gdb_list_thread_ids (/* output object */); | |
1355 | ||
1356 | /* Switch thread and print notification. */ | |
1357 | #endif | |
c906108c | 1358 | #endif /* #ifndef DEFS_H */ |