Bug 171086 - [patch] devel/gdb: various fixes
Summary: [patch] devel/gdb: various fixes
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Bryan Drewery
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-26 19:40 UTC by Tijl Coosemans
Modified: 2012-08-27 17:20 UTC (History)
0 users

See Also:


Attachments
gdb.patch (2.81 KB, patch)
2012-08-26 19:40 UTC, Tijl Coosemans
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tijl Coosemans 2012-08-26 19:40:03 UTC
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.)
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-08-26 19:40:29 UTC
Maintainer of devel/gdb,

Please note that PR ports/171086 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/171086

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2012-08-26 19:40:31 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 luca.pizzamiglio 2012-08-26 21:14:10 UTC
Hi Tijl!

Thanks for this precious patch.
Shame on me to remove the wrong and still valid patch... I need to
build a better test suite to be sure I'm not breaking something (short
tests on my 8.3 system shows no problem :(

I'm integrating your patch with another one I'm currently testing to
solve an issue on amd64 systems.
I'll submit a new PR to integrate all fixes in one step.

Thanks again!

Luca

On Sun, Aug 26, 2012 at 8:40 PM, Edwin Groothuis <edwin@freebsd.org> wrote:
> Maintainer of devel/gdb,
>
> Please note that PR ports/171086 has just been submitted.
>
> If it contains a patch for an upgrade, an enhancement or a bug fix
> you agree on, reply to this email stating that you approve the patch
> and a committer will take care of it.
>
> The full text of the PR can be found at:
>     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/171086
>
> --
> Edwin Groothuis via the GNATS Auto Assign Tool
> edwin@FreeBSD.org
Comment 4 Bryan Drewery freebsd_committer freebsd_triage 2012-08-27 16:46:15 UTC
Responsible Changed
From-To: freebsd-ports-bugs->bdrewery

I'll take it.
Comment 5 dfilter service freebsd_committer freebsd_triage 2012-08-27 17:11:10 UTC
Author: kwm
Date: Mon Aug 27 16:10:54 2012
New Revision: 303232
URL: http://svn.freebsd.org/changeset/ports/303232

Log:
  Don't allow files to be extracted with 0666 permissions.
  Readd a patch that fixes thread support
  Correct configure test so it detects r_fs and r_gs fields of struct reg.
    This fixes thread support on i386 10-current.
  Fix a segmentation fault on the amd64 architecture
  
  PR:		ports/171109 [2], ports/171086 [1]
  Reported by:	Arrowdodger <6yearold@gmail.com> [2]
  Submitted by:	maintainer [2], Tijl Coosemans <tijl@coosemans.org> [1]

Added:
  head/devel/gdb/files/patch-gdb-configure   (contents, props changed)
Deleted:
  head/devel/gdb/files/patch-gdb-amd64-nat.h
Modified:
  head/devel/gdb/Makefile
  head/devel/gdb/files/extrapatch-gdb-Makefile.in

Modified: head/devel/gdb/Makefile
==============================================================================
--- head/devel/gdb/Makefile	Mon Aug 27 14:34:22 2012	(r303231)
+++ head/devel/gdb/Makefile	Mon Aug 27 16:10:54 2012	(r303232)
@@ -7,6 +7,7 @@
 
 PORTNAME=	gdb
 PORTVERSION=	7.5
+PORTREVISION=	1
 CATEGORIES=	devel
 MASTER_SITES=	GNU
 
@@ -30,7 +31,8 @@ CONFIGURE_ARGS=	--program-suffix=${PORTV
 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

Modified: head/devel/gdb/files/extrapatch-gdb-Makefile.in
==============================================================================
--- head/devel/gdb/files/extrapatch-gdb-Makefile.in	Mon Aug 27 14:34:22 2012	(r303231)
+++ head/devel/gdb/files/extrapatch-gdb-Makefile.in	Mon Aug 27 16:10:54 2012	(r303232)
@@ -1,5 +1,5 @@
 --- gdb/Makefile.in.orig	2012-07-02 17:29:33.000000000 +0200
-+++ gdb/Makefile.in	2012-08-22 16:50:26.000000000 +0200
++++ gdb/Makefile.in	2012-08-26 21:01:45.589052997 +0200
 @@ -572,7 +572,7 @@
  	xstormy16-tdep.o \
  	xtensa-config.o xtensa-tdep.o xtensa-linux-tdep.o \
@@ -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 \

Added: head/devel/gdb/files/patch-gdb-configure
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/gdb/files/patch-gdb-configure	Mon Aug 27 16:10:54 2012	(r303232)
@@ -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 :
+ 
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 6 Koop Mast freebsd_committer freebsd_triage 2012-08-27 17:14:40 UTC
State Changed
From-To: feedback->closed

Committed via ports/171109, thanks!