From: ari@tron.gun.DE (Andreas Arens)
Subject: SCO (maybe any SYSV32) core problem
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 28 Jul 1992 15:27:00 GMT

Gdb (no Version since 3.6, including 4.6) is not able to handle core-files on 
SCO-Unix (3.2.2 and 3.2.4). Core-file are not recognized as such and therefor
cannot be used. This is probably true for other SYSV386 (i.e. Interactive) 
also. 

The Problem can be solved (at least with SCO) the following way:

SCO uses some kind of TRADITIONAL-CORE with a few extensions, but just defining
TRAD_CORE in bfd does not do the job. Apply the following patches to 
"trad-core.c" to enable its compilation (Make sure that your compiler defines
M_UNIX, cc does):

================================
*** trad-core.c	Tue Jan 28 23:53:18 1992
--- ../../my-gdb-4.6/bfd/trad-core.c	Sat Jul 25 12:49:03 1992
***************
*** 36,42 ****
--- 36,50 ----
  #include <sys/param.h>
  #include <sys/dir.h>
  #include <signal.h>
+ #ifdef M_UNIX
+ #include <sys/reg.h>
+ #define NBPG NBPC
+ #define UPAGES USIZE
+ #define HOST_STACK_END_ADDR 0x80000000
+ #define HOST_DATA_START_ADDR u.u_exdata.ux_datorg;
+ #else
  #include <machine/reg.h>
+ #endif
  
  #include <sys/user.h>		/* After a.out.h  */
  #include <sys/file.h>
================================

Make also sure that your Makefile defines "FASCIST_FDOPEN" within bfd, since
this is required for the 3.2.2 development system libraries.

Here is a piece of my bfd/Makefile:

================================
#### host and target dependent Makefile fragments come in here.
# Target:  Intel 386 running coff.
TDEFAULTS = -DDEFAULT_VECTOR=i386coff_vec
RANLIB = /bin/true
ALLOCA = alloca.o
HDEFINES = -DUSG -DTRAD_CORE -DFASCIST_FDOPEN
HDEPFILES=trad-core.o
###
================================

The SCO grep/make also has a small problem "unresolved '('" in the libiberty
Makefile. Here is a patch:

================================
*** Makefile.in	Sat Jun 20 00:18:14 1992
--- ../../my-gdb-4.6/libiberty/Makefile.in	Sun Jul 26 01:59:04 1992
***************
*** 131,135 ****
  	echo "# !Automatically generated from $(srcdir)/functions.def"\
  	  "- DO NOT EDIT!" >needed.awk
! 	grep '^DEF(' < $(srcdir)/functions.def \
  	    | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf \"\1\.o " }|' \
  	    >>needed.awk
--- 131,135 ----
  	echo "# !Automatically generated from $(srcdir)/functions.def"\
  	  "- DO NOT EDIT!" >needed.awk
! 	grep '^DEF\(' < $(srcdir)/functions.def \
  	    | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf \"\1\.o " }|' \
  	    >>needed.awk
***************
*** 145,152 ****
  	echo "# !Automatically generated from $(srcdir)/functions.def"\
  	  "- DO NOT EDIT!" >needed2.awk
! 	grep '^DEFVAR(' < $(srcdir)/functions.def \
  	 | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf \"#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
  	 >>needed2.awk
! 	grep '^DEFFUNC(' < $(srcdir)/functions.def \
  	 | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf \"#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
  	 >>needed2.awk
--- 145,152 ----
  	echo "# !Automatically generated from $(srcdir)/functions.def"\
  	  "- DO NOT EDIT!" >needed2.awk
! 	grep '^DEFVAR\(' < $(srcdir)/functions.def \
  	 | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf \"#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
  	 >>needed2.awk
! 	grep '^DEFFUNC\(' < $(srcdir)/functions.def \
  	 | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf \"#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
  	 >>needed2.awk
================================


I did a "./configure i386sco" at top level and made the above small changes
to the Makefiles and trad-core.c by hand. You also have to define out some
RANLIBs not used under System V.

This ends up with a working GDB4.6 that can read cores, handle backtraces,
and inspect contents of core-data.


===
Ari                             ari@tron.gun.de
Sun Jul 26 02:07:43 1992

Newsgroups: gnu.gdb.bug