+Wed Feb 9 18:59:16 2000 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * Makefile.in (wait_h): Delete macro. Update all dependencies
+ specifying gdb_wait.h instead.
+
+ * ser-unix.c, ser-pipe.c, remote.c, remote-udi.c, remote-sds.c,
+ remote-os9k.c, remote-es.c, remote-rdp.c, remote-vx960.c,
+ remote-vx.c, remote-st.c, remote-nindy.c, remote-mm.c,
+ convex-xdep.c, convex-tdep.c, target.c, win32-nat.c, standalone.c,
+ remote-vxmips.c, remote-vxsparc.c, remote-vx68.c, remote-vx29k.c,
+ remote-sim.c, remote-rdi.c, remote-mips.c, remote-eb.c,
+ remote-e7000.c, remote-bug.c, remote-array.c, remote-adapt.c,
+ ppc-bdm.c, ocd.c, monitor.c, m3-nat.c, linux-thread.c,
+ infttrace.c, lin-thread.c, infptrace.c, gnu-nat.c, gdbarch.c,
+ fork-child.c, command.c: Include "gdb_wait.h" instead of <wait.h>
+ or <sys/wait.h>.
+
+ * gdb_wait.h: New file. Based on ../include/wait.h. Include
+ <sys/wait.h> or <wait.h> and then define any missing WIF macros.
+
Wed Feb 9 01:14:54 2000 Andrew Cagney <cagney@amy.cygnus.com>
* config/d10v/tm-d10v.h (NO_EXTRA_ALIGNMENT_NEEDED): Define.
floatformat_h = $(INCLUDE_DIR)/floatformat.h
bfd_h = $(BFD_DIR)/bfd.h
elf_bfd_h = $(BFD_SRC)/elf-bfd.h
-wait_h = $(INCLUDE_DIR)/wait.h
dis-asm_h = $(INCLUDE_DIR)/dis-asm.h
remote-sim_h = $(INCLUDE_DIR)/remote-sim.h
gdb_string.h
command.o: command.c $(defs_h) $(expression_h) $(gdbcmd_h) \
- $(gdbtypes_h) $(symtab_h) $(value_h) gdb_string.h $(wait_h)
+ $(gdbtypes_h) $(symtab_h) $(value_h) gdb_string.h gdb_wait.h
complaints.o: complaints.c complaints.h $(defs_h) $(gdbcmd_h)
-# OBSOLETE convex-tdep.o: convex-tdep.c $(wait_h) $(defs_h) $(gdbcmd_h) \
+# OBSOLETE convex-tdep.o: convex-tdep.c gdb_wait.h $(defs_h) $(gdbcmd_h) \
# OBSOLETE $(gdbcore_h) $(inferior_h)
# OBSOLETE convex-xdep.o: convex-xdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
demangle.o: demangle.c $(defs_h) $(gdbcmd_h) gdb_string.h
-dink32-rom.o: dink32-rom.c monitor.h $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \
+dink32-rom.o: dink32-rom.c monitor.h $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \
$(inferior_h) target.h serial.h terminal.h symfile.h
dpx2-nat.o: dpx2-nat.c $(defs_h) $(gdbcore_h) gdb_string.h
findvar.o: findvar.c $(defs_h) $(gdbcore_h) $(inferior_h) target.h \
gdb_string.h
-fork-child.o: fork-child.c $(wait_h) $(defs_h) $(gdbcore_h) \
+fork-child.o: fork-child.c gdb_wait.h $(defs_h) $(gdbcore_h) \
$(inferior_h) target.h terminal.h gdbthread.h gdb_string.h
gdbres.o: $(srcdir)/gdbtk/gdb.rc $(srcdir)/gdbtk/gdbtool.ico
hp300ux-nat.o: hp300ux-nat.c $(defs_h) $(gdbcore_h) $(inferior_h)
-hppa-tdep.o: hppa-tdep.c $(wait_h) $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
+hppa-tdep.o: hppa-tdep.c gdb_wait.h $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
$(inferior_h) objfiles.h symfile.h target.h
hppab-nat.o: hppab-nat.c $(bfd_h) $(defs_h) $(inferior_h) target.h
signals.h target.h terminal.h gdbthread.h gdb_string.h
infptrace.o: infptrace.c $(defs_h) $(gdbcore_h) $(inferior_h) target.h \
- gdb_string.h $(wait_h) $(command_h)
+ gdb_string.h gdb_wait.h $(command_h)
-infrun.o: infrun.c $(wait_h) $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
+infrun.o: infrun.c gdb_wait.h $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
$(inferior_h) target.h gdbthread.h gdb_string.h $(event_loop_h) \
$(event_top_h) target.h
-inftarg.o: inftarg.c $(wait_h) $(defs_h) $(gdbcore_h) $(inferior_h) \
+inftarg.o: inftarg.c gdb_wait.h $(defs_h) $(gdbcore_h) $(inferior_h) \
target.h terminal.h $(command_h)
irix4-nat.o: irix4-nat.c $(defs_h) $(inferior_h) $(gdbcore_h)
valprint.h m2-lang.h
m3-nat.o: m3-nat.c $(defs_h) $(inferior_h) $(value_h) language.h target.h \
- $(wait_h) $(gdbcmd_h) $(gdbcore_h)
+ gdb_wait.h $(gdbcmd_h) $(gdbcore_h)
m68k-tdep.o: m68k-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(value_h) \
$(gdbcore_h) gdb_string.h
mipsv4-nat.o: mipsv4-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) target.h
-monitor.o: monitor.c monitor.h $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \
+monitor.o: monitor.c monitor.h $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \
$(inferior_h) target.h serial.h terminal.h gdb_string.h
news-xdep.o: news-xdep.c
-Onindy.o: nindy-share/Onindy.c $(wait_h) nindy-share/block_io.h \
+Onindy.o: nindy-share/Onindy.c gdb_wait.h nindy-share/block_io.h \
nindy-share/env.h
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/nindy-share/Onindy.c
-nindy.o: nindy-share/nindy.c $(wait_h) nindy-share/block_io.h \
+nindy.o: nindy-share/nindy.c gdb_wait.h nindy-share/block_io.h \
nindy-share/env.h
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/nindy-share/nindy.c
gdb_string.h
ppc-bdm.o: ppc-bdm.c $(defs_h) $(gdbcore_h) gdb_string.h $(frame_h) \
- $(inferior_h) $(bfd_h) symfile.h target.h $(wait_h) $(gdbcmd_h) \
+ $(inferior_h) $(bfd_h) symfile.h target.h gdb_wait.h $(gdbcmd_h) \
objfiles.h gdb-stabs.h serial.h ocd.h
-ppcbug-rom.o: ppcbug-rom.c monitor.h $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \
+ppcbug-rom.o: ppcbug-rom.c monitor.h $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \
$(inferior_h) target.h serial.h terminal.h
printcmd.o: printcmd.c $(breakpoint_h) $(defs_h) $(expression_h) \
sol-thread.o: sol-thread.c $(defs_h) gdbthread.h target.h $(inferior_h) \
$(gdbcmd_h)
-linux-thread.o: linux-thread.c $(breakpoint_h) $(gdbcmd_h) $(wait_h) \
+linux-thread.o: linux-thread.c $(breakpoint_h) $(gdbcmd_h) gdb_wait.h \
gdbthread.h $(gdbcore_h) $(inferior_h) target.h $(defs_h)
# OBSOLETE pyr-tdep.o: pyr-tdep.c $(defs_h)
gnu-regex.o: gnu-regex.c gnu-regex.h $(defs_h) gdb_string.h
-remote-adapt.o: remote-adapt.c $(wait_h) $(defs_h) $(gdbcore_h) \
+remote-adapt.o: remote-adapt.c gdb_wait.h $(defs_h) $(gdbcore_h) \
$(inferior_h) target.h terminal.h gdb_string.h
-remote-array.o: remote-array.c $(wait_h) $(defs_h) $(gdbcore_h) target.h \
+remote-array.o: remote-array.c gdb_wait.h $(defs_h) $(gdbcore_h) target.h \
gdb_string.h $(command_h) serial.h monitor.h $(remote_utils_h) \
$(version_h)
-remote-rdi.o: remote-rdi.c $(wait_h) $(defs_h) $(gdbcore_h) \
+remote-rdi.o: remote-rdi.c gdb_wait.h $(defs_h) $(gdbcore_h) \
$(inferior_h) gdb_string.h
rdi-share/libangsd.a: force
true; \
fi
-remote-d10v.o: remote-d10v.c $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \
+remote-d10v.o: remote-d10v.c $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \
$(inferior_h) $(remote_utils_h) symfile.h terminal.h gdb_string.h
-remote-rdp.o: remote-rdp.c $(wait_h) $(defs_h) $(gdbcore_h) \
+remote-rdp.o: remote-rdp.c gdb_wait.h $(defs_h) $(gdbcore_h) \
$(inferior_h) gdb_string.h
-remote-bug.o: remote-bug.c $(wait_h) $(defs_h) $(gdbcore_h) \
+remote-bug.o: remote-bug.c gdb_wait.h $(defs_h) $(gdbcore_h) \
$(inferior_h) target.h terminal.h $(remote_utils_h) gdb_string.h
# FIXME: For the SH target, remote-e7000 contains numerous -Wformat
# handles the SH remote protocol the changes need to be tested against
# an SH board before they can be committed. cagney 1999-09-01.
remote-e7000.o: remote-e7000.c $(defs_h) $(gdbcore_h) target.h \
- $(wait_h) serial.h gdb_string.h
+ gdb_wait.h serial.h gdb_string.h
$(CC) -c $(INTERNAL_WARN_CFLAGS) $(NO_WERROR_CFLAGS) $<
-remote-eb.o: remote-eb.c $(wait_h) $(srcdir)/config/a29k/tm-a29k.h \
+remote-eb.o: remote-eb.c gdb_wait.h $(srcdir)/config/a29k/tm-a29k.h \
$(defs_h) $(gdbcore_h) $(inferior_h) symfile.h target.h terminal.h \
gdb_string.h
-remote-es.o: remote-es.c $(bfd_h) $(wait_h) $(command_h) $(defs_h) \
+remote-es.o: remote-es.c $(bfd_h) gdb_wait.h $(command_h) $(defs_h) \
$(inferior_h) $(remote_utils_h) terminal.h gdb_string.h
-remote-hms.o: remote-hms.c $(wait_h) $(defs_h) $(gdbcore_h) \
+remote-hms.o: remote-hms.c gdb_wait.h $(defs_h) $(gdbcore_h) \
$(inferior_h) serial.h target.h terminal.h gdb_string.h
-remote-mips.o: remote-mips.c $(wait_h) $(defs_h) $(gdbcmd_h) \
+remote-mips.o: remote-mips.c gdb_wait.h $(defs_h) $(gdbcmd_h) \
$(gdbcore_h) $(inferior_h) serial.h symfile.h target.h
-remote-mm.o: remote-mm.c $(bfd_h) $(wait_h) $(defs_h) $(inferior_h) \
+remote-mm.o: remote-mm.c $(bfd_h) gdb_wait.h $(defs_h) $(inferior_h) \
minimon.h target.h terminal.h gdb_string.h
-remote-nindy.o: remote-nindy.c $(floatformat_h) $(wait_h) $(command_h) \
+remote-nindy.o: remote-nindy.c $(floatformat_h) gdb_wait.h $(command_h) \
$(defs_h) $(gdbcore_h) $(inferior_h) \
nindy-share/env.h nindy-share/stop.h $(remote_utils_h) \
symfile.h
-remote-os9k.o: remote-os9k.c $(defs_h) $(gdbcore_h) $(wait_h) \
+remote-os9k.o: remote-os9k.c $(defs_h) $(gdbcore_h) gdb_wait.h \
$(command_h) monitor.h $(remote_utils_h) $(symtab_h) symfile.h \
objfiles.h gdb-stabs.h gdb_string.h
-remote-sds.o: remote-sds.c $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \
+remote-sds.o: remote-sds.c $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \
$(inferior_h) $(remote_utils_h) symfile.h terminal.h gdb_string.h
-remote-sim.o: remote-sim.c $(wait_h) $(defs_h) $(gdbcore_h) \
+remote-sim.o: remote-sim.c gdb_wait.h $(defs_h) $(gdbcore_h) \
$(inferior_h) target.h terminal.h gdb_string.h \
$(INCLUDE_DIR)/callback.h
-remote-st.o: remote-st.c $(wait_h) $(defs_h) $(gdbcore_h) serial.h \
+remote-st.o: remote-st.c gdb_wait.h $(defs_h) $(gdbcore_h) serial.h \
target.h gdb_string.h
-remote-udi.o: remote-udi.c $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \
+remote-udi.o: remote-udi.c $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \
$(inferior_h) target.h terminal.h $(udiheaders) gdb_string.h
-remote-vx.o: remote-vx.c $(wait_h) complaints.h $(defs_h) $(gdbcmd_h) \
+remote-vx.o: remote-vx.c gdb_wait.h complaints.h $(defs_h) $(gdbcmd_h) \
$(gdbcore_h) $(inferior_h) target.h vx-share/dbgRpcLib.h \
vx-share/ptrace.h vx-share/xdr_ld.h vx-share/xdr_ptrace.h \
vx-share/xdr_rdb.h gdb-stabs.h objfiles.h symfile.h $(bfd_h) \
gdb_string.h
-remote-vx29k.o: remote-vx29k.c $(wait_h) complaints.h $(defs_h) $(gdbcmd_h) \
+remote-vx29k.o: remote-vx29k.c gdb_wait.h complaints.h $(defs_h) $(gdbcmd_h) \
$(gdbcore_h) $(inferior_h) target.h vx-share/dbgRpcLib.h \
vx-share/ptrace.h vx-share/xdr_ld.h vx-share/xdr_ptrace.h \
vx-share/xdr_rdb.h gdb_string.h
ocd.o: ocd.c ocd.h $(gdbcore_h) gdb_string.h $(frame_h) $(inferior_h) \
- $(bfd_h) symfile.h target.h $(wait_h) $(gdbcmd_h) objfiles.h \
+ $(bfd_h) symfile.h target.h gdb_wait.h $(gdbcmd_h) objfiles.h \
gdb-stabs.h $(dcache_h) serial.h
remote-utils.o: remote-utils.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
$(inferior_h) $(remote_utils_h) gdb_string.h
-remote.o: remote.c $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \
+remote.o: remote.c $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \
$(inferior_h) $(remote_utils_h) symfile.h terminal.h gdb_string.h \
$(event_loop_h) $(event_top_h) $(remote_h) $(inf_loop_h)
-remote-nrom.o: remote-nrom.c $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \
+remote-nrom.o: remote-nrom.c $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \
$(inferior_h) $(remote_utils_h) symfile.h terminal.h
-rom68k-rom.o: rom68k-rom.c monitor.h $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \
+rom68k-rom.o: rom68k-rom.c monitor.h $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \
$(inferior_h) target.h serial.h terminal.h
rs6000-nat.o: rs6000-nat.c $(bfd_h) $(defs_h) $(inferior_h) target.h \
$(srcdir)/../opcodes/sh-opc.h $(defs_h) $(expression_h) $(frame_h) \
$(gdbcmd_h) $(gdbtypes_h) $(symtab_h) $(value_h)
-sh3-rom.o: sh3-rom.c monitor.h $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \
+sh3-rom.o: sh3-rom.c monitor.h $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \
$(inferior_h) target.h serial.h terminal.h
-mon960-rom.o: mon960-rom.c monitor.h $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \
+mon960-rom.o: mon960-rom.c monitor.h $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \
$(inferior_h) target.h serial.h terminal.h
solib.o: solib.c $(command_h) $(defs_h) $(gdbcore_h) $(inferior_h) \
--- /dev/null
+/* Standard wait macros.
+ Copyright 2000 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef GDB_WAIT_H
+#define GDB_WAIT_H
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h> /* POSIX */
+#else
+#ifdef HAVE_WAIT_H
+#include <wait.h> /* legacy */
+#endif
+#endif
+
+/* Define how to access the int that the wait system call stores.
+ This has been compatible in all Unix systems since time immemorial,
+ but various well-meaning people have defined various different
+ words for the same old bits in the same old int (sometimes claimed
+ to be a struct). We just know it's an int and we use these macros
+ to access the bits. */
+
+/* The following macros are defined equivalently to their definitions
+ in POSIX.1. We fail to define WNOHANG and WUNTRACED, which POSIX.1
+ <sys/wait.h> defines, since our code does not use waitpid() (but
+ NOTE exception for Linux below).
+ We also fail to declare wait() and waitpid(). */
+
+#ifndef WIFEXITED
+#define WIFEXITED(w) (((w)&0377) == 0)
+#endif
+
+#ifndef WIFSIGNALED
+#define WIFSIGNALED(w) (((w)&0377) != 0177 && ((w)&~0377) == 0)
+#endif
+
+#ifndef WIFSTOPPED
+#ifdef IBM6000
+
+/* Unfortunately, the above comment (about being compatible in all Unix
+ systems) is not quite correct for AIX, sigh. And AIX 3.2 can generate
+ status words like 0x57c (sigtrap received after load), and gdb would
+ choke on it. */
+
+#define WIFSTOPPED(w) ((w)&0x40)
+
+#else
+#define WIFSTOPPED(w) (((w)&0377) == 0177)
+#endif
+#endif
+
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(w) (((w) >> 8) & 0377) /* same as WRETCODE */
+#endif
+
+#ifndef WTERMSIG
+#define WTERMSIG(w) ((w) & 0177)
+#endif
+
+#ifndef WSTOPSIG
+#define WSTOPSIG WEXITSTATUS
+#endif
+
+/* These are not defined in POSIX, but are used by our programs. */
+
+#define WAITTYPE int
+
+#ifndef WCOREDUMP
+#define WCOREDUMP(w) (((w)&0200) != 0)
+#endif
+
+#ifndef WSETEXIT
+#define WSETEXIT(w,status) ((w) = (0 | ((status) << 8)))
+#endif
+
+#ifndef WSETSTOP
+#define WSETSTOP(w,sig) ((w) = (0177 | ((sig) << 8)))
+#endif
+
+/*
+ * For native Linux we may use waitpid and the __WCLONE option.
+ * <GRIPE> It is of course dangerous not to use the REAL header file...
+ * </GRIPE>
+ */
+
+/* Bits in the third argument to `waitpid'. */
+#ifndef WNOHANG
+#define WNOHANG 1 /* Don't block waiting. */
+#endif
+
+#ifndef WUNTRACED
+#define WUNTRACED 2 /* Report status of stopped children. */
+#endif
+
+#ifndef __WCLONE
+#define __WCLONE 0x80000000 /* Wait for cloned process. */
+#endif
+
+#endif