X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fdefs.h;h=56d8d7b4c80ef2f715aa1c472356ab5990953d39;hb=1f8cc6dbc0da3d3248de330289713ab6cebb21f2;hp=1ff7d663964a1c9c1fe60839f8a0a4ef1ef1beb3;hpb=5a2402b8e0a796b75b1d394fb73360f14e83cc33;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/defs.h b/gdb/defs.h index 1ff7d66396..56d8d7b4c8 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -1,6 +1,7 @@ /* *INDENT-OFF* */ /* ATTR_FORMAT confuses indent, avoid running it for now */ /* Basic, host-specific, and target-specific definitions for GDB. - Copyright (C) 1986, 1989, 1991-1996, 1998-2000 + Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, + 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GDB. @@ -148,7 +149,6 @@ typedef bfd_vma CORE_ADDR; issue is found that we spend the effort on algorithmic optimizations than micro-optimizing.'' J.T. */ -#define STRCMP(a,b) (*(a) == *(b) ? strcmp ((a), (b)) : (int)*(a) - (int)*(b)) #define STREQ(a,b) (*(a) == *(b) ? !strcmp ((a), (b)) : 0) #define STREQN(a,b,c) (*(a) == *(b) ? !strncmp ((a), (b), (c)) : 0) @@ -227,6 +227,149 @@ enum precision_type unspecified_precision }; +/* The numbering of these signals is chosen to match traditional unix + signals (insofar as various unices use the same numbers, anyway). + It is also the numbering of the GDB remote protocol. Other remote + protocols, if they use a different numbering, should make sure to + translate appropriately. + + Since these numbers have actually made it out into other software + (stubs, etc.), you mustn't disturb the assigned numbering. If you + need to add new signals here, add them to the end of the explicitly + numbered signals. + + This is based strongly on Unix/POSIX signals for several reasons: + (1) This set of signals represents a widely-accepted attempt to + represent events of this sort in a portable fashion, (2) we want a + signal to make it from wait to child_wait to the user intact, (3) many + remote protocols use a similar encoding. However, it is + recognized that this set of signals has limitations (such as not + distinguishing between various kinds of SIGSEGV, or not + distinguishing hitting a breakpoint from finishing a single step). + So in the future we may get around this either by adding additional + signals for breakpoint, single-step, etc., or by adding signal + codes; the latter seems more in the spirit of what BSD, System V, + etc. are doing to address these issues. */ + +/* For an explanation of what each signal means, see + target_signal_to_string. */ + +enum target_signal + { + /* Used some places (e.g. stop_signal) to record the concept that + there is no signal. */ + TARGET_SIGNAL_0 = 0, + TARGET_SIGNAL_FIRST = 0, + TARGET_SIGNAL_HUP = 1, + TARGET_SIGNAL_INT = 2, + TARGET_SIGNAL_QUIT = 3, + TARGET_SIGNAL_ILL = 4, + TARGET_SIGNAL_TRAP = 5, + TARGET_SIGNAL_ABRT = 6, + TARGET_SIGNAL_EMT = 7, + TARGET_SIGNAL_FPE = 8, + TARGET_SIGNAL_KILL = 9, + TARGET_SIGNAL_BUS = 10, + TARGET_SIGNAL_SEGV = 11, + TARGET_SIGNAL_SYS = 12, + TARGET_SIGNAL_PIPE = 13, + TARGET_SIGNAL_ALRM = 14, + TARGET_SIGNAL_TERM = 15, + TARGET_SIGNAL_URG = 16, + TARGET_SIGNAL_STOP = 17, + TARGET_SIGNAL_TSTP = 18, + TARGET_SIGNAL_CONT = 19, + TARGET_SIGNAL_CHLD = 20, + TARGET_SIGNAL_TTIN = 21, + TARGET_SIGNAL_TTOU = 22, + TARGET_SIGNAL_IO = 23, + TARGET_SIGNAL_XCPU = 24, + TARGET_SIGNAL_XFSZ = 25, + TARGET_SIGNAL_VTALRM = 26, + TARGET_SIGNAL_PROF = 27, + TARGET_SIGNAL_WINCH = 28, + TARGET_SIGNAL_LOST = 29, + TARGET_SIGNAL_USR1 = 30, + TARGET_SIGNAL_USR2 = 31, + TARGET_SIGNAL_PWR = 32, + /* Similar to SIGIO. Perhaps they should have the same number. */ + TARGET_SIGNAL_POLL = 33, + TARGET_SIGNAL_WIND = 34, + TARGET_SIGNAL_PHONE = 35, + TARGET_SIGNAL_WAITING = 36, + TARGET_SIGNAL_LWP = 37, + TARGET_SIGNAL_DANGER = 38, + TARGET_SIGNAL_GRANT = 39, + TARGET_SIGNAL_RETRACT = 40, + TARGET_SIGNAL_MSG = 41, + TARGET_SIGNAL_SOUND = 42, + TARGET_SIGNAL_SAK = 43, + TARGET_SIGNAL_PRIO = 44, + TARGET_SIGNAL_REALTIME_33 = 45, + TARGET_SIGNAL_REALTIME_34 = 46, + TARGET_SIGNAL_REALTIME_35 = 47, + TARGET_SIGNAL_REALTIME_36 = 48, + TARGET_SIGNAL_REALTIME_37 = 49, + TARGET_SIGNAL_REALTIME_38 = 50, + TARGET_SIGNAL_REALTIME_39 = 51, + TARGET_SIGNAL_REALTIME_40 = 52, + TARGET_SIGNAL_REALTIME_41 = 53, + TARGET_SIGNAL_REALTIME_42 = 54, + TARGET_SIGNAL_REALTIME_43 = 55, + TARGET_SIGNAL_REALTIME_44 = 56, + TARGET_SIGNAL_REALTIME_45 = 57, + TARGET_SIGNAL_REALTIME_46 = 58, + TARGET_SIGNAL_REALTIME_47 = 59, + TARGET_SIGNAL_REALTIME_48 = 60, + TARGET_SIGNAL_REALTIME_49 = 61, + TARGET_SIGNAL_REALTIME_50 = 62, + TARGET_SIGNAL_REALTIME_51 = 63, + TARGET_SIGNAL_REALTIME_52 = 64, + TARGET_SIGNAL_REALTIME_53 = 65, + TARGET_SIGNAL_REALTIME_54 = 66, + TARGET_SIGNAL_REALTIME_55 = 67, + TARGET_SIGNAL_REALTIME_56 = 68, + TARGET_SIGNAL_REALTIME_57 = 69, + TARGET_SIGNAL_REALTIME_58 = 70, + TARGET_SIGNAL_REALTIME_59 = 71, + TARGET_SIGNAL_REALTIME_60 = 72, + TARGET_SIGNAL_REALTIME_61 = 73, + TARGET_SIGNAL_REALTIME_62 = 74, + TARGET_SIGNAL_REALTIME_63 = 75, + + /* Used internally by Solaris threads. See signal(5) on Solaris. */ + TARGET_SIGNAL_CANCEL = 76, + + /* Yes, this pains me, too. But LynxOS didn't have SIG32, and now + Linux does, and we can't disturb the numbering, since it's part + of the protocol. Note that in some GDB's TARGET_SIGNAL_REALTIME_32 + is number 76. */ + TARGET_SIGNAL_REALTIME_32, + /* Yet another pain, IRIX 6 has SIG64. */ + TARGET_SIGNAL_REALTIME_64, + +#if defined(MACH) || defined(__MACH__) + /* Mach exceptions */ + TARGET_EXC_BAD_ACCESS, + TARGET_EXC_BAD_INSTRUCTION, + TARGET_EXC_ARITHMETIC, + TARGET_EXC_EMULATION, + TARGET_EXC_SOFTWARE, + TARGET_EXC_BREAKPOINT, +#endif + TARGET_SIGNAL_INFO, + + /* Some signal we don't know about. */ + TARGET_SIGNAL_UNKNOWN, + + /* Use whatever signal we use when one is not specifically specified + (for passing to proceed and so on). */ + TARGET_SIGNAL_DEFAULT, + + /* Last and unused enum value, for sizing arrays, etc. */ + TARGET_SIGNAL_LAST + }; + /* the cleanup list records things that have to be undone if an error happens (descriptors to be closed, memory to be freed, etc.) Each link in the chain records a function to call and an @@ -371,16 +514,6 @@ extern int myread (int, char *, int); extern int query (char *, ...) ATTR_FORMAT (printf, 1, 2); -#if !defined (USE_MMALLOC) -/* NOTE: cagney/2000-03-04: The mmalloc functions need to use PTR - rather than void* so that they are consistent with - ../mmalloc/mmalloc.h. */ -extern PTR mcalloc (PTR, size_t, size_t); -extern PTR mmalloc (PTR, size_t); -extern PTR mrealloc (PTR, PTR, size_t); -extern void mfree (PTR, PTR); -#endif - extern void init_page_info (void); extern CORE_ADDR host_pointer_to_address (void *ptr); @@ -434,7 +567,8 @@ extern struct ui_file *gdb_stdtarg; #include "ui-file.h" -/* More generic printf like operations */ +/* More generic printf like operations. Filtered versions may return + non-locally on error. */ extern void fputs_filtered (const char *, struct ui_file *); @@ -444,6 +578,8 @@ extern int fputc_filtered (int c, struct ui_file *); extern int fputc_unfiltered (int c, struct ui_file *); +extern int putchar_filtered (int c); + extern int putchar_unfiltered (int c); extern void puts_filtered (const char *); @@ -562,7 +698,7 @@ extern void print_address (CORE_ADDR, struct ui_file *); /* From source.c */ -extern int openp (char *, int, char *, int, int, char **); +extern int openp (const char *, int, const char *, int, int, char **); extern int source_full_path_of (char *, char **); @@ -669,7 +805,6 @@ struct continuation struct continuation_arg *arg_list; struct continuation *next; }; -struct continuation continuation; /* In infrun.c. */ extern struct continuation *cmd_continuation; @@ -708,6 +843,39 @@ enum val_prettyprint /* Use the default setting which the user has specified. */ Val_pretty_default }; + +/* The ptid struct is a collection of the various "ids" necessary + for identifying the inferior. This consists of the process id + (pid), thread id (tid), and other fields necessary for uniquely + identifying the inferior process/thread being debugged. When + manipulating ptids, the constructors, accessors, and predicate + declared in inferior.h should be used. These are as follows: + + ptid_build - Make a new ptid from a pid, lwp, and tid. + pid_to_ptid - Make a new ptid from just a pid. + ptid_get_pid - Fetch the pid component of a ptid. + ptid_get_lwp - Fetch the lwp component of a ptid. + ptid_get_tid - Fetch the tid component of a ptid. + ptid_equal - Test to see if two ptids are equal. + + Please do NOT access the struct ptid members directly (except, of + course, in the implementation of the above ptid manipulation + functions). */ + +struct ptid + { + /* Process id */ + int pid; + + /* Lightweight process id */ + long lwp; + + /* Thread id */ + long tid; + }; + +typedef struct ptid ptid_t; + /* Optional host machine definition. Pure autoconf targets will not @@ -752,30 +920,7 @@ enum val_prettyprint #include "fopen-same.h" #endif -/* Microsoft C can't deal with const pointers */ - -#ifdef _MSC_VER -#define CONST_PTR -#else #define CONST_PTR const -#endif - -/* - * Allow things in gdb to be declared "volatile". If compiling ANSI, it - * just works. If compiling with gcc but non-ansi, redefine to __volatile__. - * If non-ansi, non-gcc, then eliminate "volatile" entirely, making those - * objects be read-write rather than read-only. - */ - -#ifndef volatile -#ifndef __STDC__ -#ifdef __GNUC__ -#define volatile __volatile__ -#else -#define volatile /* nothing */ -#endif /* GNUC */ -#endif /* STDC */ -#endif /* volatile */ /* Defaults for system-wide constants (if not defined by xm.h, we fake it). FIXME: Assumes 2's complement arithmetic */ @@ -801,10 +946,10 @@ enum val_prettyprint #endif #if !defined (ULONGEST_MAX) -#define ULONGEST_MAX (~(ULONGEST)0) /* 0xFFFFFFFFFFFFFFFF for 32-bits */ +#define ULONGEST_MAX (~(ULONGEST)0) /* 0xFFFFFFFFFFFFFFFF for 64-bits */ #endif -#if !defined (LONGEST_MAX) /* 0x7FFFFFFFFFFFFFFF for 32-bits */ +#if !defined (LONGEST_MAX) /* 0x7FFFFFFFFFFFFFFF for 64-bits */ #define LONGEST_MAX ((LONGEST)(ULONGEST_MAX >> 1)) #endif @@ -817,24 +962,38 @@ extern int longest_to_int (LONGEST); /* Assorted functions we can declare, now that const and volatile are defined. */ -extern char *savestring (const char *, int); - -extern char *msavestring (void *, const char *, int); +extern char *savestring (const char *, size_t); -extern char *strsave (const char *); +extern char *msavestring (void *, const char *, size_t); extern char *mstrsave (void *, const char *); -/* FIXME; was long, but this causes compile errors in msvc if already - defined */ -#ifdef _MSC_VER -extern PTR xmmalloc (PTR, size_t); -extern PTR xmrealloc (PTR, PTR, size_t); -#else -extern PTR xmmalloc (PTR, long); -extern PTR xmrealloc (PTR, PTR, long); +#if !defined (USE_MMALLOC) +/* NOTE: cagney/2000-03-04: The mmalloc functions need to use PTR + rather than void* so that they are consistent with the delcaration + in ../mmalloc/mmalloc.h. */ +extern PTR mcalloc (PTR, size_t, size_t); +extern PTR mmalloc (PTR, size_t); +extern PTR mrealloc (PTR, PTR, size_t); +extern void mfree (PTR, PTR); #endif +/* Robust versions of same. Throw an internal error when no memory, + guard against stray NULL arguments. */ +extern void *xmmalloc (void *md, size_t size); +extern void *xmrealloc (void *md, void *ptr, size_t size); +extern void *xmcalloc (void *md, size_t number, size_t size); +extern void xmfree (void *md, void *ptr); + +/* xmalloc(), xrealloc() and xcalloc() have already been declared in + "libiberty.h". */ +extern void xfree (void *); + +/* Like asprintf/vasprintf but get an internal_error if the call + fails. */ +extern void xasprintf (char **ret, const char *format, ...) ATTR_FORMAT (printf, 2, 3); +extern void xvasprintf (char **ret, const char *format, va_list ap); + extern int parse_escape (char **); /* Message to be printed before the error message, when an error occurs. */ @@ -862,9 +1021,11 @@ extern NORETURN void error_stream (struct ui_file *) ATTR_NORETURN; message. */ extern char *error_last_message (void); -extern NORETURN void internal_verror (const char *, va_list ap) ATTR_NORETURN; +extern NORETURN void internal_verror (const char *file, int line, + const char *, va_list ap) ATTR_NORETURN; -extern NORETURN void internal_error (char *, ...) ATTR_NORETURN; +extern NORETURN void internal_error (const char *file, int line, + const char *, ...) ATTR_NORETURN ATTR_FORMAT (printf, 3, 4); extern NORETURN void nomem (long) ATTR_NORETURN; @@ -925,11 +1086,6 @@ extern char *getenv (const char *); #endif #ifdef HAVE_STDLIB_H -#if defined(_MSC_VER) && !defined(__cplusplus) -/* msvc defines these in stdlib.h for c code */ -#undef min -#undef max -#endif #include #endif #ifndef min @@ -953,22 +1109,6 @@ extern int fclose (FILE *); extern double atof (const char *); /* X3.159-1989 4.10.1.1 */ #endif -#ifndef MALLOC_INCOMPATIBLE - -#ifdef NEED_DECLARATION_MALLOC -extern PTR malloc (); -#endif - -#ifdef NEED_DECLARATION_REALLOC -extern PTR realloc (); -#endif - -#ifdef NEED_DECLARATION_FREE -extern void free (); -#endif - -#endif /* MALLOC_INCOMPATIBLE */ - /* Various possibilities for alloca. */ #ifndef alloca #ifdef __GNUC__ @@ -984,11 +1124,7 @@ extern void free (); /* We need to be careful not to declare this in a way which conflicts with bison. Bison never declares it as char *, but under various circumstances (like __hpux) we need to use void *. */ -#if defined (__STDC__) || defined (__hpux) extern void *alloca (); -#else /* Don't use void *. */ -extern char *alloca (); -#endif /* Don't use void *. */ #endif /* Not _AIX */ #endif /* Not HAVE_ALLOCA_H */ #endif /* Not GNU C */ @@ -1025,51 +1161,6 @@ extern char *alloca (); #define TARGET_CHAR_BIT 8 #endif -/* Number of bits in a short or unsigned short for the target machine. */ -#if !defined (TARGET_SHORT_BIT) -#define TARGET_SHORT_BIT (2 * TARGET_CHAR_BIT) -#endif - -/* Number of bits in an int or unsigned int for the target machine. */ -#if !defined (TARGET_INT_BIT) -#define TARGET_INT_BIT (4 * TARGET_CHAR_BIT) -#endif - -/* Number of bits in a long or unsigned long for the target machine. */ -#if !defined (TARGET_LONG_BIT) -#define TARGET_LONG_BIT (4 * TARGET_CHAR_BIT) -#endif - -/* Number of bits in a long long or unsigned long long for the target machine. */ -#if !defined (TARGET_LONG_LONG_BIT) -#define TARGET_LONG_LONG_BIT (2 * TARGET_LONG_BIT) -#endif - -/* Number of bits in a float for the target machine. */ -#if !defined (TARGET_FLOAT_BIT) -#define TARGET_FLOAT_BIT (4 * TARGET_CHAR_BIT) -#endif - -/* Number of bits in a double for the target machine. */ -#if !defined (TARGET_DOUBLE_BIT) -#define TARGET_DOUBLE_BIT (8 * TARGET_CHAR_BIT) -#endif - -/* Number of bits in a long double for the target machine. */ -#if !defined (TARGET_LONG_DOUBLE_BIT) -#define TARGET_LONG_DOUBLE_BIT (2 * TARGET_DOUBLE_BIT) -#endif - -/* Number of bits in a pointer for the target machine */ -#if !defined (TARGET_PTR_BIT) -#define TARGET_PTR_BIT TARGET_INT_BIT -#endif - -/* Number of bits in a BFD_VMA for the target object file format. */ -#if !defined (TARGET_BFD_VMA_BIT) -#define TARGET_BFD_VMA_BIT TARGET_PTR_BIT -#endif - /* If we picked up a copy of CHAR_BIT from a configuration file (which may get it by including ) then use it to set the number of bits in a host char. If not, use the same size @@ -1160,8 +1251,12 @@ extern void floatformat_to_doublest (const struct floatformat *, char *, DOUBLEST *); extern void floatformat_from_doublest (const struct floatformat *, DOUBLEST *, char *); -extern DOUBLEST extract_floating (void *, int); +extern int floatformat_is_negative (const struct floatformat *, char *); +extern int floatformat_is_nan (const struct floatformat *, char *); +extern char *floatformat_mantissa (const struct floatformat *, char *); + +extern DOUBLEST extract_floating (void *, int); extern void store_floating (void *, int, DOUBLEST); /* On some machines there are bits in addresses which are not really @@ -1229,7 +1324,8 @@ extern void (*readline_end_hook) (void); extern void (*register_changed_hook) (int regno); extern void (*memory_changed_hook) (CORE_ADDR addr, int len); extern void (*context_hook) (int); -extern int (*target_wait_hook) (int pid, struct target_waitstatus * status); +extern ptid_t (*target_wait_hook) (ptid_t ptid, + struct target_waitstatus * status); extern void (*attach_hook) (void); extern void (*detach_hook) (void); @@ -1257,51 +1353,24 @@ extern int use_windows; #define DIRNAME_SEPARATOR ':' #endif -#ifndef SLASH_P -#if defined(__GO32__)||defined(_WIN32) -#define SLASH_P(X) ((X)=='\\') -#else -#define SLASH_P(X) ((X)=='/') -#endif -#endif - -#ifndef SLASH_CHAR -#if defined(__GO32__)||defined(_WIN32) -#define SLASH_CHAR '\\' -#else -#define SLASH_CHAR '/' -#endif -#endif - #ifndef SLASH_STRING -#if defined(__GO32__)||defined(_WIN32) +#ifdef _WIN32 #define SLASH_STRING "\\" #else #define SLASH_STRING "/" #endif #endif -#ifndef ROOTED_P -#define ROOTED_P(X) (SLASH_P((X)[0])) -#endif - -/* On some systems, PIDGET is defined to extract the inferior pid from - an internal pid that has the thread id and pid in seperate bit - fields. If not defined, then just use the entire internal pid as - the actual pid. */ +/* Provide default definitions of PIDGET, TIDGET, and MERGEPID. + The name ``TIDGET'' is a historical accident. Many uses of TIDGET + in the code actually refer to a lightweight process id, i.e, + something that can be considered a process id in its own right for + certain purposes. */ #ifndef PIDGET -#define PIDGET(PID) (PID) -#define TIDGET(PID) 0 -#define MERGEPID(PID, TID) (PID) -#endif - -/* If under Cygwin, provide backwards compatibility with older - Cygwin compilers that don't define the current cpp define. */ -#ifdef __CYGWIN32__ -#ifndef __CYGWIN__ -#define __CYGWIN__ -#endif +#define PIDGET(PTID) (ptid_get_pid (PTID)) +#define TIDGET(PTID) (ptid_get_lwp (PTID)) +#define MERGEPID(PID, TID) ptid_build (PID, TID, 0) #endif /* Define well known filenos if the system does not define them. */