Date: Sun, 26 Aug 2012 20:32:09 +0200 (CEST) From: Tijl Coosemans <tijl@coosemans.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/171086: [patch] devel/gdb: various fixes Message-ID: <201208261832.q7QIW87Z010021@kalimero.tijl.coosemans.org> Resent-Message-ID: <201208261840.q7QIe3Y9047196@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 171086 >Category: ports >Synopsis: [patch] devel/gdb: various fixes >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Aug 26 18:40:03 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Tijl Coosemans >Release: FreeBSD 10.0-CURRENT i386 >Organization: >Environment: >Description: The attached patch fixes some issues with devel/gdb: 1) Some files are extracted with 0666 permissions which allows anyone to modify the source while building. The fix is to add --no-same-owner --no-same-permissions to EXTRACT_AFTER_ARGS like bsd.port.mk does. 2) Threading support is currently broken. When you run gdb it prints an error that says it failed to load libthread_db.so because it cannot resolve ps_pread. This function is defined in fbsd-threads.c and gdb has to be linked with -Wl,-E to export it. This flag used to be added by patch-gdb-Makefile.in, but that has been removed in the update to gdb 7.5. I've added it back to extra-patch-gdb-Makefile.in. 3) Threading support on FreeBSD/i386 10-CURRENT is currently broken because two configure tests that test existence of r_fs and r_gs fields in struct reg fail. This causes gdb to overwrite %fs and %gs registers with zero which makes threaded programs crash. The tests are missing sys/types.h as a prerequisite header. (The test for the existence of struct reg itself already uses sys/types.h, so I simply copied that.) >How-To-Repeat: >Fix: --- gdb.patch begins here --- diff -urN /usr/ports/devel/gdb/Makefile ./Makefile --- /usr/ports/devel/gdb/Makefile 2012-08-24 04:54:50.000000000 +0200 +++ ./Makefile 2012-08-26 20:16:49.000000000 +0200 @@ -7,6 +7,7 @@ PORTNAME= gdb PORTVERSION= 7.5 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= GNU @@ -30,7 +31,8 @@ CFLAGS:= ${CFLAGS:C/ +$//} # blanks at EOL creep in sometimes CFLAGS+= -DRL_NO_COMPAT EXCLUDE= dejagnu expect readline sim texinfo intl -EXTRACT_AFTER_ARGS=| ${TAR} -xf - ${EXCLUDE:S/^/--exclude /} +EXTRACT_AFTER_ARGS= | ${TAR} -xf - ${EXCLUDE:S/^/--exclude /} \ + --no-same-owner --no-same-permissions VER= ${PORTVERSION:S/.//g} PLIST_SUB= VER=${VER} MAN1= gdb${VER}.1 diff -urN /usr/ports/devel/gdb/files/extrapatch-gdb-Makefile.in ./files/extrapatch-gdb-Makefile.in --- /usr/ports/devel/gdb/files/extrapatch-gdb-Makefile.in 2012-08-24 04:54:50.000000000 +0200 +++ ./files/extrapatch-gdb-Makefile.in 2012-08-26 18:40:22.000000000 +0200 @@ -18,6 +18,15 @@ mdebugread.h m88k-tdep.h stabsread.h hppa-linux-offsets.h linux-fork.h \ ser-unix.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 \ +@@ -1164,7 +1164,7 @@ + # Removing the old gdb first works better if it is running, at least on SunOS. + gdb$(EXEEXT): gdb.o $(LIBGDB_OBS) $(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_OBS) \ + $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) + @@ -1429,7 +1429,7 @@ armnbsd-nat.c armbsd-tdep.c armnbsd-tdep.c armobsd-tdep.c \ avr-tdep.c \ diff -urN /usr/ports/devel/gdb/files/patch-gdb-configure ./files/patch-gdb-configure --- /usr/ports/devel/gdb/files/patch-gdb-configure 1970-01-01 01:00:00.000000000 +0100 +++ ./files/patch-gdb-configure 2012-08-24 14:06:02.000000000 +0200 @@ -0,0 +1,22 @@ +--- gdb/configure.orig 2012-08-24 14:03:52.000000000 +0200 ++++ gdb/configure 2012-08-24 14:05:06.000000000 +0200 +@@ -10590,7 +10590,8 @@ + + # See if <machine/reg.h> supports the %fs and %gs i386 segment registers. + # Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'. +-ac_fn_c_check_member "$LINENO" "struct reg" "r_fs" "ac_cv_member_struct_reg_r_fs" "#include <machine/reg.h> ++ac_fn_c_check_member "$LINENO" "struct reg" "r_fs" "ac_cv_member_struct_reg_r_fs" "#include <sys/types.h> ++#include <machine/reg.h> + " + if test "x$ac_cv_member_struct_reg_r_fs" = x""yes; then : + +@@ -10600,7 +10601,8 @@ + + + fi +-ac_fn_c_check_member "$LINENO" "struct reg" "r_gs" "ac_cv_member_struct_reg_r_gs" "#include <machine/reg.h> ++ac_fn_c_check_member "$LINENO" "struct reg" "r_gs" "ac_cv_member_struct_reg_r_gs" "#include <sys/types.h> ++#include <machine/reg.h> + " + if test "x$ac_cv_member_struct_reg_r_gs" = x""yes; then : + --- gdb.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208261832.q7QIW87Z010021>