1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-28 01:06:17 +00:00

GDB is a source-level debugger for Ada, C, C++, Objective-C, Pascal and

many other languages.  GDB can target (i.e., debug programs running on)
more than a dozen different processor architectures, and GDB itself can
run on most popular GNU/Linux, Unix and Microsoft Windows variants.

This version of gdb has been modified by jhb@ to recognize freebsd threads

Reviewed by:	John Baldwin <jhb@FreeBSD.org>, swell.k@gmail.com
This commit is contained in:
Steven Kreuzer 2010-11-16 20:39:48 +00:00
parent cdcf5ddf92
commit ade713343b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=264650
15 changed files with 1989 additions and 0 deletions

View File

@ -456,6 +456,7 @@
SUBDIR += gconfmm
SUBDIR += gconfmm26
SUBDIR += gcvs
SUBDIR += gdb
SUBDIR += gdb53-act
SUBDIR += gdb6
SUBDIR += gdbmods

67
devel/gdb/Makefile Normal file
View File

@ -0,0 +1,67 @@
# ex:ts=8
# Ports collection makefile for: GDB 7.1
# Date created: 16 November 2010
# Whom: Steven Kreuzer <skreuzer@FreeBSD.org>
#
# $FreeBSD$
#
PORTNAME= gdb
PORTVERSION= 7.1
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_GNU:S,$,:gdb,}
MASTER_SITE_SUBDIR=gdb/:gdb
DISTFILES= ${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}:gdb
MAINTAINER= skreuzer@FreeBSD.org
COMMENT= GNU GDB of newer version than comes with the system
LICENSE= GPLv3
USE_BZIP2= yes
USE_GMAKE= yes
USE_ICONV= yes
GNU_CONFIGURE= yes
CONFIGURE_ENV+= CONFIGURED_M4=m4 CONFIGURED_BISON=byacc LDFLAGS="${LDFLAGS}"
CONFIGURE_ARGS= --program-suffix=${PORTVERSION:S/.//g} \
--with-libiconv-prefix=${LOCALBASE} \
--with-system-readline \
--without-expat \
--without-libunwind \
--without-python \
--enable-target=all \
--enable-tui
CFLAGS:= ${CFLAGS:C/ +$//} # blanks at EOL creep in sometimes
CFLAGS+= -I${LOCALBASE}/include
CFLAGS+= -DRL_NO_COMPAT
LDFLAGS+= -L${LOCALBASE}/lib
EXCLUDE= dejagnu expect readline sim texinfo intl
EXTRACT_AFTER_ARGS=| ${TAR} -xf - ${EXCLUDE:S/^/--exclude /}
VER= ${PORTVERSION:S/.//}
PLIST_SUB= VER=${VER}
MAN1= gdb${VER}.1
ONLY_FOR_ARCHS= i386 amd64 # untested elsewhere, might work
.include <bsd.port.pre.mk>
# XXX: add OSVERSION check after readline is removed from base
.if exists(${LOCALBASE}/lib/libreadline.so)
LIB_DEPENDS+= readline.6:${PORTSDIR}/devel/readline
.endif
.if ${ARCH} == "amd64"
CONFIGURE_TARGET= x86_64-portbld-freebsd${OSREL}
.endif
post-patch:
@${REINPLACE_CMD} -e 's/$$/ [GDB v${PORTVERSION} for FreeBSD]/' \
${WRKSRC}/gdb/version.in
@${CP} ${FILESDIR}/fbsd-threads.c ${WRKSRC}/gdb
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/gdb/gdb ${PREFIX}/bin/gdb${VER}
${LN} ${PREFIX}/bin/gdb${VER} ${PREFIX}/bin/gdbtui${VER}
${INSTALL_MAN} ${WRKSRC}/gdb/gdb.1 ${MAN1PREFIX}/man/man1/gdb${VER}.1
.include <bsd.port.post.mk>

3
devel/gdb/distinfo Normal file
View File

@ -0,0 +1,3 @@
MD5 (gdb-7.1.tar.bz2) = 21dce610476c054687b52770d2ddc657
SHA256 (gdb-7.1.tar.bz2) = 142c27d7970a4e652dc225d61d887777ae00cf22fdd75cd1e8e4e13bfbd85352
SIZE (gdb-7.1.tar.bz2) = 17977195

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,38 @@
--- gdb/Makefile.in.orig 2010-02-02 18:16:53.000000000 -0500
+++ gdb/Makefile.in 2010-10-13 16:09:43.312803000 -0400
@@ -524,7 +524,7 @@
xstormy16-tdep.o \
xtensa-config.o xtensa-tdep.o xtensa-linux-tdep.o \
glibc-tdep.o \
- bsd-uthread.o \
+ fbsd-threads.o \
nbsd-tdep.o obsd-tdep.o \
sol2-tdep.o \
solib-frv.o solib-irix.o solib-svr4.o solib-target.o \
@@ -720,7 +720,7 @@
gdbserver/linux-low.h gdbserver/gdb_proc_service.h \
gdbserver/regcache.h gdbthread.h dwarf2-frame.h nbsd-nat.h dcache.h \
amd64-nat.h s390-tdep.h arm-linux-tdep.h exceptions.h macroscope.h \
-gdbarch.h bsd-uthread.h gdb_thread_db.h gdb_stat.h memory-map.h \
+gdbarch.h gdb_thread_db.h gdb_stat.h memory-map.h \
mdebugread.h m88k-tdep.h stabsread.h hppa-linux-offsets.h linux-fork.h \
ser-unix.h scm-lang.h inf-ptrace.h terminal.h ui-out.h frame-base.h \
f-lang.h dwarf2loc.h value.h sparc-tdep.h defs.h target-descriptions.h \
@@ -1130,7 +1130,7 @@
# Removing the old gdb first works better if it is running, at least on SunOS.
gdb$(EXEEXT): gdb.o libgdb.a $(ADD_DEPS) $(CDEPS) $(TDEPLIBS)
rm -f gdb$(EXEEXT)
- $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
+ $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) -Wl,-E \
-o gdb$(EXEEXT) gdb.o libgdb.a \
$(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
@@ -1402,7 +1402,7 @@
arm-linux-nat.c arm-linux-tdep.c arm-tdep.c \
armnbsd-nat.c armbsd-tdep.c armnbsd-tdep.c armobsd-tdep.c \
avr-tdep.c \
- bsd-uthread.c bsd-kvm.c \
+ fbsd-threads.c bsd-kvm.c \
core-regset.c corelow.c \
dcache.c dicos-tdep.c darwin-nat.c \
exec.c \

View File

@ -0,0 +1,58 @@
--- gdb/amd64fbsd-nat.c.orig 2010-10-13 14:53:14.425152000 -0400
+++ gdb/amd64fbsd-nat.c 2010-10-13 15:15:01.080198000 -0400
@@ -27,6 +27,7 @@
#include <signal.h>
#include <stddef.h>
#include <sys/types.h>
+#include <sys/procfs.h>
#include <sys/ptrace.h>
#include <sys/sysctl.h>
#include <machine/reg.h>
@@ -92,6 +93,47 @@
};
+/* Transfering the registers between GDB, inferiors and core files. */
+
+/* Fill GDB's register array with the general-purpose register values
+ in *GREGSETP. */
+
+void
+supply_gregset (struct regcache *regcache, const gregset_t *gregsetp)
+{
+ amd64_supply_native_gregset (regcache, gregsetp, -1);
+}
+
+/* Fill register REGNUM (if it is a general-purpose register) in
+ *GREGSETPS with the value in GDB's register array. If REGNUM is -1,
+ do this for all registers. */
+
+void
+fill_gregset (struct regcache *regcache, gregset_t *gregsetp, int regnum)
+{
+ amd64_collect_native_gregset (regcache, gregsetp, regnum);
+}
+
+/* Fill GDB's register array with the floating-point register values
+ in *FPREGSETP. */
+
+void
+supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
+{
+ amd64_supply_fxsave (regcache, -1, fpregsetp);
+}
+
+/* Fill register REGNUM (if it is a floating-point register) in
+ *FPREGSETP with the value in GDB's register array. If REGNUM is -1,
+ do this for all registers. */
+
+void
+fill_fpregset (struct regcache *regcache, fpregset_t *fpregsetp, int regnum)
+{
+ amd64_collect_fxsave (regcache, regnum, fpregsetp);
+}
+
+
/* Support for debugging kernel virtual memory images. */
#include <sys/types.h>

View File

@ -0,0 +1,68 @@
--- gdb/amd64fbsd-tdep.c.orig 2010-09-30 13:31:19.930008000 -0400
+++ gdb/amd64fbsd-tdep.c 2010-09-30 13:39:30.673331000 -0400
@@ -29,7 +29,6 @@
#include "gdb_string.h"
#include "amd64-tdep.h"
-#include "bsd-uthread.h"
#include "solib-svr4.h"
/* Support for signal handlers. */
@@ -142,46 +141,6 @@
};
static void
-amd64fbsd_supply_uthread (struct regcache *regcache,
- int regnum, CORE_ADDR addr)
-{
- gdb_byte buf[8];
- int i;
-
- gdb_assert (regnum >= -1);
-
- for (i = 0; i < ARRAY_SIZE (amd64fbsd_jmp_buf_reg_offset); i++)
- {
- if (amd64fbsd_jmp_buf_reg_offset[i] != -1
- && (regnum == -1 || regnum == i))
- {
- read_memory (addr + amd64fbsd_jmp_buf_reg_offset[i], buf, 8);
- regcache_raw_supply (regcache, i, buf);
- }
- }
-}
-
-static void
-amd64fbsd_collect_uthread (const struct regcache *regcache,
- int regnum, CORE_ADDR addr)
-{
- gdb_byte buf[8];
- int i;
-
- gdb_assert (regnum >= -1);
-
- for (i = 0; i < ARRAY_SIZE (amd64fbsd_jmp_buf_reg_offset); i++)
- {
- if (amd64fbsd_jmp_buf_reg_offset[i] != -1
- && (regnum == -1 || regnum == i))
- {
- regcache_raw_collect (regcache, i, buf);
- write_memory (addr + amd64fbsd_jmp_buf_reg_offset[i], buf, 8);
- }
- }
-}
-
-static void
amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@@ -201,10 +160,6 @@
tdep->sc_reg_offset = amd64fbsd_sc_reg_offset;
tdep->sc_num_regs = ARRAY_SIZE (amd64fbsd_sc_reg_offset);
- /* FreeBSD provides a user-level threads implementation. */
- bsd_uthread_set_supply_uthread (gdbarch, amd64fbsd_supply_uthread);
- bsd_uthread_set_collect_uthread (gdbarch, amd64fbsd_collect_uthread);
-
/* FreeBSD uses SVR4-style shared libraries. */
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_lp64_fetch_link_map_offsets);

View File

@ -0,0 +1,20 @@
--- gdb/configure.tgt.orig 2010-09-30 13:38:12.841406000 -0400
+++ gdb/configure.tgt 2010-09-30 13:38:49.131127000 -0400
@@ -169,7 +169,7 @@
i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu)
# Target: FreeBSD/i386
gdb_target_obs="i386-tdep.o i387-tdep.o i386bsd-tdep.o i386fbsd-tdep.o \
- bsd-uthread.o corelow.o solib.o solib-svr4.o"
+ fbsd-threads.o corelow.o solib.o solib-svr4.o"
;;
i[34567]86-*-netbsd* | i[34567]86-*-knetbsd*-gnu)
# Target: NetBSD/i386
@@ -579,7 +579,7 @@
# Target: FreeBSD/amd64
gdb_target_obs="amd64-tdep.o amd64fbsd-tdep.o i386-tdep.o \
i387-tdep.o i386bsd-tdep.o i386fbsd-tdep.o \
- bsd-uthread.o corelow.o solib.o solib-svr4.o"
+ fbsd-threads.o corelow.o solib.o solib-svr4.o"
;;
x86_64-*-mingw*)
# Target: MingW/amd64

View File

@ -0,0 +1,20 @@
--- gdb/i386bsd-nat.c.orig 2010-10-21 11:18:03.171107000 -0400
+++ gdb/i386bsd-nat.c 2010-10-21 11:18:18.849642000 -0400
@@ -88,7 +88,7 @@
/* Supply the general-purpose registers in GREGS, to REGCACHE. */
-static void
+void
i386bsd_supply_gregset (struct regcache *regcache, const void *gregs)
{
const char *regs = gregs;
@@ -107,7 +107,7 @@
GREGS. If REGNUM is -1, collect and store all appropriate
registers. */
-static void
+void
i386bsd_collect_gregset (const struct regcache *regcache,
void *gregs, int regnum)
{

View File

@ -0,0 +1,15 @@
--- gdb/i386bsd-nat.h.orig 2010-10-21 11:18:08.097659000 -0400
+++ gdb/i386bsd-nat.h 2010-10-21 11:20:49.341989000 -0400
@@ -35,4 +35,12 @@
extern unsigned long i386bsd_dr_get_status (void);
+/* low level i386 register functions used in i386fbsd-nat.c. */
+
+extern void i386bsd_supply_gregset (struct regcache *regcache,
+ const void *gregs);
+
+extern void i386bsd_collect_gregset (const struct regcache *regcache,
+ void *gregs, int regnum);
+
#endif /* i386bsd-nat.h */

View File

@ -0,0 +1,68 @@
--- gdb/i386fbsd-nat.c.orig 2010-01-01 02:31:36.000000000 -0500
+++ gdb/i386fbsd-nat.c 2010-10-22 13:57:48.705926000 -0400
@@ -24,6 +24,7 @@
#include "target.h"
#include <sys/types.h>
+#include <sys/procfs.h>
#include <sys/ptrace.h>
#include <sys/sysctl.h>
@@ -81,6 +82,49 @@
}
+/* Transfering the registers between GDB, inferiors and core files. */
+
+/* Fill GDB's register array with the general-purpose register values
+ in *GREGSETP. */
+
+void
+supply_gregset (struct regcache *regcache, const gregset_t *gregsetp)
+{
+ i386bsd_supply_gregset (regcache, gregsetp);
+}
+
+/* Fill register REGNUM (if it is a general-purpose register) in
+ *GREGSETPS with the value in GDB's register array. If REGNUM is -1,
+ do this for all registers. */
+
+void
+fill_gregset (struct regcache *regcache, gregset_t *gregsetp, int regnum)
+{
+ i386bsd_collect_gregset (regcache, gregsetp, regnum);
+}
+
+#include "i387-tdep.h"
+
+/* Fill GDB's register array with the floating-point register values
+ in *FPREGSETP. */
+
+void
+supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
+{
+ i387_supply_fsave (regcache, -1, fpregsetp);
+}
+
+/* Fill register REGNUM (if it is a floating-point register) in
+ *FPREGSETP with the value in GDB's register array. If REGNUM is -1,
+ do this for all registers. */
+
+void
+fill_fpregset (struct regcache *regcache, fpregset_t *fpregsetp, int regnum)
+{
+ i387_collect_fsave (regcache, regnum, fpregsetp);
+}
+
+
/* Support for debugging kernel virtual memory images. */
#include <sys/types.h>
@@ -141,7 +185,6 @@
#endif /* HAVE_PT_GETDBREGS */
- t->to_resume = i386fbsd_resume;
t->to_pid_to_exec_file = fbsd_pid_to_exec_file;
t->to_find_memory_regions = fbsd_find_memory_regions;
t->to_make_corefile_notes = fbsd_make_corefile_notes;

View File

@ -0,0 +1,68 @@
--- gdb/i386fbsd-tdep.c.orig 2010-09-30 13:39:50.654492000 -0400
+++ gdb/i386fbsd-tdep.c 2010-09-30 13:40:43.858675000 -0400
@@ -28,7 +28,6 @@
#include "i386-tdep.h"
#include "i387-tdep.h"
-#include "bsd-uthread.h"
#include "solib-svr4.h"
/* FreeBSD 3.0-RELEASE or later. */
@@ -84,46 +83,6 @@
};
static void
-i386fbsd_supply_uthread (struct regcache *regcache,
- int regnum, CORE_ADDR addr)
-{
- char buf[4];
- int i;
-
- gdb_assert (regnum >= -1);
-
- for (i = 0; i < ARRAY_SIZE (i386fbsd_jmp_buf_reg_offset); i++)
- {
- if (i386fbsd_jmp_buf_reg_offset[i] != -1
- && (regnum == -1 || regnum == i))
- {
- read_memory (addr + i386fbsd_jmp_buf_reg_offset[i], buf, 4);
- regcache_raw_supply (regcache, i, buf);
- }
- }
-}
-
-static void
-i386fbsd_collect_uthread (const struct regcache *regcache,
- int regnum, CORE_ADDR addr)
-{
- char buf[4];
- int i;
-
- gdb_assert (regnum >= -1);
-
- for (i = 0; i < ARRAY_SIZE (i386fbsd_jmp_buf_reg_offset); i++)
- {
- if (i386fbsd_jmp_buf_reg_offset[i] != -1
- && (regnum == -1 || regnum == i))
- {
- regcache_raw_collect (regcache, i, buf);
- write_memory (addr + i386fbsd_jmp_buf_reg_offset[i], buf, 4);
- }
- }
-}
-
-static void
i386fbsdaout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@@ -148,10 +107,6 @@
/* FreeBSD has a more complete `struct sigcontext'. */
tdep->sc_reg_offset = i386fbsd_sc_reg_offset;
tdep->sc_num_regs = ARRAY_SIZE (i386fbsd_sc_reg_offset);
-
- /* FreeBSD provides a user-level threads implementation. */
- bsd_uthread_set_supply_uthread (gdbarch, i386fbsd_supply_uthread);
- bsd_uthread_set_collect_uthread (gdbarch, i386fbsd_collect_uthread);
}
static void

View File

@ -0,0 +1,25 @@
--- gdb/gdb.c Thu Feb 13 13:07:24 2003
+++ gdb/gdb.c Wed May 17 00:24:39 2006
@@ -23,4 +23,5 @@
#include "gdb_string.h"
#include "interps.h"
+#include <libgen.h>
int
@@ -31,6 +32,14 @@
args.argc = argc;
args.argv = argv;
- args.use_windows = 0;
- args.interpreter_p = INTERP_CONSOLE;
+ if (strncmp(basename(argv[0]), "insight", 7) == 0) {
+ args.use_windows = 1;
+ args.interpreter_p = "insight";
+ } else if (strncmp(basename(argv[0]), "gdbtui", 6) == 0) {
+ args.use_windows = 0;
+ args.interpreter_p = INTERP_TUI;
+ } else {
+ args.use_windows = 0;
+ args.interpreter_p = INTERP_CONSOLE;
+ }
return gdb_main (&args);
}

6
devel/gdb/pkg-descr Normal file
View File

@ -0,0 +1,6 @@
GDB is a source-level debugger for Ada, C, C++, Objective-C, Pascal and
many other languages. GDB can target (i.e., debug programs running on)
more than a dozen different processor architectures, and GDB itself can
run on most popular GNU/Linux, Unix and Microsoft Windows variants.
WWW: http://www.gnu.org/software/gdb/

2
devel/gdb/pkg-plist Normal file
View File

@ -0,0 +1,2 @@
bin/gdb%%VER%%
bin/gdbtui%%VER%%