From: marc@dumbcat.sf.CA.US (Marco S Hyman)
Subject: Generating gdb-4.6 for 386/ix 2.0.2
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sun, 27 Sep 1992 21:45:48 GMT

The following is a patch file with the few changes needed to build gdb
version 4.6 using Interactive 386/ix 2.0.2.  Perhaps someone who has access
to other Sys V variants for the i386 can generalize these changes, making them
part of the next release.

// marc

# gdb-patches 27sep92 marc@dumbcat.sf.ca.us
#
# These are the patches required to compile gdb-4.6 for a 386 running SVR3.2,
# specifically release 2.0.2 of Interactive 386/ix using the naive cc compiler.
# Each diff is annotated.  A working gdb was generated by
#
#	1. unarchiving the gdb source
#	2. Applying these patches
#	3. ./configure i386v
#	4. make
#	5. make install
#
#----------------------------
# Patch #1: bfd/hosts/i386v.h
#
# SVR3 doesn't seem to have utime.h.  Also, the index/rindex defines are not
# needed and cause problems -- index is an often used variable name and the
# name of a structure member.
#
diff -u -r gdb-4.6-orig/bfd/hosts/i386v.h gdb-4.6/bfd/hosts/i386v.h
--- gdb-4.6-orig/bfd/hosts/i386v.h	Mon Jul  6 10:10:16 1992
+++ gdb-4.6/bfd/hosts/i386v.h	Sun Sep 27 12:21:56 1992
@@ -3,7 +3,9 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#if 0				/* not is SVR3.2 (386/ix 2.0.2) */
 #include <utime.h>
+#endif
 #include <ctype.h>
 #include <string.h>
 #include <unistd.h>
@@ -31,8 +33,10 @@
 #define bzero(s,n)		memset(s,0,n)
 
 #include <string.h>
+#if 0				/* won't compile when defined in SVR3.2 */
 #define index(s,c)		strchr(s,c)
 #define rindex(s,c)		strrchr(s,c)
+#endif
 
 /*
  * Might not need these. Leave them out for now.
#-------------------------
# Patch 2: gdb/i386-xdep.c
#
# This diff fixes an endif with the # not in column one.  The native
# cc on 386/ix 2.0.2 doesn't like this.
#
diff -u -r gdb-4.6-orig/gdb/i386-xdep.c gdb-4.6/gdb/i386-xdep.c
--- gdb-4.6-orig/gdb/i386-xdep.c	Wed Jun 24 10:32:49 1992
+++ gdb-4.6/gdb/i386-xdep.c	Sun Sep 27 12:04:07 1992
@@ -242,7 +242,7 @@
 	perror_with_name ("read from core file");
       skip = 0;
     }
- #endif	/* 0 */ 
+#endif	/* 0 */ 
 
   fpstatep = (struct fpstate *)(buf + skip);
   print_387_status (fpstatep->status, (struct env387 *)fpstatep->state);
#-------------------------
# Patch 3: gdb/xm-i386v.h
#
# TIOCGETC is broken on SVR3, too.  This section was copied from the SVR4
# configuration file.
#
diff -u -r gdb-4.6-orig/gdb/xm-i386v.h gdb-4.6/gdb/xm-i386v.h
--- gdb-4.6-orig/gdb/xm-i386v.h	Thu Feb 20 17:31:54 1992
+++ gdb-4.6/gdb/xm-i386v.h	Sun Sep 27 12:06:51 1992
@@ -38,6 +38,14 @@
 
 #define HAVE_TERMIO
 
+/* TIOCGETC and TIOCGLTC are picked up somewhere, but struct tchars
+   and struct ltchars are not.  This makes problems for inflow.c.
+   It is unknown at this time if this is a generic SVR3 problem or
+   one just limited to the initial SVR3 port host machine. */
+
+#define TIOCGETC_BROKEN
+#define TIOCGLTC_BROKEN
+
 /* This is the amount to subtract from u.u_ar0
    to get the offset in the core file of the register values.  */
 
#----------------------------
# Patch 4: glob/sysdep-norm.h
#
# sysdep-norm.h tries to play games when USG and TIOCGWINSZ are both defined.
# However, TIOCGWINSZ is checked before the file it is defined in is included.
# Also, USGrn is never defined.
#
diff -u -r gdb-4.6-orig/glob/sysdep-norm.h gdb-4.6/glob/sysdep-norm.h
--- gdb-4.6-orig/glob/sysdep-norm.h	Fri Nov 22 09:20:56 1991
+++ gdb-4.6/glob/sysdep-norm.h	Sun Sep 27 12:20:23 1992
@@ -11,11 +11,9 @@
 
 #include <sys/types.h>			/* Needed by dirent.h */
 
-#if defined (USG) && defined (TIOCGWINSZ)
+#if defined (USG) /* && defined (TIOCGWINSZ) */
 #include <sys/stream.h>
-#if defined (USGr4) || defined (USGr3)
 #include <sys/ptem.h>
-#endif /* USGr4 */
 #endif /* USG && TIOCGWINSZ */
 
 #include <dirent.h>
#--------------------------------
# Patch 5: readline/sysdep-norm.h
#
# same as patch 4, but for readline
diff -u -r gdb-4.6-orig/readline/sysdep-norm.h gdb-4.6/readline/sysdep-norm.h
--- gdb-4.6-orig/readline/sysdep-norm.h	Wed Jun 24 10:33:59 1992
+++ gdb-4.6/readline/sysdep-norm.h	Sun Sep 27 12:09:20 1992
@@ -13,11 +13,9 @@
 
 #include <sys/types.h>			/* Needed by dirent.h */
 
-#if defined (USG) && defined (TIOCGWINSZ)
+#if defined (USG) /* && defined (TIOCGWINSZ) */
 #include <sys/stream.h>
-#if defined (USGr4) || defined (USGr3)
 #include <sys/ptem.h>
-#endif /* USGr4 */
 #endif /* USG && TIOCGWINSZ */
 
 #include <dirent.h>