From: pes@regent.e-technik.tu-muenchen.dbp.de (Peter Schauer)
Subject: gdb-4.6 patches for 386BSD 0.1
Organization: Technical University of Munich, Germany
Date: Fri, 14 Aug 1992 20:54:11 GMT


Here are the patches to gdb-4.6 to make it run under 386BSD 0.1.
Appply them with patch -p <this_message
Configure with i386-none-bsd386.
They make gdb-4.6 run under 386BSD 0.1.
They do not include kernel debugging facilities and floating point support.

Peter Schauer			pes@regent.e-technik.tu-muenchen.de

*** ./bfd/config/i386-bsd.mt.orig	Mon Aug 10 16:23:39 1992
--- ./bfd/config/i386-bsd.mt	Mon Aug 10 16:25:09 1992
***************
*** 0 ****
--- 1,3 ----
+ # Target:  Intel 386 running 386bsd using a.out
+ TDEFAULTS = -DDEFAULT_VECTOR=i386bsd_vec
+ TDEPFILES= i386bsd.o
*** ./bfd/config/i386bsd.mh.orig	Mon Aug 10 16:22:20 1992
--- ./bfd/config/i386bsd.mh	Mon Aug 10 16:22:12 1992
***************
*** 0 ****
--- 1,2 ----
+ HDEFINES=-DTRAD_CORE
+ HDEPFILES=trad-core.o
*** ./bfd/configure.in.orig	Wed Jul  8 10:01:12 1992
--- ./bfd/configure.in	Wed Aug 12 18:05:09 1992
***************
*** 84,89 ****
--- 84,90 ----
  		mach*)	my_host=i386mach ;;
  		msdos*)	my_host=dose ;;
  		linux)	my_host=i386linux ;;
+ 		bsd386)	my_host=i386bsd ;;
  		esac
  		;;
  	esac
***************
*** 205,210 ****
--- 206,212 ----
  *-*-solaris2*		) bfd_target=${target_cpu}-elf ;;
  *-*-go32		) bfd_target=${target_cpu}-aout ;;		
  *-*-linux*		) bfd_target=${target_cpu}-linux ;;
+ *-*-bsd386		) bfd_target=${target_cpu}-bsd ;;
  *-*-sysv*		) bfd_target=${target_cpu}-coff ;;
  *-*-scosysv*		) bfd_target=${target_cpu}-coff ;;
  tahoe-*-none		) bfd_target=${target_cpu} ;;
*** ./bfd/hosts/i386bsd.h.orig	Mon Aug 10 16:30:10 1992
--- ./bfd/hosts/i386bsd.h	Wed Aug 12 10:31:04 1992
***************
*** 0 ****
--- 1,47 ----
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <ctype.h>
+ #include <string.h>
+ #include <sys/file.h>
+ #include <stdlib.h>
+ #ifndef O_ACCMODE
+ #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
+ #endif
+ #define SEEK_SET 0
+ #define SEEK_CUR 1
+ 
+ /* fdopen() won't let you open read-only files for update */
+ #define	FASCIST_FDOPEN
+ 
+ #include <machine/param.h>
+ #include <machine/vmparam.h>
+ #define	HOST_PAGE_SIZE		NBPG
+ #define	HOST_MACHINE_ARCH	bfd_arch_i386
+ 
+ #define	HOST_TEXT_START_ADDR		USRTEXT
+ #define	HOST_STACK_END_ADDR (u.u_kproc.kp_eproc.e_vm.vm_maxsaddr + MAXSSIZ)
+ 
+ #define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \
+   ((core_bfd)->tdata.trad_core_data->u.u_sig)
+ #define u_comm u_kproc.kp_proc.p_comm
+ 
+ /* EXACT TYPES */
+ typedef char int8e_type;
+ typedef unsigned char uint8e_type;
+ typedef short int16e_type;
+ typedef unsigned short uint16e_type;
+ typedef int int32e_type;
+ typedef unsigned int uint32e_type;
+ 
+ /* CORRECT SIZE OR GREATER */
+ typedef char int8_type;
+ typedef unsigned char uint8_type;
+ typedef short int16_type;
+ typedef unsigned short uint16_type;
+ typedef int int32_type;
+ typedef unsigned int uint32_type;
+ 
+ #include "fopen-same.h"
*** ./bfd/i386bsd.c.orig	Mon Aug 10 16:26:59 1992
--- ./bfd/i386bsd.c	Mon Aug 10 16:26:52 1992
***************
*** 0 ****
--- 1,40 ----
+ /* BFD back-end for bsd386 a.out binaries.
+    Copyright (C) 1990, 1991 Free Software Foundation, Inc.
+ 
+ This file is part of BFD, the Binary File Descriptor library.
+ 
+ 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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+ 
+ #define	PAGE_SIZE	4096
+ #define	SEGMENT_SIZE	PAGE_SIZE
+ #define TEXT_START_ADDR	0
+ #define N_SHARED_LIB(n) 0
+ #define N_HEADER_IN_TEXT(n) 0
+ #define ARCH 32
+ #define BYTES_IN_WORD 4
+ 
+ #include "bfd.h"
+ #include "sysdep.h"
+ #include "libbfd.h"
+ #include "aout/aout64.h"
+ #include "aout/stab_gnu.h"
+ #include "aout/ar.h"
+ #include "libaout.h"           /* BFD a.out internal data structures */
+ 
+ #define DEFAULT_ARCH bfd_arch_i386
+ #define MY(OP) CAT(i386bsd_,OP)
+ #define TARGETNAME "a.out-bsd386"
+ 
+ #include "aout-target.h"
*** ./gdb/bsd386-xdep.c.orig	Mon Aug 10 20:28:33 1992
--- ./gdb/bsd386-xdep.c	Wed Aug 12 15:52:30 1992
***************
*** 0 ****
--- 1,59 ----
+ /* 386BSD host interface.
+    Copyright (C) 1988, 1989, 1991 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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+ 
+ #include "defs.h"
+ 
+ #include <machine/reg.h>
+ 
+ 
+ /* this table must line up with REGISTER_NAMES in tm-i386.h */
+ /* symbols like 'tEAX' come from <machine/reg.h> */
+ static int tregmap[] = 
+ {
+   tEAX, tECX, tEDX, tEBX,
+   tESP, tEBP, tESI, tEDI,
+   tEIP, tEFLAGS, tCS, tSS
+ };
+ static int sregmap[] = 
+ {
+   sEAX, sECX, sEDX, sEBX,
+   sESP, sEBP, sESI, sEDI,
+   sEIP, sEFLAGS, sCS, sSS
+ };
+ 
+ /* blockend is the value of u.u_ar0, and points to the
+    place where ES is stored.  */
+ 
+ int
+ i386_register_u_addr (blockend, regnum)
+      int blockend;
+      int regnum;
+ {
+   /* The following condition is a kludge to get at the proper register map
+      depending upon the state of pcb_flag.
+      The proper condition would be
+      if (u.u_pcb.pcb_flag & FM_TRAP)
+      but that would require a ptrace call here and wouldn't work
+      for corefiles.  */
+ 
+   if (blockend < 0x1fcc)
+     return (blockend + 4 * tregmap[regnum]);
+   else
+     return (blockend + 4 * sregmap[regnum]);
+ }
*** ./gdb/config/i386bsd.mh.orig	Mon Aug 10 20:48:42 1992
--- ./gdb/config/i386bsd.mh	Wed Aug 12 10:31:49 1992
***************
*** 0 ****
--- 1,5 ----
+ # Host: Intel 386 running 386BSD
+ XDEPFILES= infptrace.o coredep.o bsd386-xdep.o
+ XM_FILE= xm-386bsd.h
+ REGEX=regex.o
+ REGEX1=regex.o
*** ./gdb/config/i386bsd.mt.orig	Mon Aug 10 20:47:00 1992
--- ./gdb/config/i386bsd.mt	Wed Aug 12 18:44:43 1992
***************
*** 0 ****
--- 1,4 ----
+ # Target: Intel 386 with 386BSD
+  
+ TDEPFILES= exec.o i386-tdep.o i386-pinsn.o
+ TM_FILE= tm-386bsd.h
*** ./gdb/configure.in.orig	Wed Jul  8 10:01:38 1992
--- ./gdb/configure.in	Wed Aug 12 18:06:39 1992
***************
*** 109,114 ****
--- 109,115 ----
  		scosysv*) gdb_host=i386sco ;;
  		mach)	gdb_host=i386mach ;;
  		linux)	gdb_host=linux ;;
+ 		bsd386)	gdb_host=i386bsd ;;
  		esac
  		;;
  	esac
***************
*** 319,324 ****
--- 320,326 ----
  		coff)	gdb_target=i386v ;;
  		aout)	gdb_target=i386aout ;;
  		linux)	gdb_target=linux ;;
+ 		bsd386)	gdb_target=i386bsd ;;
  		esac
  	esac
  	;;
*** ./gdb/tm-386bsd.h.orig	Mon Aug 10 20:32:15 1992
--- ./gdb/tm-386bsd.h	Wed Aug 12 15:45:08 1992
***************
*** 0 ****
--- 1,34 ----
+ /* Macro definitions for i386 running under 386BSD.
+    Copyright (C) 1986, 1987, 1989, 1991 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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+ 
+ /* Override number of expected traps from sysv. */
+ #define START_INFERIOR_TRAPS_EXPECTED 2
+ 
+ /* Most definitions from sysv could be used. */
+ #include "tm-i386v.h"
+ 
+ /* Define this if the C compiler puts an underscore at the front
+    of external names before giving them to the linker.  */
+ #define NAMES_HAVE_UNDERSCORE
+ 
+ #undef FLOAT_INFO	/* No float info yet */
+ 
+ /* 386BSD cannot handle the segment registers. */
+ #undef NUM_REGS
+ #define NUM_REGS 12
*** ./gdb/xm-386bsd.h.orig	Mon Aug 10 20:19:28 1992
--- ./gdb/xm-386bsd.h	Wed Aug 12 18:46:57 1992
***************
*** 0 ****
--- 1,45 ----
+ /* Macro definitions for 386BSD.
+    Copyright (C) 1986, 1987, 1989 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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+ 
+ #define HOST_BYTE_ORDER LITTLE_ENDIAN
+ #define GDB_HOST_IS_I386
+ 
+ /* Avoid "INT_MIN redefined" warnings -- by defining it here, exactly
+    the same as in the system <machine/limits.h> file.  */
+ #undef	INT_MIN
+ #define	INT_MIN		(-0x7fffffff-1)
+ 
+ /* Get rid of any system-imposed stack limit if possible.  */
+ 
+ #define SET_STACK_LIMIT_HUGE
+ 
+ /* This is the amount to subtract from u.u_ar0
+    to get the offset in the core file of the register values.  */
+ 
+ #include <machine/vmparam.h>
+ #define KERNEL_U_ADDR USRSTACK
+ 
+ #define REGISTER_U_ADDR(addr, blockend, regno) \
+ 	(addr) = i386_register_u_addr ((blockend),(regno));
+ 
+ extern int
+ i386_register_u_addr PARAMS ((int, int));
+ 
+ #define PSIGNAL_IN_SIGNAL_H
+ #define PTRACE_ARG3_TYPE char*
Newsgroups: comp.unix.bsd