defs.h revision 46283
119370Spst/* Basic, host-specific, and target-specific definitions for GDB. 246283Sdfr Copyright (C) 1986, 89, 91, 92, 93, 94, 95, 96, 98, 1999 319370Spst Free Software Foundation, Inc. 419370Spst 519370SpstThis file is part of GDB. 619370Spst 719370SpstThis program is free software; you can redistribute it and/or modify 819370Spstit under the terms of the GNU General Public License as published by 919370Spstthe Free Software Foundation; either version 2 of the License, or 1019370Spst(at your option) any later version. 1119370Spst 1219370SpstThis program is distributed in the hope that it will be useful, 1319370Spstbut WITHOUT ANY WARRANTY; without even the implied warranty of 1419370SpstMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1519370SpstGNU General Public License for more details. 1619370Spst 1719370SpstYou should have received a copy of the GNU General Public License 1819370Spstalong with this program; if not, write to the Free Software 1919370SpstFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 2019370Spst 2119370Spst#ifndef DEFS_H 2219370Spst#define DEFS_H 2319370Spst 2419370Spst#include "config.h" /* Generated by configure */ 2519370Spst#include <stdio.h> 2619370Spst#include <errno.h> /* System call error return status */ 2746283Sdfr#include <limits.h> 2819370Spst 2946283Sdfr#ifdef HAVE_STDDEF_H 3046283Sdfr# include <stddef.h> 3146283Sdfr#else 3246283Sdfr# include <sys/types.h> /* for size_t */ 3346283Sdfr#endif 3446283Sdfr 3519370Spst/* Just in case they're not defined in stdio.h. */ 3619370Spst 3719370Spst#ifndef SEEK_SET 3819370Spst#define SEEK_SET 0 3919370Spst#endif 4019370Spst#ifndef SEEK_CUR 4119370Spst#define SEEK_CUR 1 4219370Spst#endif 4319370Spst 4419370Spst/* First include ansidecl.h so we can use the various macro definitions 4519370Spst here and in all subsequent file inclusions. */ 4619370Spst 4719370Spst#include "ansidecl.h" 4819370Spst 4919370Spst#ifdef ANSI_PROTOTYPES 5019370Spst#include <stdarg.h> 5119370Spst#else 5219370Spst#include <varargs.h> 5319370Spst#endif 5419370Spst 5519370Spst#include "libiberty.h" 5619370Spst 5719370Spst/* libiberty.h can't declare this one, but evidently we can. */ 5819370Spstextern char *strsignal PARAMS ((int)); 5919370Spst 6019370Spst#include "progress.h" 6119370Spst 6246283Sdfr#ifdef USE_MMALLOC 6319370Spst#include "mmalloc.h" 6419370Spst#endif 6519370Spst 6619370Spst/* For BFD64 and bfd_vma. */ 6719370Spst#include "bfd.h" 6819370Spst 6919370Spst/* An address in the program being debugged. Host byte order. Rather 7019370Spst than duplicate all the logic in BFD which figures out what type 7119370Spst this is (long, long long, etc.) and whether it needs to be 64 7219370Spst bits (the host/target interactions are subtle), we just use 7319370Spst bfd_vma. */ 7419370Spst 7519370Spsttypedef bfd_vma CORE_ADDR; 7619370Spst 7746283Sdfr#ifndef min 7819370Spst#define min(a, b) ((a) < (b) ? (a) : (b)) 7946283Sdfr#endif 8046283Sdfr#ifndef max 8119370Spst#define max(a, b) ((a) > (b) ? (a) : (b)) 8246283Sdfr#endif 8319370Spst 8419370Spst/* Gdb does *lots* of string compares. Use macros to speed them up by 8519370Spst avoiding function calls if the first characters are not the same. */ 8619370Spst 8719370Spst#define STRCMP(a,b) (*(a) == *(b) ? strcmp ((a), (b)) : (int)*(a) - (int)*(b)) 8819370Spst#define STREQ(a,b) (*(a) == *(b) ? !strcmp ((a), (b)) : 0) 8919370Spst#define STREQN(a,b,c) (*(a) == *(b) ? !strncmp ((a), (b), (c)) : 0) 9019370Spst 9119370Spst/* The character GNU C++ uses to build identifiers that must be unique from 9219370Spst the program's identifiers (such as $this and $$vptr). */ 9319370Spst#define CPLUS_MARKER '$' /* May be overridden to '.' for SysV */ 9419370Spst 9519370Spst/* Check if a character is one of the commonly used C++ marker characters. */ 9619370Spstextern int is_cplus_marker PARAMS ((int)); 9719370Spst 9846283Sdfr/* use tui interface if non-zero */ 9946283Sdfrextern int tui_version; 10046283Sdfr 10146283Sdfr#if defined(TUI) 10246283Sdfr/* all invocations of TUIDO should have two sets of parens */ 10346283Sdfr#define TUIDO(x) tuiDo x 10446283Sdfr#else 10546283Sdfr#define TUIDO(x) 10646283Sdfr#endif 10746283Sdfr 10846283Sdfr/* enable xdb commands if set */ 10946283Sdfrextern int xdb_commands; 11046283Sdfr 11146283Sdfr/* enable dbx commands if set */ 11246283Sdfrextern int dbx_commands; 11346283Sdfr 11419370Spstextern int quit_flag; 11519370Spstextern int immediate_quit; 11619370Spstextern int sevenbit_strings; 11719370Spst 11819370Spstextern void quit PARAMS ((void)); 11919370Spst 12046283Sdfr#ifdef QUIT 12146283Sdfr/* do twice to force compiler warning */ 12246283Sdfr#define QUIT_FIXME "FIXME" 12346283Sdfr#define QUIT_FIXME "ignoring redefinition of QUIT" 12446283Sdfr#else 12519370Spst#define QUIT { \ 12619370Spst if (quit_flag) quit (); \ 12719370Spst if (interactive_hook) interactive_hook (); \ 12819370Spst PROGRESS (1); \ 12919370Spst} 13046283Sdfr#endif 13119370Spst 13219370Spst/* Command classes are top-level categories into which commands are broken 13319370Spst down for "help" purposes. 13419370Spst Notes on classes: class_alias is for alias commands which are not 13519370Spst abbreviations of the original command. class-pseudo is for commands 13619370Spst which are not really commands nor help topics ("stop"). */ 13719370Spst 13819370Spstenum command_class 13919370Spst{ 14019370Spst /* Special args to help_list */ 14119370Spst all_classes = -2, all_commands = -1, 14219370Spst /* Classes of commands */ 14319370Spst no_class = -1, class_run = 0, class_vars, class_stack, 14446283Sdfr class_files, class_support, class_info, class_breakpoint, class_trace, 14519370Spst class_alias, class_obscure, class_user, class_maintenance, 14646283Sdfr class_pseudo, class_tui, class_xdb 14719370Spst}; 14819370Spst 14919370Spst/* Languages represented in the symbol table and elsewhere. 15019370Spst This should probably be in language.h, but since enum's can't 15119370Spst be forward declared to satisfy opaque references before their 15219370Spst actual definition, needs to be here. */ 15319370Spst 15419370Spstenum language 15519370Spst{ 15619370Spst language_unknown, /* Language not known */ 15719370Spst language_auto, /* Placeholder for automatic setting */ 15819370Spst language_c, /* C */ 15919370Spst language_cplus, /* C++ */ 16046283Sdfr language_java, /* Java */ 16119370Spst language_chill, /* Chill */ 16219370Spst language_fortran, /* Fortran */ 16319370Spst language_m2, /* Modula-2 */ 16419370Spst language_asm, /* Assembly language */ 16519370Spst language_scm /* Scheme / Guile */ 16619370Spst}; 16719370Spst 16846283Sdfrenum precision_type 16946283Sdfr{ 17046283Sdfr single_precision, 17146283Sdfr double_precision, 17246283Sdfr unspecified_precision 17346283Sdfr}; 17446283Sdfr 17519370Spst/* the cleanup list records things that have to be undone 17619370Spst if an error happens (descriptors to be closed, memory to be freed, etc.) 17719370Spst Each link in the chain records a function to call and an 17819370Spst argument to give it. 17919370Spst 18019370Spst Use make_cleanup to add an element to the cleanup chain. 18119370Spst Use do_cleanups to do all cleanup actions back to a given 18219370Spst point in the chain. Use discard_cleanups to remove cleanups 18319370Spst from the chain back to a given point, not doing them. */ 18419370Spst 18519370Spststruct cleanup 18619370Spst{ 18719370Spst struct cleanup *next; 18819370Spst void (*function) PARAMS ((PTR)); 18919370Spst PTR arg; 19019370Spst}; 19119370Spst 19219370Spst 19319370Spst/* The ability to declare that a function never returns is useful, but 19419370Spst not really required to compile GDB successfully, so the NORETURN and 19519370Spst ATTR_NORETURN macros normally expand into nothing. */ 19619370Spst 19719370Spst/* If compiling with older versions of GCC, a function may be declared 19819370Spst "volatile" to indicate that it does not return. */ 19919370Spst 20019370Spst#ifndef NORETURN 20119370Spst# if defined(__GNUC__) \ 20219370Spst && (__GNUC__ == 1 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)) 20319370Spst# define NORETURN volatile 20419370Spst# else 20519370Spst# define NORETURN /* nothing */ 20619370Spst# endif 20719370Spst#endif 20819370Spst 20919370Spst/* GCC 2.5 and later versions define a function attribute "noreturn", 21019370Spst which is the preferred way to declare that a function never returns. 21119370Spst However GCC 2.7 appears to be the first version in which this fully 21219370Spst works everywhere we use it. */ 21319370Spst 21419370Spst#ifndef ATTR_NORETURN 21519370Spst# if defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 7 21619370Spst# define ATTR_NORETURN __attribute__ ((noreturn)) 21719370Spst# else 21819370Spst# define ATTR_NORETURN /* nothing */ 21919370Spst# endif 22019370Spst#endif 22119370Spst 22219370Spst#ifndef ATTR_FORMAT 22319370Spst# if defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 4 && defined (__ANSI_PROTOTYPES) 22419370Spst# define ATTR_FORMAT(type, x, y) __attribute__ ((format(type, x, y))) 22519370Spst# else 22619370Spst# define ATTR_FORMAT(type, x, y) /* nothing */ 22719370Spst# endif 22819370Spst#endif 22919370Spst 23019370Spst/* Needed for various prototypes */ 23119370Spst 23219370Spst#ifdef __STDC__ 23319370Spststruct symtab; 23419370Spststruct breakpoint; 23519370Spst#endif 23619370Spst 23719370Spst/* From blockframe.c */ 23819370Spst 23919370Spstextern int inside_entry_func PARAMS ((CORE_ADDR)); 24019370Spst 24119370Spstextern int inside_entry_file PARAMS ((CORE_ADDR addr)); 24219370Spst 24319370Spstextern int inside_main_func PARAMS ((CORE_ADDR pc)); 24419370Spst 24519370Spst/* From ch-lang.c, for the moment. (FIXME) */ 24619370Spst 24719370Spstextern char *chill_demangle PARAMS ((const char *)); 24819370Spst 24919370Spst/* From utils.c */ 25019370Spst 25146283Sdfrextern void notice_quit PARAMS ((void)); 25246283Sdfr 25319370Spstextern int strcmp_iw PARAMS ((const char *, const char *)); 25419370Spst 25519370Spstextern char *safe_strerror PARAMS ((int)); 25619370Spst 25719370Spstextern char *safe_strsignal PARAMS ((int)); 25819370Spst 25919370Spstextern void init_malloc PARAMS ((void *)); 26019370Spst 26119370Spstextern void request_quit PARAMS ((int)); 26219370Spst 26319370Spstextern void do_cleanups PARAMS ((struct cleanup *)); 26446283Sdfrextern void do_final_cleanups PARAMS ((struct cleanup *)); 26546283Sdfrextern void do_my_cleanups PARAMS ((struct cleanup **, struct cleanup *)); 26646283Sdfrextern void do_run_cleanups PARAMS ((struct cleanup *)); 26719370Spst 26819370Spstextern void discard_cleanups PARAMS ((struct cleanup *)); 26946283Sdfrextern void discard_final_cleanups PARAMS ((struct cleanup *)); 27046283Sdfrextern void discard_my_cleanups PARAMS ((struct cleanup **, struct cleanup *)); 27119370Spst 27246283Sdfrtypedef void (*make_cleanup_func) PARAMS ((void *)); 27319370Spst 27446283Sdfrextern struct cleanup *make_cleanup PARAMS ((make_cleanup_func, void *)); 27519370Spst 27646283Sdfrextern struct cleanup *make_final_cleanup PARAMS ((make_cleanup_func, void *)); 27719370Spst 27846283Sdfrextern struct cleanup *make_my_cleanup PARAMS ((struct cleanup **, 27946283Sdfr make_cleanup_func, void *)); 28019370Spst 28146283Sdfrextern struct cleanup *make_run_cleanup PARAMS ((make_cleanup_func, void *)); 28246283Sdfr 28319370Spstextern struct cleanup *save_cleanups PARAMS ((void)); 28446283Sdfrextern struct cleanup *save_final_cleanups PARAMS ((void)); 28546283Sdfrextern struct cleanup *save_my_cleanups PARAMS ((struct cleanup **)); 28619370Spst 28719370Spstextern void restore_cleanups PARAMS ((struct cleanup *)); 28846283Sdfrextern void restore_final_cleanups PARAMS ((struct cleanup *)); 28946283Sdfrextern void restore_my_cleanups PARAMS ((struct cleanup **, struct cleanup *)); 29019370Spst 29119370Spstextern void free_current_contents PARAMS ((char **)); 29219370Spst 29346283Sdfrextern void null_cleanup PARAMS ((PTR)); 29419370Spst 29519370Spstextern int myread PARAMS ((int, char *, int)); 29619370Spst 29719370Spstextern int query PARAMS((char *, ...)) 29819370Spst ATTR_FORMAT(printf, 1, 2); 29946283Sdfr 30046283Sdfr#if !defined (USE_MMALLOC) 30146283Sdfrextern PTR mmalloc PARAMS ((PTR, size_t)); 30246283Sdfrextern PTR mrealloc PARAMS ((PTR, PTR, size_t)); 30346283Sdfrextern void mfree PARAMS ((PTR, PTR)); 30446283Sdfr#endif 30546283Sdfr 30646283Sdfr/* From demangle.c */ 30746283Sdfr 30846283Sdfrextern void set_demangling_style PARAMS ((char *)); 30946283Sdfr 31046283Sdfr/* From tm.h */ 31146283Sdfr 31246283Sdfrstruct type; 31346283Sdfrtypedef int (use_struct_convention_fn) PARAMS ((int gcc_p, struct type *value_type)); 31446283Sdfrextern use_struct_convention_fn generic_use_struct_convention; 31546283Sdfr 31646283Sdfrtypedef unsigned char *(breakpoint_from_pc_fn) PARAMS ((CORE_ADDR *pcptr, int *lenptr)); 31746283Sdfr 31846283Sdfr 31919370Spst 32019370Spst/* Annotation stuff. */ 32119370Spst 32219370Spstextern int annotation_level; /* in stack.c */ 32319370Spst 32419370Spstextern void begin_line PARAMS ((void)); 32519370Spst 32619370Spstextern void wrap_here PARAMS ((char *)); 32719370Spst 32819370Spstextern void reinitialize_more_filter PARAMS ((void)); 32919370Spst 33046283Sdfr/* new */ 33146283Sdfrenum streamtype 33246283Sdfr{ 33346283Sdfr afile, 33446283Sdfr astring 33546283Sdfr}; 33646283Sdfr 33746283Sdfr/* new */ 33846283Sdfrtypedef struct tui_stream 33946283Sdfr{ 34046283Sdfr enum streamtype ts_streamtype; 34146283Sdfr FILE *ts_filestream; 34246283Sdfr char *ts_strbuf; 34346283Sdfr int ts_buflen; 34446283Sdfr} GDB_FILE; 34546283Sdfr 34646283Sdfrextern GDB_FILE *gdb_stdout; 34746283Sdfrextern GDB_FILE *gdb_stderr; 34846283Sdfr 34946283Sdfr#if 0 35019370Spsttypedef FILE GDB_FILE; 35119370Spst#define gdb_stdout stdout 35219370Spst#define gdb_stderr stderr 35346283Sdfr#endif 35419370Spst 35546283Sdfr#if defined(TUI) 35646283Sdfr#include "tui.h" 35746283Sdfr#include "tuiCommand.h" 35846283Sdfr#include "tuiData.h" 35946283Sdfr#include "tuiIO.h" 36046283Sdfr#include "tuiLayout.h" 36146283Sdfr#include "tuiWin.h" 36246283Sdfr#endif 36346283Sdfr 36446283Sdfrextern void gdb_fclose PARAMS ((GDB_FILE **)); 36546283Sdfr 36619370Spstextern void gdb_flush PARAMS ((GDB_FILE *)); 36719370Spst 36819370Spstextern GDB_FILE *gdb_fopen PARAMS ((char * name, char * mode)); 36919370Spst 37019370Spstextern void fputs_filtered PARAMS ((const char *, GDB_FILE *)); 37119370Spst 37219370Spstextern void fputs_unfiltered PARAMS ((const char *, GDB_FILE *)); 37319370Spst 37446283Sdfrextern int fputc_filtered PARAMS ((int c, GDB_FILE *)); 37546283Sdfr 37619370Spstextern int fputc_unfiltered PARAMS ((int c, GDB_FILE *)); 37719370Spst 37819370Spstextern int putchar_unfiltered PARAMS ((int c)); 37919370Spst 38019370Spstextern void puts_filtered PARAMS ((const char *)); 38119370Spst 38219370Spstextern void puts_unfiltered PARAMS ((const char *)); 38319370Spst 38446283Sdfrextern void puts_debug PARAMS ((char *prefix, char *string, char *suffix)); 38546283Sdfr 38619370Spstextern void vprintf_filtered PARAMS ((const char *, va_list)) 38719370Spst ATTR_FORMAT(printf, 1, 0); 38819370Spst 38946283Sdfrextern void vfprintf_filtered PARAMS ((GDB_FILE *, const char *, va_list)) 39019370Spst ATTR_FORMAT(printf, 2, 0); 39119370Spst 39246283Sdfrextern void fprintf_filtered PARAMS ((GDB_FILE *, const char *, ...)) 39319370Spst ATTR_FORMAT(printf, 2, 3); 39419370Spst 39546283Sdfrextern void fprintfi_filtered PARAMS ((int, GDB_FILE *, const char *, ...)) 39619370Spst ATTR_FORMAT(printf, 3, 4); 39719370Spst 39819370Spstextern void printf_filtered PARAMS ((const char *, ...)) 39919370Spst ATTR_FORMAT(printf, 1, 2); 40019370Spst 40119370Spstextern void printfi_filtered PARAMS ((int, const char *, ...)) 40219370Spst ATTR_FORMAT(printf, 2, 3); 40319370Spst 40419370Spstextern void vprintf_unfiltered PARAMS ((const char *, va_list)) 40519370Spst ATTR_FORMAT(printf, 1, 0); 40619370Spst 40746283Sdfrextern void vfprintf_unfiltered PARAMS ((GDB_FILE *, const char *, va_list)) 40819370Spst ATTR_FORMAT(printf, 2, 0); 40919370Spst 41046283Sdfrextern void fprintf_unfiltered PARAMS ((GDB_FILE *, const char *, ...)) 41119370Spst ATTR_FORMAT(printf, 2, 3); 41219370Spst 41319370Spstextern void printf_unfiltered PARAMS ((const char *, ...)) 41419370Spst ATTR_FORMAT(printf, 1, 2); 41519370Spst 41646283Sdfrextern int gdb_file_isatty PARAMS ((GDB_FILE *)); 41746283Sdfr 41846283Sdfrextern GDB_FILE *gdb_file_init_astring PARAMS ((int)); 41946283Sdfr 42046283Sdfrextern void gdb_file_deallocate PARAMS ((GDB_FILE **)); 42146283Sdfr 42246283Sdfrextern char *gdb_file_get_strbuf PARAMS ((GDB_FILE *)); 42346283Sdfr 42446283Sdfrextern void gdb_file_adjust_strbuf PARAMS ((int, GDB_FILE *)); 42546283Sdfr 42619370Spstextern void print_spaces PARAMS ((int, GDB_FILE *)); 42719370Spst 42819370Spstextern void print_spaces_filtered PARAMS ((int, GDB_FILE *)); 42919370Spst 43019370Spstextern char *n_spaces PARAMS ((int)); 43119370Spst 43219370Spstextern void gdb_printchar PARAMS ((int, GDB_FILE *, int)); 43319370Spst 43419370Spstextern void gdb_print_address PARAMS ((void *, GDB_FILE *)); 43519370Spst 43646283Sdfrtypedef bfd_vma t_addr; 43746283Sdfrtypedef bfd_vma t_reg; 43846283Sdfrextern char* paddr PARAMS ((t_addr addr)); 43946283Sdfr 44046283Sdfrextern char* preg PARAMS ((t_reg reg)); 44146283Sdfr 44246283Sdfrextern char* paddr_nz PARAMS ((t_addr addr)); 44346283Sdfr 44446283Sdfrextern char* preg_nz PARAMS ((t_reg reg)); 44546283Sdfr 44619370Spstextern void fprintf_symbol_filtered PARAMS ((GDB_FILE *, char *, 44719370Spst enum language, int)); 44819370Spst 44946283Sdfrextern NORETURN void perror_with_name PARAMS ((char *)) ATTR_NORETURN; 45019370Spst 45119370Spstextern void print_sys_errmsg PARAMS ((char *, int)); 45219370Spst 45319370Spst/* From regex.c or libc. BSD 4.4 declares this with the argument type as 45419370Spst "const char *" in unistd.h, so we can't declare the argument 45519370Spst as "char *". */ 45619370Spst 45719370Spstextern char *re_comp PARAMS ((const char *)); 45819370Spst 45919370Spst/* From symfile.c */ 46019370Spst 46119370Spstextern void symbol_file_command PARAMS ((char *, int)); 46219370Spst 46319370Spst/* From top.c */ 46419370Spst 46519370Spstextern char *skip_quoted PARAMS ((char *)); 46619370Spst 46719370Spstextern char *gdb_readline PARAMS ((char *)); 46819370Spst 46919370Spstextern char *command_line_input PARAMS ((char *, int, char *)); 47019370Spst 47119370Spstextern void print_prompt PARAMS ((void)); 47219370Spst 47319370Spstextern int input_from_terminal_p PARAMS ((void)); 47419370Spst 47519370Spstextern int info_verbose; 47619370Spst 47719370Spst/* From printcmd.c */ 47819370Spst 47919370Spstextern void set_next_address PARAMS ((CORE_ADDR)); 48019370Spst 48119370Spstextern void print_address_symbolic PARAMS ((CORE_ADDR, GDB_FILE *, int, 48219370Spst char *)); 48319370Spst 48419370Spstextern void print_address_numeric PARAMS ((CORE_ADDR, int, GDB_FILE *)); 48519370Spst 48619370Spstextern void print_address PARAMS ((CORE_ADDR, GDB_FILE *)); 48719370Spst 48819370Spst/* From source.c */ 48919370Spst 49019370Spstextern int openp PARAMS ((char *, int, char *, int, int, char **)); 49119370Spst 49246283Sdfrextern int source_full_path_of PARAMS ((char *, char **)); 49346283Sdfr 49419370Spstextern void mod_path PARAMS ((char *, char **)); 49519370Spst 49619370Spstextern void directory_command PARAMS ((char *, int)); 49719370Spst 49819370Spstextern void init_source_path PARAMS ((void)); 49919370Spst 50019370Spstextern char *symtab_to_filename PARAMS ((struct symtab *)); 50119370Spst 50219370Spst/* From findvar.c */ 50319370Spst 50419370Spstextern int read_relative_register_raw_bytes PARAMS ((int, char *)); 50519370Spst 50619370Spst/* From readline (but not in any readline .h files). */ 50719370Spst 50819370Spstextern char *tilde_expand PARAMS ((char *)); 50919370Spst 51019370Spst/* Control types for commands */ 51119370Spst 51219370Spstenum misc_command_type 51319370Spst{ 51419370Spst ok_command, 51519370Spst end_command, 51619370Spst else_command, 51719370Spst nop_command 51819370Spst}; 51919370Spst 52019370Spstenum command_control_type 52119370Spst{ 52219370Spst simple_control, 52319370Spst break_control, 52419370Spst continue_control, 52519370Spst while_control, 52619370Spst if_control, 52719370Spst invalid_control 52819370Spst}; 52919370Spst 53019370Spst/* Structure for saved commands lines 53119370Spst (for breakpoints, defined commands, etc). */ 53219370Spst 53319370Spststruct command_line 53419370Spst{ 53519370Spst struct command_line *next; 53619370Spst char *line; 53719370Spst enum command_control_type control_type; 53819370Spst int body_count; 53919370Spst struct command_line **body_list; 54019370Spst}; 54119370Spst 54246283Sdfrextern struct command_line *read_command_lines PARAMS ((char *, int)); 54319370Spst 54419370Spstextern void free_command_lines PARAMS ((struct command_line **)); 54519370Spst 54619370Spst/* String containing the current directory (what getwd would return). */ 54719370Spst 54819370Spstextern char *current_directory; 54919370Spst 55019370Spst/* Default radixes for input and output. Only some values supported. */ 55119370Spstextern unsigned input_radix; 55219370Spstextern unsigned output_radix; 55319370Spst 55419370Spst/* Possibilities for prettyprint parameters to routines which print 55519370Spst things. Like enum language, this should be in value.h, but needs 55619370Spst to be here for the same reason. FIXME: If we can eliminate this 55719370Spst as an arg to LA_VAL_PRINT, then we can probably move it back to 55819370Spst value.h. */ 55919370Spst 56019370Spstenum val_prettyprint 56119370Spst{ 56219370Spst Val_no_prettyprint = 0, 56319370Spst Val_prettyprint, 56419370Spst /* Use the default setting which the user has specified. */ 56519370Spst Val_pretty_default 56619370Spst}; 56719370Spst 56819370Spst 56919370Spst/* Host machine definition. This will be a symlink to one of the 57019370Spst xm-*.h files, built by the `configure' script. */ 57119370Spst 57219370Spst#include "xm.h" 57319370Spst 57419370Spst/* Native machine support. This will be a symlink to one of the 57519370Spst nm-*.h files, built by the `configure' script. */ 57619370Spst 57719370Spst#include "nm.h" 57819370Spst 57919370Spst/* Target machine definition. This will be a symlink to one of the 58019370Spst tm-*.h files, built by the `configure' script. */ 58119370Spst 58219370Spst#include "tm.h" 58319370Spst 58419370Spst/* If the xm.h file did not define the mode string used to open the 58519370Spst files, assume that binary files are opened the same way as text 58619370Spst files */ 58719370Spst#ifndef FOPEN_RB 58819370Spst#include "fopen-same.h" 58919370Spst#endif 59019370Spst 59146283Sdfr/* Microsoft C can't deal with const pointers */ 59246283Sdfr 59346283Sdfr#ifdef _MSC_VER 59446283Sdfr#define CONST_PTR 59546283Sdfr#else 59646283Sdfr#define CONST_PTR const 59746283Sdfr#endif 59846283Sdfr 59919370Spst/* 60046283Sdfr * Allow things in gdb to be declared "volatile". If compiling ANSI, it 60146283Sdfr * just works. If compiling with gcc but non-ansi, redefine to __volatile__. 60246283Sdfr * If non-ansi, non-gcc, then eliminate "volatile" entirely, making those 60319370Spst * objects be read-write rather than read-only. 60419370Spst */ 60519370Spst 60619370Spst#ifndef volatile 60719370Spst#ifndef __STDC__ 60819370Spst# ifdef __GNUC__ 60919370Spst# define volatile __volatile__ 61019370Spst# else 61119370Spst# define volatile /*nothing*/ 61219370Spst# endif /* GNUC */ 61319370Spst#endif /* STDC */ 61419370Spst#endif /* volatile */ 61519370Spst 61646283Sdfr/* Defaults for system-wide constants (if not defined by xm.h, we fake it). 61746283Sdfr FIXME: Assumes 2's complement arithmetic */ 61819370Spst 61919370Spst#if !defined (UINT_MAX) 62019370Spst#define UINT_MAX ((unsigned int)(~0)) /* 0xFFFFFFFF for 32-bits */ 62119370Spst#endif 62219370Spst 62319370Spst#if !defined (INT_MAX) 62419370Spst#define INT_MAX ((int)(UINT_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */ 62519370Spst#endif 62619370Spst 62719370Spst#if !defined (INT_MIN) 62846283Sdfr#define INT_MIN ((int)((int) ~0 ^ INT_MAX)) /* 0x80000000 for 32-bits */ 62919370Spst#endif 63019370Spst 63119370Spst#if !defined (ULONG_MAX) 63219370Spst#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF for 32-bits */ 63319370Spst#endif 63419370Spst 63519370Spst#if !defined (LONG_MAX) 63619370Spst#define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */ 63719370Spst#endif 63819370Spst 63946283Sdfr#ifndef LONGEST 64046283Sdfr 64119370Spst#ifdef BFD64 64219370Spst 64319370Spst/* This is to make sure that LONGEST is at least as big as CORE_ADDR. */ 64419370Spst 64519370Spst#define LONGEST BFD_HOST_64_BIT 64646283Sdfr#define ULONGEST BFD_HOST_U_64_BIT 64719370Spst 64819370Spst#else /* No BFD64 */ 64919370Spst 65019370Spst# ifdef CC_HAS_LONG_LONG 65119370Spst# define LONGEST long long 65246283Sdfr# define ULONGEST unsigned long long 65319370Spst# else 65446283Sdfr/* BFD_HOST_64_BIT is defined for some hosts that don't have long long 65546283Sdfr (e.g. i386-windows) so try it. */ 65646283Sdfr# ifdef BFD_HOST_64_BIT 65746283Sdfr# define LONGEST BFD_HOST_64_BIT 65846283Sdfr# define ULONGEST BFD_HOST_U_64_BIT 65946283Sdfr# else 66046283Sdfr# define LONGEST long 66146283Sdfr# define ULONGEST unsigned long 66246283Sdfr# endif 66319370Spst# endif 66419370Spst 66519370Spst#endif /* No BFD64 */ 66619370Spst 66746283Sdfr#endif /* ! LONGEST */ 66846283Sdfr 66919370Spst/* Convert a LONGEST to an int. This is used in contexts (e.g. number of 67019370Spst arguments to a function, number in a value history, register number, etc.) 67119370Spst where the value must not be larger than can fit in an int. */ 67219370Spst 67319370Spstextern int longest_to_int PARAMS ((LONGEST)); 67419370Spst 67519370Spst/* Assorted functions we can declare, now that const and volatile are 67619370Spst defined. */ 67719370Spst 67819370Spstextern char *savestring PARAMS ((const char *, int)); 67919370Spst 68019370Spstextern char *msavestring PARAMS ((void *, const char *, int)); 68119370Spst 68219370Spstextern char *strsave PARAMS ((const char *)); 68319370Spst 68419370Spstextern char *mstrsave PARAMS ((void *, const char *)); 68519370Spst 68646283Sdfr#ifdef _MSC_VER /* FIXME; was long, but this causes compile errors in msvc if already defined */ 68746283Sdfrextern PTR xmmalloc PARAMS ((PTR, size_t)); 68846283Sdfr 68946283Sdfrextern PTR xmrealloc PARAMS ((PTR, PTR, size_t)); 69046283Sdfr#else 69119370Spstextern PTR xmmalloc PARAMS ((PTR, long)); 69219370Spst 69319370Spstextern PTR xmrealloc PARAMS ((PTR, PTR, long)); 69446283Sdfr#endif 69519370Spst 69619370Spstextern int parse_escape PARAMS ((char **)); 69719370Spst 69846283Sdfr/* compat - handle old targets that just define REGISTER_NAMES */ 69946283Sdfr#ifndef REGISTER_NAME 70046283Sdfrextern char *gdb_register_names[]; 70146283Sdfr#define REGISTER_NAME(i) gdb_register_names[i] 70246283Sdfr#endif 70319370Spst 70419370Spst/* Message to be printed before the error message, when an error occurs. */ 70519370Spst 70619370Spstextern char *error_pre_print; 70719370Spst 70819370Spst/* Message to be printed before the error message, when an error occurs. */ 70919370Spst 71019370Spstextern char *quit_pre_print; 71119370Spst 71219370Spst/* Message to be printed before the warning message, when a warning occurs. */ 71319370Spst 71419370Spstextern char *warning_pre_print; 71519370Spst 71646283Sdfrextern NORETURN void error PARAMS((const char *, ...)) ATTR_NORETURN; 71719370Spst 71819370Spstextern void error_begin PARAMS ((void)); 71919370Spst 72019370Spstextern NORETURN void fatal PARAMS((char *, ...)) ATTR_NORETURN; 72119370Spst 72219370Spstextern NORETURN void nomem PARAMS ((long)) ATTR_NORETURN; 72319370Spst 72419370Spst/* Reasons for calling return_to_top_level. */ 72519370Spstenum return_reason { 72619370Spst /* User interrupt. */ 72719370Spst RETURN_QUIT, 72819370Spst 72919370Spst /* Any other error. */ 73019370Spst RETURN_ERROR 73119370Spst}; 73219370Spst 73319370Spst#define RETURN_MASK_QUIT (1 << (int)RETURN_QUIT) 73419370Spst#define RETURN_MASK_ERROR (1 << (int)RETURN_ERROR) 73519370Spst#define RETURN_MASK_ALL (RETURN_MASK_QUIT | RETURN_MASK_ERROR) 73619370Spsttypedef int return_mask; 73719370Spst 73819370Spstextern NORETURN void 73919370Spstreturn_to_top_level PARAMS ((enum return_reason)) ATTR_NORETURN; 74019370Spst 74146283Sdfrtypedef int (catch_errors_ftype) PARAMS ((PTR)); 74246283Sdfrextern int catch_errors PARAMS ((catch_errors_ftype *, PTR, char *, return_mask)); 74319370Spst 74419370Spstextern void warning_begin PARAMS ((void)); 74519370Spst 74646283Sdfrextern void warning PARAMS ((const char *, ...)) 74719370Spst ATTR_FORMAT(printf, 1, 2); 74819370Spst 74919370Spst/* Global functions from other, non-gdb GNU thingies. 75019370Spst Libiberty thingies are no longer declared here. We include libiberty.h 75119370Spst above, instead. */ 75219370Spst 75319370Spst#ifndef GETENV_PROVIDED 75419370Spstextern char *getenv PARAMS ((const char *)); 75519370Spst#endif 75619370Spst 75719370Spst/* From other system libraries */ 75819370Spst 75946283Sdfr#ifdef HAVE_STDDEF_H 76019370Spst#include <stddef.h> 76146283Sdfr#endif 76246283Sdfr 76346283Sdfr#ifdef HAVE_STDLIB_H 76446283Sdfr#if defined(_MSC_VER) && !defined(__cplusplus) 76546283Sdfr/* msvc defines these in stdlib.h for c code */ 76646283Sdfr#undef min 76746283Sdfr#undef max 76846283Sdfr#endif 76919370Spst#include <stdlib.h> 77019370Spst#endif 77146283Sdfr#ifndef min 77246283Sdfr#define min(a, b) ((a) < (b) ? (a) : (b)) 77346283Sdfr#endif 77446283Sdfr#ifndef max 77546283Sdfr#define max(a, b) ((a) > (b) ? (a) : (b)) 77646283Sdfr#endif 77719370Spst 77819370Spst 77919370Spst/* We take the address of fclose later, but some stdio's forget 78019370Spst to declare this. We can't always declare it since there's 78119370Spst no way to declare the parameters without upsetting some compiler 78219370Spst somewhere. */ 78319370Spst 78419370Spst#ifndef FCLOSE_PROVIDED 78546283Sdfrextern int fclose PARAMS ((FILE *)); 78619370Spst#endif 78719370Spst 78819370Spst#ifndef atof 78946283Sdfrextern double atof PARAMS ((const char *)); /* X3.159-1989 4.10.1.1 */ 79019370Spst#endif 79119370Spst 79219370Spst#ifndef MALLOC_INCOMPATIBLE 79319370Spst 79446283Sdfr#ifdef NEED_DECLARATION_MALLOC 79519370Spstextern PTR malloc (); 79646283Sdfr#endif 79719370Spst 79846283Sdfr#ifdef NEED_DECLARATION_REALLOC 79919370Spstextern PTR realloc (); 80046283Sdfr#endif 80119370Spst 80246283Sdfr#ifdef NEED_DECLARATION_FREE 80319370Spstextern void free (); 80446283Sdfr#endif 80519370Spst 80619370Spst#endif /* MALLOC_INCOMPATIBLE */ 80719370Spst 80819370Spst/* Various possibilities for alloca. */ 80919370Spst#ifndef alloca 81019370Spst# ifdef __GNUC__ 81119370Spst# define alloca __builtin_alloca 81219370Spst# else /* Not GNU C */ 81346283Sdfr# ifdef HAVE_ALLOCA_H 81446283Sdfr# include <alloca.h> 81546283Sdfr# else 81646283Sdfr# ifdef _AIX 81746283Sdfr #pragma alloca 81846283Sdfr# else 81919370Spst 82019370Spst/* We need to be careful not to declare this in a way which conflicts with 82119370Spst bison. Bison never declares it as char *, but under various circumstances 82219370Spst (like __hpux) we need to use void *. */ 82346283Sdfr# if defined (__STDC__) || defined (__hpux) 82419370Spst extern void *alloca (); 82546283Sdfr# else /* Don't use void *. */ 82619370Spst extern char *alloca (); 82746283Sdfr# endif /* Don't use void *. */ 82846283Sdfr# endif /* Not _AIX */ 82946283Sdfr# endif /* Not HAVE_ALLOCA_H */ 83019370Spst# endif /* Not GNU C */ 83119370Spst#endif /* alloca not defined */ 83219370Spst 83319370Spst/* HOST_BYTE_ORDER must be defined to one of these. */ 83419370Spst 83519370Spst#ifdef HAVE_ENDIAN_H 83619370Spst#include <endian.h> 83719370Spst#endif 83819370Spst 83919370Spst#if !defined (BIG_ENDIAN) 84019370Spst#define BIG_ENDIAN 4321 84119370Spst#endif 84219370Spst 84319370Spst#if !defined (LITTLE_ENDIAN) 84419370Spst#define LITTLE_ENDIAN 1234 84519370Spst#endif 84619370Spst 84746283Sdfr/* Dynamic target-system-dependent parameters for GDB. */ 84846283Sdfr#include "gdbarch.h" 84919370Spst 85046283Sdfr/* Static target-system-dependent parameters for GDB. */ 85119370Spst 85219370Spst/* Number of bits in a char or unsigned char for the target machine. 85319370Spst Just like CHAR_BIT in <limits.h> but describes the target machine. */ 85419370Spst#if !defined (TARGET_CHAR_BIT) 85519370Spst#define TARGET_CHAR_BIT 8 85619370Spst#endif 85719370Spst 85819370Spst/* Number of bits in a short or unsigned short for the target machine. */ 85919370Spst#if !defined (TARGET_SHORT_BIT) 86019370Spst#define TARGET_SHORT_BIT (2 * TARGET_CHAR_BIT) 86119370Spst#endif 86219370Spst 86319370Spst/* Number of bits in an int or unsigned int for the target machine. */ 86419370Spst#if !defined (TARGET_INT_BIT) 86519370Spst#define TARGET_INT_BIT (4 * TARGET_CHAR_BIT) 86619370Spst#endif 86719370Spst 86819370Spst/* Number of bits in a long or unsigned long for the target machine. */ 86919370Spst#if !defined (TARGET_LONG_BIT) 87019370Spst#define TARGET_LONG_BIT (4 * TARGET_CHAR_BIT) 87119370Spst#endif 87219370Spst 87319370Spst/* Number of bits in a long long or unsigned long long for the target machine. */ 87419370Spst#if !defined (TARGET_LONG_LONG_BIT) 87519370Spst#define TARGET_LONG_LONG_BIT (2 * TARGET_LONG_BIT) 87619370Spst#endif 87719370Spst 87819370Spst/* Number of bits in a float for the target machine. */ 87919370Spst#if !defined (TARGET_FLOAT_BIT) 88019370Spst#define TARGET_FLOAT_BIT (4 * TARGET_CHAR_BIT) 88119370Spst#endif 88219370Spst 88319370Spst/* Number of bits in a double for the target machine. */ 88419370Spst#if !defined (TARGET_DOUBLE_BIT) 88519370Spst#define TARGET_DOUBLE_BIT (8 * TARGET_CHAR_BIT) 88619370Spst#endif 88719370Spst 88819370Spst/* Number of bits in a long double for the target machine. */ 88919370Spst#if !defined (TARGET_LONG_DOUBLE_BIT) 89019370Spst#define TARGET_LONG_DOUBLE_BIT (2 * TARGET_DOUBLE_BIT) 89119370Spst#endif 89219370Spst 89319370Spst/* Number of bits in a pointer for the target machine */ 89419370Spst#if !defined (TARGET_PTR_BIT) 89519370Spst#define TARGET_PTR_BIT TARGET_INT_BIT 89619370Spst#endif 89719370Spst 89819370Spst/* If we picked up a copy of CHAR_BIT from a configuration file 89919370Spst (which may get it by including <limits.h>) then use it to set 90019370Spst the number of bits in a host char. If not, use the same size 90119370Spst as the target. */ 90219370Spst 90319370Spst#if defined (CHAR_BIT) 90419370Spst#define HOST_CHAR_BIT CHAR_BIT 90519370Spst#else 90619370Spst#define HOST_CHAR_BIT TARGET_CHAR_BIT 90719370Spst#endif 90819370Spst 90919370Spst/* The bit byte-order has to do just with numbering of bits in 91019370Spst debugging symbols and such. Conceptually, it's quite separate 91119370Spst from byte/word byte order. */ 91219370Spst 91319370Spst#if !defined (BITS_BIG_ENDIAN) 91419370Spst#define BITS_BIG_ENDIAN (TARGET_BYTE_ORDER == BIG_ENDIAN) 91546283Sdfr#endif 91619370Spst 91719370Spst/* In findvar.c. */ 91819370Spst 91919370Spstextern LONGEST extract_signed_integer PARAMS ((void *, int)); 92019370Spst 92146283Sdfrextern ULONGEST extract_unsigned_integer PARAMS ((void *, int)); 92219370Spst 92319370Spstextern int extract_long_unsigned_integer PARAMS ((void *, int, LONGEST *)); 92419370Spst 92519370Spstextern CORE_ADDR extract_address PARAMS ((void *, int)); 92619370Spst 92746283Sdfrextern void store_signed_integer PARAMS ((PTR, int, LONGEST)); 92819370Spst 92946283Sdfrextern void store_unsigned_integer PARAMS ((PTR, int, ULONGEST)); 93019370Spst 93146283Sdfrextern void store_address PARAMS ((PTR, int, LONGEST)); 93219370Spst 93346283Sdfr/* Setup definitions for host and target floating point formats. We need to 93446283Sdfr consider the format for `float', `double', and `long double' for both target 93546283Sdfr and host. We need to do this so that we know what kind of conversions need 93646283Sdfr to be done when converting target numbers to and from the hosts DOUBLEST 93746283Sdfr data type. */ 93846283Sdfr 93946283Sdfr/* This is used to indicate that we don't know the format of the floating point 94046283Sdfr number. Typically, this is useful for native ports, where the actual format 94146283Sdfr is irrelevant, since no conversions will be taking place. */ 94246283Sdfr 94346283Sdfrextern const struct floatformat floatformat_unknown; 94446283Sdfr 94546283Sdfr#if HOST_BYTE_ORDER == BIG_ENDIAN 94646283Sdfr# ifndef HOST_FLOAT_FORMAT 94746283Sdfr# define HOST_FLOAT_FORMAT &floatformat_ieee_single_big 94846283Sdfr# endif 94946283Sdfr# ifndef HOST_DOUBLE_FORMAT 95046283Sdfr# define HOST_DOUBLE_FORMAT &floatformat_ieee_double_big 95146283Sdfr# endif 95246283Sdfr#else /* LITTLE_ENDIAN */ 95346283Sdfr# ifndef HOST_FLOAT_FORMAT 95446283Sdfr# define HOST_FLOAT_FORMAT &floatformat_ieee_single_little 95546283Sdfr# endif 95646283Sdfr# ifndef HOST_DOUBLE_FORMAT 95746283Sdfr# define HOST_DOUBLE_FORMAT &floatformat_ieee_double_little 95846283Sdfr# endif 95946283Sdfr#endif 96046283Sdfr 96146283Sdfr#ifndef HOST_LONG_DOUBLE_FORMAT 96246283Sdfr#define HOST_LONG_DOUBLE_FORMAT &floatformat_unknown 96346283Sdfr#endif 96446283Sdfr 96546283Sdfr#ifndef TARGET_FLOAT_FORMAT 96646283Sdfr#define TARGET_FLOAT_FORMAT (TARGET_BYTE_ORDER == BIG_ENDIAN \ 96746283Sdfr ? &floatformat_ieee_single_big \ 96846283Sdfr : &floatformat_ieee_single_little) 96946283Sdfr#endif 97046283Sdfr#ifndef TARGET_DOUBLE_FORMAT 97146283Sdfr#define TARGET_DOUBLE_FORMAT (TARGET_BYTE_ORDER == BIG_ENDIAN \ 97246283Sdfr ? &floatformat_ieee_double_big \ 97346283Sdfr : &floatformat_ieee_double_little) 97446283Sdfr#endif 97546283Sdfr 97646283Sdfr#ifndef TARGET_LONG_DOUBLE_FORMAT 97746283Sdfr# define TARGET_LONG_DOUBLE_FORMAT &floatformat_unknown 97846283Sdfr#endif 97946283Sdfr 98019370Spst/* Use `long double' if the host compiler supports it. (Note that this is not 98119370Spst necessarily any longer than `double'. On SunOS/gcc, it's the same as 98219370Spst double.) This is necessary because GDB internally converts all floating 98319370Spst point values to the widest type supported by the host. 98419370Spst 98519370Spst There are problems however, when the target `long double' is longer than the 98619370Spst host's `long double'. In general, we'll probably reduce the precision of 98719370Spst any such values and print a warning. */ 98819370Spst 98919370Spst#ifdef HAVE_LONG_DOUBLE 99019370Spsttypedef long double DOUBLEST; 99119370Spst#else 99219370Spsttypedef double DOUBLEST; 99319370Spst#endif 99419370Spst 99546283Sdfrextern void floatformat_to_doublest PARAMS ((const struct floatformat *, 99646283Sdfr char *, DOUBLEST *)); 99746283Sdfrextern void floatformat_from_doublest PARAMS ((const struct floatformat *, 99846283Sdfr DOUBLEST *, char *)); 99919370Spstextern DOUBLEST extract_floating PARAMS ((void *, int)); 100019370Spst 100119370Spstextern void store_floating PARAMS ((void *, int, DOUBLEST)); 100219370Spst 100319370Spst/* On some machines there are bits in addresses which are not really 100419370Spst part of the address, but are used by the kernel, the hardware, etc. 100519370Spst for special purposes. ADDR_BITS_REMOVE takes out any such bits 100619370Spst so we get a "real" address such as one would find in a symbol 100719370Spst table. This is used only for addresses of instructions, and even then 100819370Spst I'm not sure it's used in all contexts. It exists to deal with there 100919370Spst being a few stray bits in the PC which would mislead us, not as some sort 101019370Spst of generic thing to handle alignment or segmentation (it's possible it 101119370Spst should be in TARGET_READ_PC instead). */ 101219370Spst#if !defined (ADDR_BITS_REMOVE) 101319370Spst#define ADDR_BITS_REMOVE(addr) (addr) 101419370Spst#endif /* No ADDR_BITS_REMOVE. */ 101519370Spst 101619370Spst/* From valops.c */ 101719370Spst 101819370Spstextern CORE_ADDR push_bytes PARAMS ((CORE_ADDR, char *, int)); 101919370Spst 102046283Sdfrextern CORE_ADDR push_word PARAMS ((CORE_ADDR, ULONGEST)); 102119370Spst 102219370Spst/* Some parts of gdb might be considered optional, in the sense that they 102319370Spst are not essential for being able to build a working, usable debugger 102419370Spst for a specific environment. For example, the maintenance commands 102519370Spst are there for the benefit of gdb maintainers. As another example, 102619370Spst some environments really don't need gdb's that are able to read N 102719370Spst different object file formats. In order to make it possible (but 102819370Spst not necessarily recommended) to build "stripped down" versions of 102919370Spst gdb, the following defines control selective compilation of those 103019370Spst parts of gdb which can be safely left out when necessary. Note that 103119370Spst the default is to include everything. */ 103219370Spst 103319370Spst#ifndef MAINTENANCE_CMDS 103419370Spst#define MAINTENANCE_CMDS 1 103519370Spst#endif 103619370Spst 103719370Spst#ifdef MAINTENANCE_CMDS 103819370Spstextern int watchdog; 103919370Spst#endif 104019370Spst 104119370Spst/* Hooks for alternate command interfaces. */ 104219370Spst 104319370Spst#ifdef __STDC__ 104419370Spststruct target_waitstatus; 104519370Spststruct cmd_list_element; 104619370Spst#endif 104719370Spst 104846283Sdfrextern void (*init_ui_hook) PARAMS ((char *argv0)); 104919370Spstextern void (*command_loop_hook) PARAMS ((void)); 105019370Spstextern void (*fputs_unfiltered_hook) PARAMS ((const char *linebuffer, 105146283Sdfr GDB_FILE *stream)); 105219370Spstextern void (*print_frame_info_listing_hook) PARAMS ((struct symtab *s, 105319370Spst int line, int stopline, 105419370Spst int noerror)); 105546283Sdfrextern struct frame_info *parse_frame_specification PARAMS ((char *frame_exp)); 105646283Sdfrextern int (*query_hook) PARAMS ((const char *, va_list)); 105746283Sdfrextern void (*warning_hook) PARAMS ((const char *, va_list)); 105846283Sdfrextern void (*flush_hook) PARAMS ((GDB_FILE *stream)); 105919370Spstextern void (*create_breakpoint_hook) PARAMS ((struct breakpoint *b)); 106019370Spstextern void (*delete_breakpoint_hook) PARAMS ((struct breakpoint *bpt)); 106119370Spstextern void (*modify_breakpoint_hook) PARAMS ((struct breakpoint *bpt)); 106219370Spstextern void (*target_output_hook) PARAMS ((char *)); 106319370Spstextern void (*interactive_hook) PARAMS ((void)); 106419370Spstextern void (*registers_changed_hook) PARAMS ((void)); 106546283Sdfrextern void (*readline_begin_hook) PARAMS ((char *, ...)); 106646283Sdfrextern char * (*readline_hook) PARAMS ((char *)); 106746283Sdfrextern void (*readline_end_hook) PARAMS ((void)); 106846283Sdfrextern void (*register_changed_hook) PARAMS ((int regno)); 106946283Sdfrextern void (*memory_changed_hook) PARAMS ((CORE_ADDR addr, int len)); 107046283Sdfrextern void (*context_hook) PARAMS ((int)); 107119370Spstextern int (*target_wait_hook) PARAMS ((int pid, 107219370Spst struct target_waitstatus *status)); 107319370Spst 107419370Spstextern void (*call_command_hook) PARAMS ((struct cmd_list_element *c, 107519370Spst char *cmd, int from_tty)); 107619370Spst 107746283Sdfrextern NORETURN void (*error_hook) PARAMS ((void)) ATTR_NORETURN; 107819370Spst 107946283Sdfrextern void (*error_begin_hook) PARAMS ((void)); 108019370Spst 108119370Spst 108219370Spst/* Inhibit window interface if non-zero. */ 108319370Spst 108419370Spstextern int use_windows; 108519370Spst 108619370Spst/* Symbolic definitions of filename-related things. */ 108719370Spst/* FIXME, this doesn't work very well if host and executable 108819370Spst filesystems conventions are different. */ 108919370Spst 109019370Spst#ifndef DIRNAME_SEPARATOR 109119370Spst#define DIRNAME_SEPARATOR ':' 109219370Spst#endif 109319370Spst 109419370Spst#ifndef SLASH_P 109546283Sdfr#if defined(__GO32__)||defined(_WIN32) 109619370Spst#define SLASH_P(X) ((X)=='\\') 109719370Spst#else 109819370Spst#define SLASH_P(X) ((X)=='/') 109919370Spst#endif 110019370Spst#endif 110119370Spst 110219370Spst#ifndef SLASH_CHAR 110346283Sdfr#if defined(__GO32__)||defined(_WIN32) 110419370Spst#define SLASH_CHAR '\\' 110519370Spst#else 110619370Spst#define SLASH_CHAR '/' 110719370Spst#endif 110819370Spst#endif 110919370Spst 111019370Spst#ifndef SLASH_STRING 111146283Sdfr#if defined(__GO32__)||defined(_WIN32) 111219370Spst#define SLASH_STRING "\\" 111319370Spst#else 111419370Spst#define SLASH_STRING "/" 111519370Spst#endif 111619370Spst#endif 111719370Spst 111819370Spst#ifndef ROOTED_P 111919370Spst#define ROOTED_P(X) (SLASH_P((X)[0])) 112019370Spst#endif 112119370Spst 112246283Sdfr/* On some systems, PIDGET is defined to extract the inferior pid from 112346283Sdfr an internal pid that has the thread id and pid in seperate bit 112446283Sdfr fields. If not defined, then just use the entire internal pid as 112546283Sdfr the actual pid. */ 112646283Sdfr 112746283Sdfr#ifndef PIDGET 112846283Sdfr#define PIDGET(pid) (pid) 112946283Sdfr#endif 113046283Sdfr 113146283Sdfr/* If under Cygwin, provide backwards compatibility with older 113246283Sdfr Cygwin compilers that don't define the current cpp define. */ 113346283Sdfr#ifdef __CYGWIN32__ 113446283Sdfr#ifndef __CYGWIN__ 113546283Sdfr#define __CYGWIN__ 113646283Sdfr#endif 113746283Sdfr#endif 113846283Sdfr 113919370Spst#endif /* #ifndef DEFS_H */ 1140