🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #10102

Patches to GDB 3.5's wait.h for SunOS 4.1 and Posix

#10102
From: Paul Eggert
Date: Sat, 05 May 1990 23:06
109 lines
4197 bytes
GDB 3.5's wait.h defines the macros WSTOPSIG and WTERMSIG.  However,
<sys/wait.h> also defines these macros under SunOS 4.1.  The definitions
disagree textually, so errors are generated while compiling GDB under SunOS
4.1.  Fortunately, the definitions agree semantically, but GDB should use
<sys/wait.h>'s macros if they exist.

Also, GDB uses WRETCODE(x) to mean the same thing that Posix denotes by
WEXITSTATUS(w).  It's better to use the standard name, so the following patch
switches to the Posix name.

===================================================================
RCS file: RCS/wait.h,v
retrieving revision 3.5
diff -c -r3.5 wait.h
*** /tmp/RCSAa02226	Sat May  5 15:45:58 1990
--- wait.h	Thu May  3 15:11:56 1990
***************
*** 4,27 ****
     But on vanilla-ish USG systems there is not.  */
  
  #ifndef HAVE_WAIT_STRUCT
  #define WAITTYPE int
  #define WIFSTOPPED(w) (((w)&0377) == 0177)
  #define WIFSIGNALED(w) (((w)&0377) != 0177 && ((w)&~0377) == 0)
  #define WIFEXITED(w) (((w)&0377) == 0)
! #define WRETCODE(w) ((w) >> 8)
  #define WSTOPSIG(w) ((w) >> 8)
  #define WCOREDUMP(w) (((w)&0200) != 0)
  #define WTERMSIG(w) ((w) & 0177)
  #define WSETEXIT(w, status) ((w) = (status))
  #define WSETSTOP(w,sig)  ((w) = (0177 | ((sig) << 8)))
  #else
  #include <sys/wait.h>
  #define WAITTYPE union wait
! #define WRETCODE(w) (w).w_retcode
  #define WSTOPSIG(w) (w).w_stopsig
  #define WCOREDUMP(w) (w).w_coredump
  #define WTERMSIG(w) (w).w_termsig
  #define WSETEXIT(w, status) ((w).w_status = (status))
  #define WSETSTOP(w,sig)  \
    ((w).w_stopsig = (sig), (w).w_coredump = 0, (w).w_termsig = 0177)
  #endif
--- 4,44 ----
     But on vanilla-ish USG systems there is not.  */
  
  #ifndef HAVE_WAIT_STRUCT
+ 
  #define WAITTYPE int
  #define WIFSTOPPED(w) (((w)&0377) == 0177)
  #define WIFSIGNALED(w) (((w)&0377) != 0177 && ((w)&~0377) == 0)
  #define WIFEXITED(w) (((w)&0377) == 0)
! #define WEXITSTATUS(w) ((w) >> 8)
  #define WSTOPSIG(w) ((w) >> 8)
  #define WCOREDUMP(w) (((w)&0200) != 0)
  #define WTERMSIG(w) ((w) & 0177)
  #define WSETEXIT(w, status) ((w) = (status))
  #define WSETSTOP(w,sig)  ((w) = (0177 | ((sig) << 8)))
+ 
  #else
+ 
  #include <sys/wait.h>
+ 
  #define WAITTYPE union wait
! #ifndef WEXITSTATUS
! #define WEXITSTATUS(w) (w).w_retcode
! #endif
! #ifndef WSTOPSIG
  #define WSTOPSIG(w) (w).w_stopsig
+ #endif
+ #ifndef WCOREDUMP
  #define WCOREDUMP(w) (w).w_coredump
+ #endif
+ #ifndef WTERMSIG
  #define WTERMSIG(w) (w).w_termsig
+ #endif
+ #ifndef WSETEXIT
  #define WSETEXIT(w, status) ((w).w_status = (status))
+ #endif
+ #ifndef WSETSTOP
  #define WSETSTOP(w,sig)  \
    ((w).w_stopsig = (sig), (w).w_coredump = 0, (w).w_termsig = 0177)
+ #endif
+ 
  #endif
===================================================================
RCS file: RCS/infrun.c,v
retrieving revision 3.5
diff -c -r3.5 infrun.c
*** /tmp/RCSAa02226	Sat May  5 15:45:59 1990
--- infrun.c	Thu May  3 15:14:09 1990
***************
*** 515,522 ****
        if (WIFEXITED (w))
  	{
  	  terminal_ours_for_output ();
! 	  if (WRETCODE (w))
! 	    printf ("\nProgram exited with code 0%o.\n", WRETCODE (w));
  	  else
  	    printf ("\nProgram exited normally.\n");
  	  fflush (stdout);
--- 515,522 ----
        if (WIFEXITED (w))
  	{
  	  terminal_ours_for_output ();
! 	  if (WEXITSTATUS (w))
! 	    printf ("\nProgram exited with code 0%o.\n", WEXITSTATUS (w));
  	  else
  	    printf ("\nProgram exited normally.\n");
  	  fflush (stdout);
Technical Details
Message-ID: <9005052306.AA02267@spot.twinsun.com>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!snorkelwacker!tut.cis.ohio-state.edu!spot.twinsun.com!eggert

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,b28ca9d4f6aebad6,start
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 1990-05-05 23:54:04 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!snorkelwacker!tut.cis.ohio-state.edu!spot.twinsun.com!eggert
From: eggert@spot.twinsun.com (Paul Eggert)
Newsgroups: gnu.gdb.bug
Subject: Patches to GDB 3.5's wait.h for SunOS 4.1 and Posix
Message-ID: <9005052306.AA02267@spot.twinsun.com>
Date: 5 May 90 23:06:21 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 109
Posted: Sun May  6 00:06:21 1990