* mips-tdep.c (mips_type_needs_double_align): New function.
[deliverable/binutils-gdb.git] / gdb / defs.h
index 2c90e4d0a88aa01434ff7315e7f3b924b02e77ab..9467fc74a8bbb0e4ea123a75b3bd5c1fb675b78a 100644 (file)
 
 #define GDB_MULTI_ARCH_PARTIAL 1
 
-/* The target is multi-arched.  The MULTI-ARCH vector provides all
-   definitions.  "tm.h" is included and may provide definitions of
-   non- multi-arch macros..  */
+/* The target is partially multi-arched. Both the multi-arch vector
+   and "tm.h" provide definitions. "tm.h" cannot override a definition
+   provided by the multi-arch vector.  It is detected as a compilation
+   error.
+
+   This setting is only useful during a multi-arch conversion. */
 
 #define GDB_MULTI_ARCH_TM 2
 
@@ -227,6 +230,213 @@ 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 remote 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,
+    /* Yet another pain, Linux/MIPS might go up to 128. */
+    TARGET_SIGNAL_REALTIME_65,
+    TARGET_SIGNAL_REALTIME_66,
+    TARGET_SIGNAL_REALTIME_67,
+    TARGET_SIGNAL_REALTIME_68,
+    TARGET_SIGNAL_REALTIME_69,
+    TARGET_SIGNAL_REALTIME_70,
+    TARGET_SIGNAL_REALTIME_71,
+    TARGET_SIGNAL_REALTIME_72,
+    TARGET_SIGNAL_REALTIME_73,
+    TARGET_SIGNAL_REALTIME_74,
+    TARGET_SIGNAL_REALTIME_75,
+    TARGET_SIGNAL_REALTIME_76,
+    TARGET_SIGNAL_REALTIME_77,
+    TARGET_SIGNAL_REALTIME_78,
+    TARGET_SIGNAL_REALTIME_79,
+    TARGET_SIGNAL_REALTIME_80,
+    TARGET_SIGNAL_REALTIME_81,
+    TARGET_SIGNAL_REALTIME_82,
+    TARGET_SIGNAL_REALTIME_83,
+    TARGET_SIGNAL_REALTIME_84,
+    TARGET_SIGNAL_REALTIME_85,
+    TARGET_SIGNAL_REALTIME_86,
+    TARGET_SIGNAL_REALTIME_87,
+    TARGET_SIGNAL_REALTIME_88,
+    TARGET_SIGNAL_REALTIME_89,
+    TARGET_SIGNAL_REALTIME_90,
+    TARGET_SIGNAL_REALTIME_91,
+    TARGET_SIGNAL_REALTIME_92,
+    TARGET_SIGNAL_REALTIME_93,
+    TARGET_SIGNAL_REALTIME_94,
+    TARGET_SIGNAL_REALTIME_95,
+    TARGET_SIGNAL_REALTIME_96,
+    TARGET_SIGNAL_REALTIME_97,
+    TARGET_SIGNAL_REALTIME_98,
+    TARGET_SIGNAL_REALTIME_99,
+    TARGET_SIGNAL_REALTIME_100,
+    TARGET_SIGNAL_REALTIME_101,
+    TARGET_SIGNAL_REALTIME_102,
+    TARGET_SIGNAL_REALTIME_103,
+    TARGET_SIGNAL_REALTIME_104,
+    TARGET_SIGNAL_REALTIME_105,
+    TARGET_SIGNAL_REALTIME_106,
+    TARGET_SIGNAL_REALTIME_107,
+    TARGET_SIGNAL_REALTIME_108,
+    TARGET_SIGNAL_REALTIME_109,
+    TARGET_SIGNAL_REALTIME_110,
+    TARGET_SIGNAL_REALTIME_111,
+    TARGET_SIGNAL_REALTIME_112,
+    TARGET_SIGNAL_REALTIME_113,
+    TARGET_SIGNAL_REALTIME_114,
+    TARGET_SIGNAL_REALTIME_115,
+    TARGET_SIGNAL_REALTIME_116,
+    TARGET_SIGNAL_REALTIME_117,
+    TARGET_SIGNAL_REALTIME_118,
+    TARGET_SIGNAL_REALTIME_119,
+    TARGET_SIGNAL_REALTIME_120,
+    TARGET_SIGNAL_REALTIME_121,
+    TARGET_SIGNAL_REALTIME_122,
+    TARGET_SIGNAL_REALTIME_123,
+    TARGET_SIGNAL_REALTIME_124,
+    TARGET_SIGNAL_REALTIME_125,
+    TARGET_SIGNAL_REALTIME_126,
+    TARGET_SIGNAL_REALTIME_127,
+
+#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
@@ -367,22 +577,10 @@ extern void free_current_contents (void *);
 
 extern void null_cleanup (void *);
 
-extern void xfree (void *);
-
 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);
@@ -567,7 +765,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 **);
 
@@ -712,6 +910,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;
+
 \f
 
 /* Optional host machine definition.  Pure autoconf targets will not
@@ -756,13 +987,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
 
 /* Defaults for system-wide constants (if not defined by xm.h, we fake it).
    FIXME: Assumes 2's complement arithmetic */
@@ -810,16 +1035,27 @@ 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);
@@ -917,11 +1153,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 <stdlib.h>
 #endif
 #ifndef min
@@ -1095,19 +1326,6 @@ extern char *floatformat_mantissa (const struct floatformat *, char *);
 extern DOUBLEST extract_floating (void *, int);
 extern void store_floating (void *, int, DOUBLEST);
 \f
-/* On some machines there are bits in addresses which are not really
-   part of the address, but are used by the kernel, the hardware, etc.
-   for special purposes.  ADDR_BITS_REMOVE takes out any such bits
-   so we get a "real" address such as one would find in a symbol
-   table.  This is used only for addresses of instructions, and even then
-   I'm not sure it's used in all contexts.  It exists to deal with there
-   being a few stray bits in the PC which would mislead us, not as some sort
-   of generic thing to handle alignment or segmentation (it's possible it
-   should be in TARGET_READ_PC instead). */
-#if !defined (ADDR_BITS_REMOVE)
-#define ADDR_BITS_REMOVE(addr) (addr)
-#endif /* No ADDR_BITS_REMOVE.  */
-
 /* From valops.c */
 
 extern CORE_ADDR push_bytes (CORE_ADDR, char *, int);
@@ -1160,7 +1378,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);
@@ -1188,43 +1407,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)
+#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.  */
@@ -1284,4 +1484,5 @@ enum gdb_rc gdb_list_thread_ids (/* output object */);
 
 /* Switch thread and print notification. */
 #endif
+
 #endif /* #ifndef DEFS_H */
This page took 0.028257 seconds and 4 git commands to generate.