From 0f9bd807c985d7a830c49588e52139d5004013f6 Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Thu, 30 Apr 1998 08:03:50 +0000 Subject: [PATCH] Add support for ELF shared libraries. Also use bfd from the binutils in that case rather than gdb's own copy. --- gnu/usr.bin/binutils/gdb/Makefile | 33 +++++++++++++++++++++++++++--- gnu/usr.bin/binutils/gdb/i386/nm.h | 7 +++++++ gnu/usr.bin/gdb/gdb/Makefile | 33 +++++++++++++++++++++++++++--- gnu/usr.bin/gdb/gdb/nm.h | 7 +++++++ 4 files changed, 74 insertions(+), 6 deletions(-) diff --git a/gnu/usr.bin/binutils/gdb/Makefile b/gnu/usr.bin/binutils/gdb/Makefile index b75e304d312..8937114b181 100644 --- a/gnu/usr.bin/binutils/gdb/Makefile +++ b/gnu/usr.bin/binutils/gdb/Makefile @@ -1,12 +1,21 @@ -# $Id: Makefile,v 1.30 1998/03/07 08:54:42 bde Exp $ +# $Id: Makefile,v 1.31 1998/03/19 15:21:19 bde Exp $ PROG = gdb GDBDIR= ${.CURDIR}/../../../../contrib/gdb +.if ${BINFORMAT} == elf +BFDDIR= ${.CURDIR}/../../binutils/libbfd/${MACHINE_ARCH} +.else +BFDDIR= ${.CURDIR}/../bfd +.endif .PATH: ${GDBDIR}/gdb .PATH: ${GDBDIR}/opcodes -BINDIR= /usr/bin +.if ${BINFORMAT} == elf +CFLAGS+= -DFREEBSD_ELF +.endif + +BINDIR?= /usr/bin XSRCS = annotate.c blockframe.c breakpoint.c buildsym.c c-lang.c \ c-typeprint.c c-valprint.c ch-lang.c ch-typeprint.c \ ch-valprint.c coffread.c command.c complaints.c copying.c \ @@ -32,7 +41,7 @@ XSRCS = annotate.c blockframe.c breakpoint.c buildsym.c c-lang.c \ XSRCS+= i386-dis.c dis-buf.c disassemble.c SRCS= init.c ${XSRCS} -CFLAGS+= -I$(.CURDIR) -I${DESTDIR}/usr/include/readline -I$(.CURDIR)/../bfd +CFLAGS+= -I$(.CURDIR) -I${DESTDIR}/usr/include/readline -I${BFDDIR} # use phkmalloc CFLAGS+= -DNO_MMALLOC # uncomment the next line if you want to debug gdb @@ -40,6 +49,22 @@ CFLAGS+= -DNO_MMALLOC CLEANFILES+= c-exp.c f-exp.c m2-exp.c init.c y.tab.h init.c-tmp +.if ${BINFORMAT} == elf + +.if exists(${.OBJDIR}/../../binutils/libbfd) +LIBBFD= ${.OBJDIR}/../../binutils/libbfd/libbfd.a +.else +LIBBFD= ${.CURDIR}/../../binutils/libbfd/libbfd.a +.endif + +.if exists(${.OBJDIR}/../../binutils/libiberty) +LIBIBERTY= ${.OBJDIR}/../../binutils/libiberty/libiberty.a +.else +LIBIBERTY= ${.CURDIR}/../../binutils/libiberty/libiberty.a +.endif + +.else + .if exists(${.OBJDIR}/../bfd) LIBBFD= ${.OBJDIR}/../bfd/libbfd.a .else @@ -52,6 +77,8 @@ LIBIBERTY= ${.OBJDIR}/../libiberty/libiberty.a LIBIBERTY= ${.CURDIR}/../libiberty/libiberty.a .endif +.endif # BINFORMAT + DPADD= ${LIBBFD} ${LIBREADLINE} ${LIBGNUREGEX} ${LIBIBERTY} ${LIBTERMCAP} LDADD= ${LIBBFD} -lreadline -lgnuregex ${LIBIBERTY} -ltermcap DPADD+= ${LIBIBERTY} diff --git a/gnu/usr.bin/binutils/gdb/i386/nm.h b/gnu/usr.bin/binutils/gdb/i386/nm.h index 1edc1cecaf5..84ec01ea503 100644 --- a/gnu/usr.bin/binutils/gdb/i386/nm.h +++ b/gnu/usr.bin/binutils/gdb/i386/nm.h @@ -24,6 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Be shared lib aware */ #include "solib.h" +#ifdef FREEBSD_ELF +#define SVR4_SHARED_LIBS +#endif /* This is the amount to subtract from u.u_ar0 to get the offset in the core file of the register values. */ @@ -42,6 +45,8 @@ i386_register_u_addr PARAMS ((int, int)); #define PTRACE_ARG3_TYPE char* +#ifndef FREEBSD_ELF + /* make structure definitions match up with those expected in solib.c */ #define link_object sod #define lo_name sod_name @@ -95,6 +100,8 @@ i386_register_u_addr PARAMS ((int, int)); #define ld_un d_un #define ld_2 d_sdt +#endif + /* Return sizeof user struct to callers in less machine dependent routines */ #define KERNEL_U_SIZE kernel_u_size() diff --git a/gnu/usr.bin/gdb/gdb/Makefile b/gnu/usr.bin/gdb/gdb/Makefile index b75e304d312..8937114b181 100644 --- a/gnu/usr.bin/gdb/gdb/Makefile +++ b/gnu/usr.bin/gdb/gdb/Makefile @@ -1,12 +1,21 @@ -# $Id: Makefile,v 1.30 1998/03/07 08:54:42 bde Exp $ +# $Id: Makefile,v 1.31 1998/03/19 15:21:19 bde Exp $ PROG = gdb GDBDIR= ${.CURDIR}/../../../../contrib/gdb +.if ${BINFORMAT} == elf +BFDDIR= ${.CURDIR}/../../binutils/libbfd/${MACHINE_ARCH} +.else +BFDDIR= ${.CURDIR}/../bfd +.endif .PATH: ${GDBDIR}/gdb .PATH: ${GDBDIR}/opcodes -BINDIR= /usr/bin +.if ${BINFORMAT} == elf +CFLAGS+= -DFREEBSD_ELF +.endif + +BINDIR?= /usr/bin XSRCS = annotate.c blockframe.c breakpoint.c buildsym.c c-lang.c \ c-typeprint.c c-valprint.c ch-lang.c ch-typeprint.c \ ch-valprint.c coffread.c command.c complaints.c copying.c \ @@ -32,7 +41,7 @@ XSRCS = annotate.c blockframe.c breakpoint.c buildsym.c c-lang.c \ XSRCS+= i386-dis.c dis-buf.c disassemble.c SRCS= init.c ${XSRCS} -CFLAGS+= -I$(.CURDIR) -I${DESTDIR}/usr/include/readline -I$(.CURDIR)/../bfd +CFLAGS+= -I$(.CURDIR) -I${DESTDIR}/usr/include/readline -I${BFDDIR} # use phkmalloc CFLAGS+= -DNO_MMALLOC # uncomment the next line if you want to debug gdb @@ -40,6 +49,22 @@ CFLAGS+= -DNO_MMALLOC CLEANFILES+= c-exp.c f-exp.c m2-exp.c init.c y.tab.h init.c-tmp +.if ${BINFORMAT} == elf + +.if exists(${.OBJDIR}/../../binutils/libbfd) +LIBBFD= ${.OBJDIR}/../../binutils/libbfd/libbfd.a +.else +LIBBFD= ${.CURDIR}/../../binutils/libbfd/libbfd.a +.endif + +.if exists(${.OBJDIR}/../../binutils/libiberty) +LIBIBERTY= ${.OBJDIR}/../../binutils/libiberty/libiberty.a +.else +LIBIBERTY= ${.CURDIR}/../../binutils/libiberty/libiberty.a +.endif + +.else + .if exists(${.OBJDIR}/../bfd) LIBBFD= ${.OBJDIR}/../bfd/libbfd.a .else @@ -52,6 +77,8 @@ LIBIBERTY= ${.OBJDIR}/../libiberty/libiberty.a LIBIBERTY= ${.CURDIR}/../libiberty/libiberty.a .endif +.endif # BINFORMAT + DPADD= ${LIBBFD} ${LIBREADLINE} ${LIBGNUREGEX} ${LIBIBERTY} ${LIBTERMCAP} LDADD= ${LIBBFD} -lreadline -lgnuregex ${LIBIBERTY} -ltermcap DPADD+= ${LIBIBERTY} diff --git a/gnu/usr.bin/gdb/gdb/nm.h b/gnu/usr.bin/gdb/gdb/nm.h index 1edc1cecaf5..84ec01ea503 100644 --- a/gnu/usr.bin/gdb/gdb/nm.h +++ b/gnu/usr.bin/gdb/gdb/nm.h @@ -24,6 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Be shared lib aware */ #include "solib.h" +#ifdef FREEBSD_ELF +#define SVR4_SHARED_LIBS +#endif /* This is the amount to subtract from u.u_ar0 to get the offset in the core file of the register values. */ @@ -42,6 +45,8 @@ i386_register_u_addr PARAMS ((int, int)); #define PTRACE_ARG3_TYPE char* +#ifndef FREEBSD_ELF + /* make structure definitions match up with those expected in solib.c */ #define link_object sod #define lo_name sod_name @@ -95,6 +100,8 @@ i386_register_u_addr PARAMS ((int, int)); #define ld_un d_un #define ld_2 d_sdt +#endif + /* Return sizeof user struct to callers in less machine dependent routines */ #define KERNEL_U_SIZE kernel_u_size()