Article View: gnu.gdb.bug
Article #548(none)
From: Erik Forsberg
Date: Sat, 02 Jan 1993 13:44
Date: Sat, 02 Jan 1993 13:44
460 lines
15659 bytes
15659 bytes
Hello.
These are changes to GDB 4.7 in order to support it for
BSD/386 from BSDI. Unfortunately, because BSDI uses a new
a.out format (magic number 0314) it is kind of difficult to
merge it into the 386BSD support without pain. So these
changes adds the configuration option 'i386-unknown-bsdi'
First are a set of context diffs, followed by a set of
new files in a shell archive.
diff -c -r gdb-4.7/bfd/Makefile.in gdb/bfd/Makefile.in
*** gdb-4.7/bfd/Makefile.in Fri Oct 9 09:43:48 1992
--- gdb/bfd/Makefile.in Sat Jan 2 15:06:49 1993
***************
*** 81,87 ****
aout-adobe.o \
coff-i960.o coff-a29k.o coff-m68k.o coff-i386.o coff-m88k.o \
coff-mips.o coff-rs6000.o coff-h8300.o coff-msym.o hppa.o i386linux.o \
! coff-z8k.o coff-we32k.o i386bsd.o
OPTIONAL_BACKENDS = trad-core.o
--- 81,87 ----
aout-adobe.o \
coff-i960.o coff-a29k.o coff-m68k.o coff-i386.o coff-m88k.o \
coff-mips.o coff-rs6000.o coff-h8300.o coff-msym.o hppa.o i386linux.o \
! coff-z8k.o coff-we32k.o i386bsd.o i386bsdi.o
OPTIONAL_BACKENDS = trad-core.o
***************
*** 112,118 ****
oasys.c ieee.c coff-m68k.c coff-a29k.c coff-rs6000.c coff-msym.c \
format.c section.c core.c syms.c stab-syms.c reloc.c init.c ctor.c \
seclet.c coff-m88k.c coff-mips.c trad-core.c newsos3.c i386aout.c \
! i386linux.c bout.c elf.c aout-adobe.c coff-we32k.c i386bsd.c \
cpu-h8300.c cpu-i960.c cpu-sparc.c cpu-m68k.c cpu-m88k.c cpu-vax.c \
cpu-mips.c cpu-a29k.c cpu-i386.c cpu-rs6000.c coff-h8300.c hppa.c \
cpu-hppa.c cpu-we32k.c
--- 112,118 ----
oasys.c ieee.c coff-m68k.c coff-a29k.c coff-rs6000.c coff-msym.c \
format.c section.c core.c syms.c stab-syms.c reloc.c init.c ctor.c \
seclet.c coff-m88k.c coff-mips.c trad-core.c newsos3.c i386aout.c \
! i386linux.c bout.c elf.c aout-adobe.c coff-we32k.c i386bsd.c i386bsdi.c \
cpu-h8300.c cpu-i960.c cpu-sparc.c cpu-m68k.c cpu-m88k.c cpu-vax.c \
cpu-mips.c cpu-a29k.c cpu-i386.c cpu-rs6000.c coff-h8300.c hppa.c \
cpu-hppa.c cpu-we32k.c
***************
*** 365,370 ****
--- 365,373 ----
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
$(INCDIR)/aout/ar.h libaout.h
i386bsd.o : i386bsd.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
+ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
+ $(INCDIR)/aout/ar.h libaout.h
+ i386bsdi.o : i386bsdi.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
$(INCDIR)/aout/ar.h libaout.h
bout.o : bout.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
Only in gdb/bfd/config: i386-bsdi.mt
Only in gdb/bfd/config: i386bsdi.mh
diff -c -r gdb-4.7/bfd/configure.host gdb/bfd/configure.host
*** gdb-4.7/bfd/configure.host Fri Oct 9 04:38:25 1992
--- gdb/bfd/configure.host Sat Jan 2 14:57:11 1993
***************
*** 22,27 ****
--- 22,28 ----
hppa*-hp-hpux) my_host=hppahpux ;;
hppa*-hp-bsd) my_host=hppabsd ;;
+ i[34]86-*-bsdi) my_host=i386bsdi ;;
i[34]86-*-bsd) my_host=i386bsd ;;
i[34]86-ncr*-sysv4*) my_host=ncr3000 ;;
i[34]86-*-go32) my_host=go32 ;;
diff -c -r gdb-4.7/bfd/configure.in gdb/bfd/configure.in
*** gdb-4.7/bfd/configure.in Fri Oct 23 01:39:13 1992
--- gdb/bfd/configure.in Sat Jan 2 15:42:18 1993
***************
*** 48,53 ****
--- 48,54 ----
i[34]86-*-sysv4*) bfd_target=i386-elf ;;
i[34]86-*-sysv*) bfd_target=i386-coff ;;
i[34]86-*-sco*) bfd_target=i386-coff ;;
+ i[34]86-*-bsdi*) bfd_target=i386-bsdi ;;
i[34]86-*-bsd*) bfd_target=i386-bsd ;;
i[34]86-none-*) bfd_target=i386-coff ;;
i960-*-vxworks) bfd_target=i960-bout ;;
Only in gdb/bfd/hosts: i386bsdi.h
Only in gdb/bfd: i386bsdi.c
diff -c -r gdb-4.7/bfd/targets.c gdb/bfd/targets.c
*** gdb-4.7/bfd/targets.c Thu Oct 8 13:18:08 1992
--- gdb/bfd/targets.c Sat Jan 2 15:09:49 1993
***************
*** 398,403 ****
--- 398,404 ----
extern bfd_target i386coff_vec;
extern bfd_target i386aout_vec;
extern bfd_target i386linux_vec;
+ extern bfd_target i386bsdi_vec;
extern bfd_target a29kcoff_big_vec;
extern bfd_target trad_core_vec;
extern bfd_target rs6000coff_vec;
diff -c -r gdb-4.7/bfd/trad-core.c gdb/bfd/trad-core.c
*** gdb-4.7/bfd/trad-core.c Thu Oct 8 13:18:09 1992
--- gdb/bfd/trad-core.c Sat Jan 2 20:54:07 1993
***************
*** 189,195 ****
--- 189,199 ----
trad_unix_core_file_failing_signal (ignore_abfd)
bfd *ignore_abfd;
{
+ #ifdef TRAD_UNIX_CORE_FILE_FAILING_SIGNAL
+ return(TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(ignore_abfd));
+ #else
return -1; /* FIXME, where is it? */
+ #endif
}
/* ARGSUSED */
diff -c -r gdb-4.7/config.sub gdb/config.sub
*** gdb-4.7/config.sub Fri Oct 23 04:06:24 1992
--- gdb/config.sub Sat Jan 2 19:04:50 1993
***************
*** 165,170 ****
--- 165,174 ----
basic_machine=i386-unknown
os=-bsd
;;
+ i386-bsdi* | bsd386 | 386bsdi | bsdi)
+ basic_machine=i386-unknown
+ os=-bsdi
+ ;;
spur)
basic_machine=spur-unknown
;;
Only in gdb/gdb/config: i386bsdi.mt
diff -c -r gdb-4.7/gdb/configure.in gdb/gdb/configure.in
*** gdb-4.7/gdb/configure.in Wed Oct 14 15:50:18 1992
--- gdb/gdb/configure.in Sat Jan 2 18:59:55 1993
***************
*** 124,129 ****
--- 124,130 ----
i[34]86-*-coff) gdb_target=i386v ;;
i[34]86-*-elf) gdb_target=i386v ;;
+ i[34]86-*-bsdi*) gdb_target=i386bsdi ;;
i[34]86-*-bsd*) gdb_target=i386bsd ;;
i[34]86-*-solaris*) gdb_target=i386sol2 ;;
i[34]86-*-sunos*) gdb_target=sun386 ;;
***************
*** 237,243 ****
files="${files} ${targetfile}"
links="${links} tm.h"
fi
! rm -f nat.h
if [ "${nativefile}" != "" ]; then
files="${files} ${nativefile}"
links="${links} nm.h"
--- 238,244 ----
files="${files} ${targetfile}"
links="${links} tm.h"
fi
! rm -f nm.h
if [ "${nativefile}" != "" ]; then
files="${files} ${nativefile}"
links="${links} nm.h"
diff -c -r gdb-4.7/gdb/coredep.c gdb/gdb/coredep.c
*** gdb-4.7/gdb/coredep.c Wed Oct 21 19:07:09 1992
--- gdb/gdb/coredep.c Sat Jan 2 13:19:42 1993
***************
*** 23,30 ****
#include "defs.h"
#include <sys/types.h>
#include <sys/param.h>
- #include "gdbcore.h"
#include "nm.h"
/* These are needed on various systems to expand REGISTER_U_ADDR. */
#ifndef USG
--- 23,30 ----
#include "defs.h"
#include <sys/types.h>
#include <sys/param.h>
#include "nm.h"
+ #include "gdbcore.h"
/* These are needed on various systems to expand REGISTER_U_ADDR. */
#ifndef USG
diff -c -r gdb-4.7/gdb/i386b-nat.c gdb/gdb/i386b-nat.c
*** gdb-4.7/gdb/i386b-nat.c Fri Oct 16 12:16:49 1992
--- gdb/gdb/i386b-nat.c Sat Jan 2 20:32:45 1993
***************
*** 26,38 ****
{
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
--- 26,40 ----
{
tEAX, tECX, tEDX, tEBX,
tESP, tEBP, tESI, tEDI,
! tEIP, tEFLAGS, tCS, tSS,
! tDS, tES
};
static int sregmap[] =
{
sEAX, sECX, sEDX, sEBX,
sESP, sEBP, sESI, sEDI,
! sEIP, sEFLAGS, sCS, sSS,
! sSS, sSS
};
/* blockend is the value of u.u_ar0, and points to the
diff -c -r gdb-4.7/gdb/infptrace.c gdb/gdb/infptrace.c
*** gdb-4.7/gdb/infptrace.c Thu Oct 22 01:06:43 1992
--- gdb/gdb/infptrace.c Sat Jan 2 13:18:37 1993
***************
*** 19,28 ****
#include "defs.h"
#include "frame.h"
- #include "inferior.h"
#include "target.h"
#include "nm.h"
#ifdef USG
#include <sys/types.h>
--- 19,28 ----
#include "defs.h"
#include "frame.h"
#include "target.h"
#include "nm.h"
+ #include "inferior.h"
#ifdef USG
#include <sys/types.h>
Only in gdb/gdb: tm-i386bsdi.h
diff -c -r gdb-4.7/include/aout/aout64.h gdb/include/aout/aout64.h
*** gdb-4.7/include/aout/aout64.h Fri Oct 23 04:05:33 1992
--- gdb/include/aout/aout64.h Sat Jan 2 15:35:15 1993
***************
*** 31,39 ****
--- 31,41 ----
#define ZMAGIC 0413 /* Code indicating demand-paged executable. */
#endif
+ #ifndef N_BADMAG
#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
&& N_MAGIC(x) != NMAGIC \
&& N_MAGIC(x) != ZMAGIC)
+ #endif
/* By default, segment size is constant. But some machines override this
to be a function of the a.out header (e.g. machine type). */
***************
*** 129,135 ****
--- 131,139 ----
/* Offsets of the various portions of the file after the text segment. */
+ #ifndef N_DATOFF
#define N_DATOFF(x) ( N_TXTOFF(x) + N_TXTSIZE(x) )
+ #endif
#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data )
#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize )
#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize )
------------CUT HERE-----------------------------------------------------------
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# bfd/config/i386-bsdi.mt
# bfd/config/i386bsdi.mh
# bfd/hosts/i386bsdi.h
# bfd/i386bsdi.c
# gdb/config/i386bsdi.mt
# gdb/tm-i386bsdi.h
#
echo x - bfd/config/i386-bsdi.mt
sed 's/^X//' >bfd/config/i386-bsdi.mt << 'END-of-bfd/config/i386-bsdi.mt'
X# Target: Intel 386 running bsdi, using a.out
XTDEFAULTS = -DDEFAULT_VECTOR=i386bsdi_vec
END-of-bfd/config/i386-bsdi.mt
echo x - bfd/config/i386bsdi.mh
sed 's/^X//' >bfd/config/i386bsdi.mh << 'END-of-bfd/config/i386bsdi.mh'
XHDEFINES=-DTRAD_CORE
XHDEPFILES=trad-core.o
END-of-bfd/config/i386bsdi.mh
echo x - bfd/hosts/i386bsdi.h
sed 's/^X//' >bfd/hosts/i386bsdi.h << 'END-of-bfd/hosts/i386bsdi.h'
X/* Intel 386 running BSD/386 Unix )from BSD Inc. */
X#include <fcntl.h>
X#include <errno.h>
X#include <stdio.h>
X#include <stdlib.h>
X#include <sys/types.h>
X#include <sys/stat.h>
X#include <ctype.h>
X#include <string.h>
X#include <sys/file.h>
X#include <machine/param.h>
X#include <machine/vmparam.h>
X
X#ifndef O_ACCMODE
X#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
X#endif
X
X#define SEEK_SET 0
X#define SEEK_CUR 1
X
X#define HOST_PAGE_SIZE NBPG
X#define HOST_MACHINE_ARCH bfd_arch_i386
X#define HOST_TEXT_START_ADDR USRTEXT
X#define HOST_STACK_END_ADDR USRSTACK
X
X#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \
X ((core_bfd)->tdata.trad_core_data->u.u_sig)
X
X#define u_comm u_kproc.kp_proc.p_comm
X
X/* EXACT TYPES */
Xtypedef char int8e_type;
Xtypedef unsigned char uint8e_type;
Xtypedef short int16e_type;
Xtypedef unsigned short uint16e_type;
Xtypedef int int32e_type;
Xtypedef unsigned int uint32e_type;
X
X/* CORRECT SIZE OR GREATER */
Xtypedef char int8_type;
Xtypedef unsigned char uint8_type;
Xtypedef short int16_type;
Xtypedef unsigned short uint16_type;
Xtypedef int int32_type;
Xtypedef unsigned int uint32_type;
X
X#include "fopen-same.h"
END-of-bfd/hosts/i386bsdi.h
echo x - bfd/i386bsdi.c
sed 's/^X//' >bfd/i386bsdi.c << 'END-of-bfd/i386bsdi.c'
X/* BFD back-end for i386 a.out binaries under BSDI.
X Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
X
XThis file is part of BFD, the Binary File Descriptor library.
X
XThis program is free software; you can redistribute it and/or modify
Xit under the terms of the GNU General Public License as published by
Xthe Free Software Foundation; either version 2 of the License, or
X(at your option) any later version.
X
XThis program is distributed in the hope that it will be useful,
Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
XGNU General Public License for more details.
X
XYou should have received a copy of the GNU General Public License
Xalong with this program; if not, write to the Free Software
XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
X
X#define QMAGIC 0314 /* Compact demand-load format */
X
X#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
X && N_MAGIC(x) != NMAGIC \
X && N_MAGIC(x) != ZMAGIC \
X && N_MAGIC(x) != QMAGIC)
X
X#define PAGE_SIZE 4096
X#define SEGMENT_SIZE PAGE_SIZE
X#define DEFAULT_ARCH bfd_arch_i386
X#define BYTES_IN_WORD 4
X#define ARCH 32
X
X#define _NO_PAGE0(x) (N_MAGIC(x) == QMAGIC)
X#define _HOLE_IN_FILE(x) (N_MAGIC(x) == ZMAGIC || N_MAGIC(x) == QMAGIC)
X#define _HOLE_IN_ADDR(x) (_HOLE_IN_FILE(x) || N_MAGIC(x) == NMAGIC)
X
X#define N_HEADER_IN_TEXT(x) _NO_PAGE0(x)
X#define N_SHARED_LIB 0
X
X#define N_TXTSIZE(x) ((x).a_text)
X#define N_TXTADDR(x) (_NO_PAGE0(x) ? PAGE_SIZE : 0)
X#define N_TXTOFF(x) (_NO_PAGE0(x) ? 0 : (N_MAGIC(x) == ZMAGIC ? \
X PAGE_SIZE : EXEC_BYTES_SIZE))
X
X#define N_DATADDR(x) (N_TXTADDR(x) + (_HOLE_IN_ADDR(x) ? \
X (PAGE_SIZE + (x).a_text - 1 & ~(PAGE_SIZE-1)) : \
X (x).a_text))
X#define N_DATOFF(x) (N_TXTOFF(x) + (_HOLE_IN_FILE(x) ? \
X (PAGE_SIZE + (x).a_text - 1 & ~(PAGE_SIZE-1)) : \
X (x).a_text))
X
X#define MY(OP) CAT(i386bsdi_,OP)
X#define TARGETNAME "a.out-i386(bsdi)"
X
X#include "bfd.h"
X#include "sysdep.h"
X#include "libbfd.h"
X#include "libaout.h"
X
X#include "aout-target.h"
END-of-bfd/i386bsdi.c
echo x - gdb/config/i386bsdi.mt
sed 's/^X//' >gdb/config/i386bsdi.mt << 'END-of-gdb/config/i386bsdi.mt'
X# Target: Intel 386 running BSD
XTDEPFILES= i386-tdep.o i386-pinsn.o
XTM_FILE= tm-i386bsdi.h
END-of-gdb/config/i386bsdi.mt
echo x - gdb/tm-i386bsdi.h
sed 's/^X//' >gdb/tm-i386bsdi.h << 'END-of-gdb/tm-i386bsdi.h'
X/* Macro definitions for i386 running under BSDI Unix.
X Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
X
XThis file is part of GDB.
X
XThis program is free software; you can redistribute it and/or modify
Xit under the terms of the GNU General Public License as published by
Xthe Free Software Foundation; either version 2 of the License, or
X(at your option) any later version.
X
XThis program is distributed in the hope that it will be useful,
Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
XGNU General Public License for more details.
X
XYou should have received a copy of the GNU General Public License
Xalong with this program; if not, write to the Free Software
XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
X
X/* Override number of expected traps from sysv. */
X#define START_INFERIOR_TRAPS_EXPECTED 2
X
X/* Most definitions from sysv could be used. */
X#include "tm-i386v.h"
X
X/* Define this if the C compiler puts an underscore at the front
X of external names before giving them to the linker. */
X#define NAMES_HAVE_UNDERSCORE
X
X/* BSD/386 cannot handle all segment registers. */
X#undef NUM_REGS
X#define NUM_REGS 14
END-of-gdb/tm-i386bsdi.h
exit
Technical Details
Message-ID:
<9301030544.AA10884@eab.retix.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!eab.retix.COM!erikShow Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!eab.retix.COM!erik From: erik@eab.retix.COM (Erik Forsberg) Subject: (none) Message-ID: <9301030544.AA10884@eab.retix.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Sat, 2 Jan 1993 13:44:38 GMT Approved: bug-gdb@prep.ai.mit.edu Lines: 462