--- /usr/portage/x11-base/xorg-server/xorg-server-1.11.0.ebuild	2011-09-02 03:01:29.000000000 +0200
+++ xorg-server-1.11.0-r1.ebuild	2011-09-21 22:16:13.000000000 +0200
@@ -12,7 +12,7 @@
 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
 
 IUSE_SERVERS="dmx kdrive xnest xorg xvfb"
-IUSE="${IUSE_SERVERS} ipv6 minimal nptl tslib +udev"
+IUSE="${IUSE_SERVERS} ipv6 minimal nptl tslib +udev debug"
 
 RDEPEND=">=app-admin/eselect-opengl-1.0.8
 	dev-libs/openssl
@@ -160,6 +160,12 @@
 		ln -s "${EROOT}usr/$(get_libdir)/opengl/global/include/$i.h" "${T}/mesa-symlinks/GL/$i.h" || die
 	done
 	append-cppflags "-I${T}/mesa-symlinks"
+
+	# ensure debug code is generated inside binaries, bug #256034, arguably we could also filter
+	# aggressive optimize CFLAGS or force -ggdb
+	if use debug; then
+		append-flags "-DDEBUG -DNDEBUG"
+	fi
 }
 
 src_install() {