165845Sbostic /* Basic, host-specific, and target-specific definitions for GDB. 265845Sbostic Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc. 365845Sbostic 465845Sbostic This file is part of GDB. 565845Sbostic 665845Sbostic This program is free software; you can redistribute it and/or modify 765845Sbostic it under the terms of the GNU General Public License as published by 865845Sbostic the Free Software Foundation; either version 2 of the License, or 965845Sbostic (at your option) any later version. 1065845Sbostic 1165845Sbostic This program is distributed in the hope that it will be useful, 1265845Sbostic but WITHOUT ANY WARRANTY; without even the implied warranty of 1365845Sbostic MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1465845Sbostic GNU General Public License for more details. 1565845Sbostic 1665845Sbostic You should have received a copy of the GNU General Public License 1765845Sbostic along with this program; if not, write to the Free Software 1865845Sbostic Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 1965845Sbostic 2065845Sbostic #if !defined (DEFS_H) 2165845Sbostic #define DEFS_H 1 2265845Sbostic 23*65878Sbostic #include <limits.h> 2465845Sbostic #include <stdio.h> 2565845Sbostic 2665845Sbostic /* First include ansidecl.h so we can use the various macro definitions 2765845Sbostic here and in all subsequent file inclusions. */ 2865845Sbostic 2965845Sbostic #include "ansidecl.h" 3065845Sbostic 3165845Sbostic /* An address in the program being debugged. Host byte order. */ 3265845Sbostic typedef unsigned int CORE_ADDR; 3365845Sbostic 3465845Sbostic #define min(a, b) ((a) < (b) ? (a) : (b)) 3565845Sbostic #define max(a, b) ((a) > (b) ? (a) : (b)) 3665845Sbostic 3765845Sbostic /* The character C++ uses to build identifiers that must be unique from 3865845Sbostic the program's identifiers (such as $this and $$vptr). */ 3965845Sbostic #define CPLUS_MARKER '$' /* May be overridden to '.' for SysV */ 4065845Sbostic 4165845Sbostic #include <errno.h> /* System call error return status */ 4265845Sbostic 4365845Sbostic extern int quit_flag; 4465845Sbostic extern int immediate_quit; 4565845Sbostic 4665845Sbostic extern void 4765845Sbostic quit PARAMS ((void)); 4865845Sbostic 4965845Sbostic #define QUIT { if (quit_flag) quit (); } 5065845Sbostic 5165845Sbostic /* Command classes are top-level categories into which commands are broken 5265845Sbostic down for "help" purposes. 5365845Sbostic Notes on classes: class_alias is for alias commands which are not 5465845Sbostic abbreviations of the original command. class-pseudo is for commands 5565845Sbostic which are not really commands nor help topics ("stop"). */ 5665845Sbostic 5765845Sbostic enum command_class 5865845Sbostic { 5965845Sbostic /* Special args to help_list */ 6065845Sbostic all_classes = -2, all_commands = -1, 6165845Sbostic /* Classes of commands */ 6265845Sbostic no_class = -1, class_run = 0, class_vars, class_stack, 6365845Sbostic class_files, class_support, class_info, class_breakpoint, 6465845Sbostic class_alias, class_obscure, class_user, class_maintenance, 6565845Sbostic class_pseudo 6665845Sbostic }; 6765845Sbostic 6865845Sbostic /* the cleanup list records things that have to be undone 6965845Sbostic if an error happens (descriptors to be closed, memory to be freed, etc.) 7065845Sbostic Each link in the chain records a function to call and an 7165845Sbostic argument to give it. 7265845Sbostic 7365845Sbostic Use make_cleanup to add an element to the cleanup chain. 7465845Sbostic Use do_cleanups to do all cleanup actions back to a given 7565845Sbostic point in the chain. Use discard_cleanups to remove cleanups 7665845Sbostic from the chain back to a given point, not doing them. */ 7765845Sbostic 7865845Sbostic struct cleanup 7965845Sbostic { 8065845Sbostic struct cleanup *next; 8165845Sbostic void (*function) PARAMS ((PTR)); 8265845Sbostic PTR arg; 8365845Sbostic }; 8465845Sbostic 8565845Sbostic /* From blockframe.c */ 8665845Sbostic 8765845Sbostic extern int 8865845Sbostic inside_entry_func PARAMS ((CORE_ADDR)); 8965845Sbostic 9065845Sbostic extern int 9165845Sbostic inside_entry_file PARAMS ((CORE_ADDR addr)); 9265845Sbostic 9365845Sbostic extern int 9465845Sbostic inside_main_func PARAMS ((CORE_ADDR pc)); 9565845Sbostic 9665845Sbostic /* From cplus-dem.c */ 9765845Sbostic 9865845Sbostic extern char * 9965845Sbostic cplus_demangle PARAMS ((const char *, int)); 10065845Sbostic 10165845Sbostic extern char * 10265845Sbostic cplus_mangle_opname PARAMS ((char *, int)); 10365845Sbostic 10465845Sbostic /* From libmmalloc.a (memory mapped malloc library) */ 10565845Sbostic 10665845Sbostic extern PTR 10765845Sbostic mmalloc_attach PARAMS ((int, PTR)); 10865845Sbostic 10965845Sbostic extern PTR 11065845Sbostic mmalloc_detach PARAMS ((PTR)); 11165845Sbostic 11265845Sbostic extern PTR 11365845Sbostic mmalloc PARAMS ((PTR, long)); 11465845Sbostic 11565845Sbostic extern PTR 11665845Sbostic mrealloc PARAMS ((PTR, PTR, long)); 11765845Sbostic 11865845Sbostic extern void 11965845Sbostic mfree PARAMS ((PTR, PTR)); 12065845Sbostic 12165845Sbostic extern int 12265845Sbostic mmalloc_setkey PARAMS ((PTR, int, PTR)); 12365845Sbostic 12465845Sbostic extern PTR 12565845Sbostic mmalloc_getkey PARAMS ((PTR, int)); 12665845Sbostic 12765845Sbostic /* From utils.c */ 12865845Sbostic 12965845Sbostic extern char * 13065845Sbostic demangle_and_match PARAMS ((const char *, const char *, int)); 13165845Sbostic 13265845Sbostic extern int 13365845Sbostic strcmp_iw PARAMS ((const char *, const char *)); 13465845Sbostic 13565845Sbostic extern char * 13665845Sbostic safe_strerror PARAMS ((int)); 13765845Sbostic 13865845Sbostic extern char * 13965845Sbostic safe_strsignal PARAMS ((int)); 14065845Sbostic 14165845Sbostic extern void 14265845Sbostic init_malloc PARAMS ((PTR)); 14365845Sbostic 14465845Sbostic extern void 14565845Sbostic request_quit PARAMS ((int)); 14665845Sbostic 14765845Sbostic extern void 14865845Sbostic do_cleanups PARAMS ((struct cleanup *)); 14965845Sbostic 15065845Sbostic extern void 15165845Sbostic discard_cleanups PARAMS ((struct cleanup *)); 15265845Sbostic 15365845Sbostic /* The bare make_cleanup function is one of those rare beasts that 15465845Sbostic takes almost any type of function as the first arg and anything that 15565845Sbostic will fit in a "void *" as the second arg. 15665845Sbostic 15765845Sbostic Should be, once all calls and called-functions are cleaned up: 15865845Sbostic extern struct cleanup * 15965845Sbostic make_cleanup PARAMS ((void (*function) (PTR), PTR)); 16065845Sbostic 16165845Sbostic Until then, lint and/or various type-checking compiler options will 16265845Sbostic complain about make_cleanup calls. It'd be wrong to just cast things, 16365845Sbostic since the type actually passed when the function is called would be 16465845Sbostic wrong. */ 16565845Sbostic 16665845Sbostic extern struct cleanup * 16765845Sbostic make_cleanup (); 16865845Sbostic 16965845Sbostic extern struct cleanup * 17065845Sbostic save_cleanups PARAMS ((void)); 17165845Sbostic 17265845Sbostic extern void 17365845Sbostic restore_cleanups PARAMS ((struct cleanup *)); 17465845Sbostic 17565845Sbostic extern void 17665845Sbostic free_current_contents PARAMS ((char **)); 17765845Sbostic 17865845Sbostic extern void 17965845Sbostic null_cleanup PARAMS ((char **)); 18065845Sbostic 18165845Sbostic extern int 18265845Sbostic myread PARAMS ((int, char *, int)); 18365845Sbostic 18465845Sbostic extern int 18565845Sbostic query (); 18665845Sbostic 18765845Sbostic extern void 18865845Sbostic wrap_here PARAMS ((char *)); 18965845Sbostic 19065845Sbostic extern void 19165845Sbostic reinitialize_more_filter PARAMS ((void)); 19265845Sbostic 19365845Sbostic extern int 19465845Sbostic print_insn PARAMS ((CORE_ADDR, FILE *)); 19565845Sbostic 19665845Sbostic extern void 19765845Sbostic fputs_filtered PARAMS ((const char *, FILE *)); 19865845Sbostic 19965845Sbostic extern void 20065845Sbostic puts_filtered PARAMS ((char *)); 20165845Sbostic 20265845Sbostic extern void 20365845Sbostic vfprintf_filtered (); 20465845Sbostic 20565845Sbostic extern void 20665845Sbostic fprintf_filtered (); 20765845Sbostic 20865845Sbostic extern void 20965845Sbostic fprintfi_filtered (); 21065845Sbostic 21165845Sbostic extern void 21265845Sbostic printf_filtered (); 21365845Sbostic 21465845Sbostic extern void 21565845Sbostic printfi_filtered (); 21665845Sbostic 21765845Sbostic extern void 21865845Sbostic print_spaces PARAMS ((int, FILE *)); 21965845Sbostic 22065845Sbostic extern void 22165845Sbostic print_spaces_filtered PARAMS ((int, FILE *)); 22265845Sbostic 22365845Sbostic extern char * 22465845Sbostic n_spaces PARAMS ((int)); 22565845Sbostic 22665845Sbostic extern void 22765845Sbostic printchar PARAMS ((int, FILE *, int)); 22865845Sbostic 22965845Sbostic extern char * 23065845Sbostic strdup_demangled PARAMS ((const char *)); 23165845Sbostic 23265845Sbostic extern void 23365845Sbostic fprint_symbol PARAMS ((FILE *, char *)); 23465845Sbostic 23565845Sbostic extern void 23665845Sbostic fputs_demangled PARAMS ((char *, FILE *, int)); 23765845Sbostic 23865845Sbostic extern void 23965845Sbostic perror_with_name PARAMS ((char *)); 24065845Sbostic 24165845Sbostic extern void 24265845Sbostic print_sys_errmsg PARAMS ((char *, int)); 24365845Sbostic 24465845Sbostic /* From regex.c */ 24565845Sbostic 24665845Sbostic extern char * 24765845Sbostic re_comp PARAMS ((char *)); 24865845Sbostic 24965845Sbostic /* From symfile.c */ 25065845Sbostic 25165845Sbostic extern void 25265845Sbostic symbol_file_command PARAMS ((char *, int)); 25365845Sbostic 25465845Sbostic /* From main.c */ 25565845Sbostic 25665845Sbostic extern char * 25765845Sbostic skip_quoted PARAMS ((char *)); 25865845Sbostic 25965845Sbostic extern char * 26065845Sbostic gdb_readline PARAMS ((char *)); 26165845Sbostic 26265845Sbostic extern char * 26365845Sbostic command_line_input PARAMS ((char *, int)); 26465845Sbostic 26565845Sbostic extern void 26665845Sbostic print_prompt PARAMS ((void)); 26765845Sbostic 26865845Sbostic extern int 26965845Sbostic batch_mode PARAMS ((void)); 27065845Sbostic 27165845Sbostic extern int 27265845Sbostic input_from_terminal_p PARAMS ((void)); 27365845Sbostic 27465845Sbostic extern int 27565845Sbostic catch_errors PARAMS ((int (*) (char *), char *, char *)); 27665845Sbostic 27765845Sbostic /* From printcmd.c */ 27865845Sbostic 27965845Sbostic extern void 28065845Sbostic set_next_address PARAMS ((CORE_ADDR)); 28165845Sbostic 28265845Sbostic extern void 28365845Sbostic print_address_symbolic PARAMS ((CORE_ADDR, FILE *, int, char *)); 28465845Sbostic 28565845Sbostic extern void 28665845Sbostic print_address PARAMS ((CORE_ADDR, FILE *)); 28765845Sbostic 28865845Sbostic /* From source.c */ 28965845Sbostic 29065845Sbostic extern int 29165845Sbostic openp PARAMS ((char *, int, char *, int, int, char **)); 29265845Sbostic 29365845Sbostic extern void 29465845Sbostic mod_path PARAMS ((char *, char **)); 29565845Sbostic 29665845Sbostic extern void 29765845Sbostic directory_command PARAMS ((char *, int)); 29865845Sbostic 29965845Sbostic extern void 30065845Sbostic init_source_path PARAMS ((void)); 30165845Sbostic 30265845Sbostic /* From findvar.c */ 30365845Sbostic 30465845Sbostic extern int 30565845Sbostic read_relative_register_raw_bytes PARAMS ((int, char *)); 30665845Sbostic 30765845Sbostic /* From readline (but not in any readline .h files). */ 30865845Sbostic 30965845Sbostic extern char * 31065845Sbostic tilde_expand PARAMS ((char *)); 31165845Sbostic 31265845Sbostic /* Structure for saved commands lines 31365845Sbostic (for breakpoints, defined commands, etc). */ 31465845Sbostic 31565845Sbostic struct command_line 31665845Sbostic { 31765845Sbostic struct command_line *next; 31865845Sbostic char *line; 31965845Sbostic int type; /* statement type */ 32065845Sbostic #define CL_END 0 32165845Sbostic #define CL_NORMAL 1 32265845Sbostic #define CL_WHILE 2 32365845Sbostic #define CL_IF 3 32465845Sbostic #define CL_EXITLOOP 4 32565845Sbostic #define CL_NOP 5 32665845Sbostic struct command_line *body; /* body of loop for while, body of if */ 32765845Sbostic struct command_line *elsebody; /* body of else part of if */ 32865845Sbostic }; 32965845Sbostic 33065845Sbostic extern struct command_line * 33165845Sbostic read_command_lines PARAMS ((int)); 33265845Sbostic 33365845Sbostic extern void 33465845Sbostic free_command_lines PARAMS ((struct command_line *)); 33565845Sbostic 33665845Sbostic /* String containing the current directory (what getwd would return). */ 33765845Sbostic 33865845Sbostic extern char *current_directory; 33965845Sbostic 34065845Sbostic /* Default radixes for input and output. Only some values supported. */ 34165845Sbostic extern unsigned input_radix; 34265845Sbostic extern unsigned output_radix; 34365845Sbostic 34465845Sbostic /* Baud rate specified for communication with serial target systems. */ 34565845Sbostic extern char *baud_rate; 34665845Sbostic 34765845Sbostic /* Languages represented in the symbol table and elsewhere. */ 34865845Sbostic 34965845Sbostic enum language 35065845Sbostic { 35165845Sbostic language_unknown, /* Language not known */ 35265845Sbostic language_auto, /* Placeholder for automatic setting */ 35365845Sbostic language_c, /* C */ 35465845Sbostic language_cplus, /* C++ */ 35565845Sbostic language_m2 /* Modula-2 */ 35665845Sbostic }; 35765845Sbostic 35865845Sbostic /* Return a format string for printf that will print a number in the local 35965845Sbostic (language-specific) hexadecimal format. Result is static and is 36065845Sbostic overwritten by the next call. local_hex_format_custom takes printf 36165845Sbostic options like "08" or "l" (to produce e.g. %08x or %lx). */ 36265845Sbostic 36365845Sbostic #define local_hex_format() (current_language->la_hex_format) 36465845Sbostic 36565845Sbostic extern char * 36665845Sbostic local_hex_format_custom PARAMS ((char *)); /* language.c */ 36765845Sbostic 36865845Sbostic /* Return a string that contains a number formatted in the local 36965845Sbostic (language-specific) hexadecimal format. Result is static and is 37065845Sbostic overwritten by the next call. local_hex_string_custom takes printf 37165845Sbostic options like "08" or "l". */ 37265845Sbostic 37365845Sbostic extern char * 37465845Sbostic local_hex_string PARAMS ((int)); /* language.c */ 37565845Sbostic 37665845Sbostic extern char * 37765845Sbostic local_hex_string_custom PARAMS ((int, char *)); /* language.c */ 37865845Sbostic 37965845Sbostic 38065845Sbostic /* Host machine definition. This will be a symlink to one of the 38165845Sbostic xm-*.h files, built by the `configure' script. */ 38265845Sbostic 38365845Sbostic #include "xm.h" 38465845Sbostic 38565845Sbostic /* If the xm.h file did not define the mode string used to open the 38665845Sbostic files, assume that binary files are opened the same way as text 38765845Sbostic files */ 38865845Sbostic #ifndef FOPEN_RB 38965845Sbostic #include "fopen-same.h" 39065845Sbostic #endif 39165845Sbostic 39265845Sbostic /* 39365845Sbostic * Allow things in gdb to be declared "const". If compiling ANSI, it 39465845Sbostic * just works. If compiling with gcc but non-ansi, redefine to __const__. 39565845Sbostic * If non-ansi, non-gcc, then eliminate "const" entirely, making those 39665845Sbostic * objects be read-write rather than read-only. 39765845Sbostic */ 39865845Sbostic 39965845Sbostic #ifndef const 40065845Sbostic #ifndef __STDC__ 40165845Sbostic # ifdef __GNUC__ 40265845Sbostic # define const __const__ 40365845Sbostic # else 40465845Sbostic # define const /*nothing*/ 40565845Sbostic # endif /* GNUC */ 40665845Sbostic #endif /* STDC */ 40765845Sbostic #endif /* const */ 40865845Sbostic 40965845Sbostic #ifndef volatile 41065845Sbostic #ifndef __STDC__ 41165845Sbostic # ifdef __GNUC__ 41265845Sbostic # define volatile __volatile__ 41365845Sbostic # else 41465845Sbostic # define volatile /*nothing*/ 41565845Sbostic # endif /* GNUC */ 41665845Sbostic #endif /* STDC */ 41765845Sbostic #endif /* volatile */ 41865845Sbostic 41965845Sbostic /* Some compilers (many AT&T SVR4 compilers for instance), do not accept 42065845Sbostic declarations of functions that never return (exit for instance) as 42165845Sbostic "volatile void". For such compilers "NORETURN" can be defined away 42265845Sbostic to keep them happy */ 42365845Sbostic 42465845Sbostic #ifndef NORETURN 42565845Sbostic # ifdef __lucid 42665845Sbostic # define NORETURN /*nothing*/ 42765845Sbostic # else 42865845Sbostic # define NORETURN volatile 42965845Sbostic # endif 43065845Sbostic #endif 43165845Sbostic 43265845Sbostic /* Defaults for system-wide constants (if not defined by xm.h, we fake it). */ 43365845Sbostic 43465845Sbostic #if !defined (UINT_MAX) 43565845Sbostic #define UINT_MAX 0xffffffff 43665845Sbostic #endif 43765845Sbostic 43865845Sbostic #if !defined (LONG_MAX) 43965845Sbostic #define LONG_MAX 0x7fffffff 44065845Sbostic #endif 44165845Sbostic 44265845Sbostic #if !defined (INT_MAX) 44365845Sbostic #define INT_MAX 0x7fffffff 44465845Sbostic #endif 44565845Sbostic 44665845Sbostic #if !defined (INT_MIN) 44765845Sbostic /* Two's complement, 32 bit. */ 44865845Sbostic #define INT_MIN -0x80000000 44965845Sbostic #endif 45065845Sbostic 45165845Sbostic /* Number of bits in a char or unsigned char for the target machine. 45265845Sbostic Just like CHAR_BIT in <limits.h> but describes the target machine. */ 45365845Sbostic #if !defined (TARGET_CHAR_BIT) 45465845Sbostic #define TARGET_CHAR_BIT 8 45565845Sbostic #endif 45665845Sbostic 45765845Sbostic /* Number of bits in a short or unsigned short for the target machine. */ 45865845Sbostic #if !defined (TARGET_SHORT_BIT) 45965845Sbostic #define TARGET_SHORT_BIT (sizeof (short) * TARGET_CHAR_BIT) 46065845Sbostic #endif 46165845Sbostic 46265845Sbostic /* Number of bits in an int or unsigned int for the target machine. */ 46365845Sbostic #if !defined (TARGET_INT_BIT) 46465845Sbostic #define TARGET_INT_BIT (sizeof (int) * TARGET_CHAR_BIT) 46565845Sbostic #endif 46665845Sbostic 46765845Sbostic /* Number of bits in a long or unsigned long for the target machine. */ 46865845Sbostic #if !defined (TARGET_LONG_BIT) 46965845Sbostic #define TARGET_LONG_BIT (sizeof (long) * TARGET_CHAR_BIT) 47065845Sbostic #endif 47165845Sbostic 47265845Sbostic /* Number of bits in a long long or unsigned long long for the target machine. */ 47365845Sbostic #if !defined (TARGET_LONG_LONG_BIT) 47465845Sbostic #define TARGET_LONG_LONG_BIT (2 * TARGET_LONG_BIT) 47565845Sbostic #endif 47665845Sbostic 47765845Sbostic /* Number of bits in a float for the target machine. */ 47865845Sbostic #if !defined (TARGET_FLOAT_BIT) 47965845Sbostic #define TARGET_FLOAT_BIT (sizeof (float) * TARGET_CHAR_BIT) 48065845Sbostic #endif 48165845Sbostic 48265845Sbostic /* Number of bits in a double for the target machine. */ 48365845Sbostic #if !defined (TARGET_DOUBLE_BIT) 48465845Sbostic #define TARGET_DOUBLE_BIT (sizeof (double) * TARGET_CHAR_BIT) 48565845Sbostic #endif 48665845Sbostic 48765845Sbostic /* Number of bits in a long double for the target machine. */ 48865845Sbostic #if !defined (TARGET_LONG_DOUBLE_BIT) 48965845Sbostic #define TARGET_LONG_DOUBLE_BIT (2 * TARGET_DOUBLE_BIT) 49065845Sbostic #endif 49165845Sbostic 49265845Sbostic /* Number of bits in a "complex" for the target machine. */ 49365845Sbostic #if !defined (TARGET_COMPLEX_BIT) 49465845Sbostic #define TARGET_COMPLEX_BIT (2 * TARGET_FLOAT_BIT) 49565845Sbostic #endif 49665845Sbostic 49765845Sbostic /* Number of bits in a "double complex" for the target machine. */ 49865845Sbostic #if !defined (TARGET_DOUBLE_COMPLEX_BIT) 49965845Sbostic #define TARGET_DOUBLE_COMPLEX_BIT (2 * TARGET_DOUBLE_BIT) 50065845Sbostic #endif 50165845Sbostic 50265845Sbostic /* Number of bits in a pointer for the target machine */ 50365845Sbostic #if !defined (TARGET_PTR_BIT) 50465845Sbostic #define TARGET_PTR_BIT TARGET_INT_BIT 50565845Sbostic #endif 50665845Sbostic 50765845Sbostic /* Convert a LONGEST to an int. This is used in contexts (e.g. number 50865845Sbostic of arguments to a function, number in a value history, register 50965845Sbostic number, etc.) where the value must not be larger than can fit 51065845Sbostic in an int. */ 51165845Sbostic #if !defined (longest_to_int) 51265845Sbostic #if defined (LONG_LONG) 51365845Sbostic #define longest_to_int(x) (((x) > INT_MAX || (x) < INT_MIN) \ 51465845Sbostic ? (error ("Value out of range."),0) : (int) (x)) 51565845Sbostic #else /* No LONG_LONG. */ 51665845Sbostic /* Assume sizeof (int) == sizeof (long). */ 51765845Sbostic #define longest_to_int(x) ((int) (x)) 51865845Sbostic #endif /* No LONG_LONG. */ 51965845Sbostic #endif /* No longest_to_int. */ 52065845Sbostic 52165845Sbostic /* This should not be a typedef, because "unsigned LONGEST" needs 52265845Sbostic to work. LONG_LONG is defined if the host has "long long". */ 52365845Sbostic 52465845Sbostic #ifndef LONGEST 52565845Sbostic # ifdef LONG_LONG 52665845Sbostic # define LONGEST long long 52765845Sbostic # else 52865845Sbostic # define LONGEST long 52965845Sbostic # endif 53065845Sbostic #endif 53165845Sbostic 53265845Sbostic /* Assorted functions we can declare, now that const and volatile are 53365845Sbostic defined. */ 53465845Sbostic 53565845Sbostic extern char * 53665845Sbostic savestring PARAMS ((const char *, int)); 53765845Sbostic 53865845Sbostic extern char * 53965845Sbostic msavestring PARAMS ((void *, const char *, int)); 54065845Sbostic 54165845Sbostic extern char * 54265845Sbostic strsave PARAMS ((const char *)); 54365845Sbostic 54465845Sbostic extern char * 54565845Sbostic mstrsave PARAMS ((void *, const char *)); 54665845Sbostic 54765845Sbostic extern char * 54865845Sbostic concat PARAMS ((char *, ...)); 54965845Sbostic 55065845Sbostic extern PTR 55165845Sbostic xmalloc PARAMS ((long)); 55265845Sbostic 55365845Sbostic extern PTR 55465845Sbostic xrealloc PARAMS ((PTR, long)); 55565845Sbostic 55665845Sbostic extern PTR 55765845Sbostic xmmalloc PARAMS ((PTR, long)); 55865845Sbostic 55965845Sbostic extern PTR 56065845Sbostic xmrealloc PARAMS ((PTR, PTR, long)); 56165845Sbostic 56265845Sbostic extern PTR 56365845Sbostic mmalloc PARAMS ((PTR, long)); 56465845Sbostic 56565845Sbostic extern PTR 56665845Sbostic mrealloc PARAMS ((PTR, PTR, long)); 56765845Sbostic 56865845Sbostic extern void 56965845Sbostic mfree PARAMS ((PTR, PTR)); 57065845Sbostic 57165845Sbostic extern int 57265845Sbostic mmcheck PARAMS ((PTR, void (*) (void))); 57365845Sbostic 57465845Sbostic extern int 57565845Sbostic mmtrace PARAMS ((void)); 57665845Sbostic 57765845Sbostic extern int 57865845Sbostic parse_escape PARAMS ((char **)); 57965845Sbostic 58065845Sbostic extern const char * const reg_names[]; 58165845Sbostic 58265845Sbostic extern NORETURN void /* Does not return to the caller. */ 58365845Sbostic error (); 58465845Sbostic 58565845Sbostic extern NORETURN void /* Does not return to the caller. */ 58665845Sbostic fatal (); 58765845Sbostic 58865845Sbostic extern NORETURN void /* Not specified as volatile in ... */ 58965845Sbostic exit PARAMS ((int)); /* 4.10.4.3 */ 59065845Sbostic 59165845Sbostic extern NORETURN void /* Does not return to the caller. */ 59265845Sbostic nomem PARAMS ((long)); 59365845Sbostic 59465845Sbostic extern NORETURN void /* Does not return to the caller. */ 59565845Sbostic return_to_top_level PARAMS ((void)); 59665845Sbostic 59765845Sbostic extern void 59865845Sbostic warning_setup PARAMS ((void)); 59965845Sbostic 60065845Sbostic extern void 60165845Sbostic warning (); 60265845Sbostic 60365845Sbostic /* Global functions from other, non-gdb GNU thingies (libiberty for 60465845Sbostic instance) */ 60565845Sbostic 60665845Sbostic extern char * 60765845Sbostic basename PARAMS ((char *)); 60865845Sbostic 60965845Sbostic extern char * 61065845Sbostic getenv PARAMS ((const char *)); 61165845Sbostic 61265845Sbostic extern char ** 61365845Sbostic buildargv PARAMS ((char *)); 61465845Sbostic 61565845Sbostic extern void 61665845Sbostic freeargv PARAMS ((char **)); 61765845Sbostic 61865845Sbostic extern char * 61965845Sbostic strerrno PARAMS ((int)); 62065845Sbostic 62165845Sbostic extern char * 62265845Sbostic strsigno PARAMS ((int)); 62365845Sbostic 62465845Sbostic extern int 62565845Sbostic errno_max PARAMS ((void)); 62665845Sbostic 62765845Sbostic extern int 62865845Sbostic signo_max PARAMS ((void)); 62965845Sbostic 63065845Sbostic extern int 63165845Sbostic strtoerrno PARAMS ((char *)); 63265845Sbostic 63365845Sbostic extern int 63465845Sbostic strtosigno PARAMS ((char *)); 63565845Sbostic 63665845Sbostic extern char * 63765845Sbostic strsignal PARAMS ((int)); 63865845Sbostic 63965845Sbostic /* From other system libraries */ 64065845Sbostic 64165845Sbostic #ifndef PSIGNAL_IN_SIGNAL_H 64265845Sbostic extern void 643*65878Sbostic psignal PARAMS ((unsigned, const char *)); 64465845Sbostic #endif 64565845Sbostic 64665845Sbostic /* For now, we can't include <stdlib.h> because it conflicts with 64765845Sbostic "../include/getopt.h". (FIXME) 64865845Sbostic 64965845Sbostic However, if a function is defined in the ANSI C standard and a prototype 65065845Sbostic for that function is defined and visible in any header file in an ANSI 65165845Sbostic conforming environment, then that prototype must match the definition in 65265845Sbostic the ANSI standard. So we can just duplicate them here without conflict, 65365845Sbostic since they must be the same in all conforming ANSI environments. If 65465845Sbostic these cause problems, then the environment is not ANSI conformant. */ 65565845Sbostic 65665845Sbostic #ifdef __STDC__ 65765845Sbostic #include <stddef.h> 65865845Sbostic #endif 65965845Sbostic 66065845Sbostic extern int 66165845Sbostic fclose PARAMS ((FILE *stream)); /* 4.9.5.1 */ 66265845Sbostic 66365845Sbostic extern void 66465845Sbostic perror PARAMS ((const char *)); /* 4.9.10.4 */ 66565845Sbostic 66665845Sbostic extern double 66765845Sbostic atof PARAMS ((const char *nptr)); /* 4.10.1.1 */ 66865845Sbostic 66965845Sbostic extern int 67065845Sbostic atoi PARAMS ((const char *)); /* 4.10.1.2 */ 67165845Sbostic 67265845Sbostic #ifndef MALLOC_INCOMPATIBLE 67365845Sbostic 67465845Sbostic extern PTR 67565845Sbostic malloc PARAMS ((size_t size)); /* 4.10.3.3 */ 67665845Sbostic 67765845Sbostic extern PTR 67865845Sbostic realloc PARAMS ((void *ptr, size_t size)); /* 4.10.3.4 */ 67965845Sbostic 68065845Sbostic extern void 68165845Sbostic free PARAMS ((void *)); /* 4.10.3.2 */ 68265845Sbostic 68365845Sbostic #endif /* MALLOC_INCOMPATIBLE */ 68465845Sbostic 68565845Sbostic extern void 68665845Sbostic qsort PARAMS ((void *base, size_t nmemb, /* 4.10.5.2 */ 68765845Sbostic size_t size, 68865845Sbostic int (*comp)(const void *, const void *))); 68965845Sbostic 69065845Sbostic #ifndef MEM_FNS_DECLARED /* Some non-ANSI use void *, not char *. */ 69165845Sbostic extern PTR 69265845Sbostic memcpy PARAMS ((void *, const void *, size_t)); /* 4.11.2.1 */ 69365845Sbostic #endif 69465845Sbostic 69565845Sbostic extern int 69665845Sbostic memcmp PARAMS ((const void *, const void *, size_t)); /* 4.11.4.1 */ 69765845Sbostic 69865845Sbostic extern char * 69965845Sbostic strchr PARAMS ((const char *, int)); /* 4.11.5.2 */ 70065845Sbostic 70165845Sbostic extern char * 70265845Sbostic strrchr PARAMS ((const char *, int)); /* 4.11.5.5 */ 70365845Sbostic 70465845Sbostic extern char * 70565845Sbostic strstr PARAMS ((const char *, const char *)); /* 4.11.5.7 */ 70665845Sbostic 70765845Sbostic extern char * 70865845Sbostic strtok PARAMS ((char *, const char *)); /* 4.11.5.8 */ 70965845Sbostic 71065845Sbostic #ifndef MEM_FNS_DECLARED /* Some non-ANSI use void *, not char *. */ 71165845Sbostic extern PTR 71265845Sbostic memset PARAMS ((void *, int, size_t)); /* 4.11.6.1 */ 71365845Sbostic #endif 71465845Sbostic 71565845Sbostic extern char * 71665845Sbostic strerror PARAMS ((int)); /* 4.11.6.2 */ 71765845Sbostic 71865845Sbostic /* Various possibilities for alloca. */ 71965845Sbostic #ifndef alloca 72065845Sbostic # ifdef notdef /*XXX*/ 72165845Sbostic # define alloca __builtin_alloca 72265845Sbostic # else 723*65878Sbostic # if defined(sparc) && !defined(__GNUC__) 72465845Sbostic # include <alloca.h> /* NOTE: Doesn't declare alloca() */ 72565845Sbostic # endif 72665845Sbostic # ifdef __STDC__ 72765845Sbostic extern void *alloca (size_t); 72865845Sbostic # else /* __STDC__ */ 72965845Sbostic extern char *alloca (); 73065845Sbostic # endif 73165845Sbostic # endif 73265845Sbostic #endif 73365845Sbostic 73465845Sbostic /* TARGET_BYTE_ORDER and HOST_BYTE_ORDER must be defined to one of these. */ 73565845Sbostic 73665845Sbostic #if !defined (BIG_ENDIAN) 73765845Sbostic #define BIG_ENDIAN 4321 73865845Sbostic #endif 73965845Sbostic 74065845Sbostic #if !defined (LITTLE_ENDIAN) 74165845Sbostic #define LITTLE_ENDIAN 1234 74265845Sbostic #endif 74365845Sbostic 74465845Sbostic /* Target-system-dependent parameters for GDB. 74565845Sbostic 74665845Sbostic The standard thing is to include defs.h. However, files that are 74765845Sbostic specific to a particular target can define TM_FILE_OVERRIDE before 74865845Sbostic including defs.h, then can include any particular tm-file they desire. */ 74965845Sbostic 75065845Sbostic /* Target machine definition. This will be a symlink to one of the 75165845Sbostic tm-*.h files, built by the `configure' script. */ 75265845Sbostic 75365845Sbostic #ifndef TM_FILE_OVERRIDE 75465845Sbostic #include "tm.h" 75565845Sbostic #endif 75665845Sbostic 75765845Sbostic /* The bit byte-order has to do just with numbering of bits in 75865845Sbostic debugging symbols and such. Conceptually, it's quite separate 75965845Sbostic from byte/word byte order. */ 76065845Sbostic 76165845Sbostic #if !defined (BITS_BIG_ENDIAN) 76265845Sbostic #if TARGET_BYTE_ORDER == BIG_ENDIAN 76365845Sbostic #define BITS_BIG_ENDIAN 1 76465845Sbostic #endif /* Big endian. */ 76565845Sbostic 76665845Sbostic #if TARGET_BYTE_ORDER == LITTLE_ENDIAN 76765845Sbostic #define BITS_BIG_ENDIAN 0 76865845Sbostic #endif /* Little endian. */ 76965845Sbostic #endif /* BITS_BIG_ENDIAN not defined. */ 77065845Sbostic 77165845Sbostic /* Swap LEN bytes at BUFFER between target and host byte-order. */ 77265845Sbostic #if TARGET_BYTE_ORDER == HOST_BYTE_ORDER 77365845Sbostic #define SWAP_TARGET_AND_HOST(buffer,len) 77465845Sbostic #else /* Target and host byte order differ. */ 77565845Sbostic #define SWAP_TARGET_AND_HOST(buffer,len) \ 77665845Sbostic { \ 77765845Sbostic char tmp; \ 77865845Sbostic char *p = (char *)(buffer); \ 77965845Sbostic char *q = ((char *)(buffer)) + len - 1; \ 78065845Sbostic for (; p < q; p++, q--) \ 78165845Sbostic { \ 78265845Sbostic tmp = *q; \ 78365845Sbostic *q = *p; \ 78465845Sbostic *p = tmp; \ 78565845Sbostic } \ 78665845Sbostic } 78765845Sbostic #endif /* Target and host byte order differ. */ 78865845Sbostic 78965845Sbostic /* On some machines there are bits in addresses which are not really 79065845Sbostic part of the address, but are used by the kernel, the hardware, etc. 79165845Sbostic for special purposes. ADDR_BITS_REMOVE takes out any such bits 79265845Sbostic so we get a "real" address such as one would find in a symbol 79365845Sbostic table. ADDR_BITS_SET sets those bits the way the system wants 79465845Sbostic them. */ 79565845Sbostic #if !defined (ADDR_BITS_REMOVE) 79665845Sbostic #define ADDR_BITS_REMOVE(addr) (addr) 79765845Sbostic #define ADDR_BITS_SET(addr) (addr) 79865845Sbostic #endif /* No ADDR_BITS_REMOVE. */ 79965845Sbostic 80065845Sbostic /* If this definition isn't overridden by the header files, assume 80165845Sbostic that isatty and fileno exist on this system. */ 80265845Sbostic #ifndef ISATTY 80365845Sbostic #define ISATTY(FP) (isatty(fileno(FP))) 80465845Sbostic #endif 80565845Sbostic 80665845Sbostic /* From valops.c */ 80765845Sbostic 80865845Sbostic extern CORE_ADDR 80965845Sbostic push_bytes PARAMS ((CORE_ADDR, char *, int)); 81065845Sbostic 81165845Sbostic /* In some modules, we don't have a definition of REGISTER_TYPE yet, so we 81265845Sbostic must avoid prototyping this function for now. FIXME. Should be: 81365845Sbostic extern CORE_ADDR 81465845Sbostic push_word PARAMS ((CORE_ADDR, REGISTER_TYPE)); 81565845Sbostic */ 81665845Sbostic extern CORE_ADDR 81765845Sbostic push_word (); 81865845Sbostic 81965845Sbostic /* Some parts of gdb might be considered optional, in the sense that they 82065845Sbostic are not essential for being able to build a working, usable debugger 82165845Sbostic for a specific environment. For example, the maintenance commands 82265845Sbostic are there for the benefit of gdb maintainers. As another example, 82365845Sbostic some environments really don't need gdb's that are able to read N 82465845Sbostic different object file formats. In order to make it possible (but 82565845Sbostic not necessarily recommended) to build "stripped down" versions of 82665845Sbostic gdb, the following defines control selective compilation of those 82765845Sbostic parts of gdb which can be safely left out when necessary. Note that 82865845Sbostic the default is to include everything. */ 82965845Sbostic 83065845Sbostic #ifndef MAINTENANCE_CMDS 83165845Sbostic #define MAINTENANCE_CMDS 1 83265845Sbostic #endif 83365845Sbostic 83465845Sbostic #endif /* !defined (DEFS_H) */ 835