Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Aug 2014 20:23:11 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Bryan Drewery <bdrewery@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r270803 - head/libexec/rtld-elf
Message-ID:  <20140829172311.GP2737@kib.kiev.ua>
In-Reply-To: <540094DB.5050307@FreeBSD.org>
References:  <201408291044.s7TAiwmI077897@svn.freebsd.org> <540094DB.5050307@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--ySXqf0m0EduKBqw5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Aug 29, 2014 at 09:57:31AM -0500, Bryan Drewery wrote:
> On 8/29/2014 5:44 AM, Konstantin Belousov wrote:
> > Author: kib
> > Date: Fri Aug 29 10:44:58 2014
> > New Revision: 270803
> > URL: http://svnweb.freebsd.org/changeset/base/270803
> >=20
> > Log:
> >   Document the whole settings needed to build a debug version of rtld.
> >  =20
> >   Sponsored by:	The FreeBSD Foundation
> >   MFC after:	3 days
> >=20
> > Modified:
> >   head/libexec/rtld-elf/Makefile
> >=20
> > Modified: head/libexec/rtld-elf/Makefile
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- head/libexec/rtld-elf/Makefile	Fri Aug 29 10:43:56 2014	(r270802)
> > +++ head/libexec/rtld-elf/Makefile	Fri Aug 29 10:44:58 2014	(r270803)
> > @@ -1,5 +1,9 @@
> >  # $FreeBSD$
> > =20
> > +# Use the following command to build local debug version of dynamic
> > +# linker:
> > +# make DEBUG_FLAGS=3D-g DEBUG=3D-DDEBUG MK_TESTS=3Dno all
> > +
> >  .include <src.opts.mk>
> >  MK_SSP=3D		no
> > =20
> >=20
>=20
> How difficult would it be to allow DEBUG to be set during runtime like
> GNU's can with LD_DEBUG? I have found GNU's LD_DEBUG to be very useful
> for userland debugging, especially when using dlopen(3).
>=20
> We have LD_DEBUG environment variable but it only prints if built with
> -DDEBUG.
>=20
> Is there a concern about performance by enabling this based only on
> environment?

I am sure that nobody evaluated the performance consequences of
unconditionally compiling the debugging stuff in. I am sure that the
ld-elf.so.1 size will increase.

The reason why nobody cares to evaluate and enable this stuff by default
is that the debugging output is very ad-hoc. I found it almost useless
in both the content and amount of data it outputs. The reason why I
enable it for my work on ld-elf is that I insert my own dbg() calls for
debugging (and usually remove them before the commit since they add even
more verbosity useless for general public consumption).

I find the combination of the ELF dumping tools like readelf and
objdump, together with gdb (-g) and custom dbg() statement (slighly
glorified printf debugging) most adequate combination to debug rtld.

After the long preamble. What use do you have for LD_DEBUG ? If it is
possible to formalize and tailor the debugging output for real users
needs, I am all for making it available unconditionally from LD_DEBUG
knob. The significants part of the current dbg() statements would be
removed or require more agressive settings to become active.


--ySXqf0m0EduKBqw5
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJUALb+AAoJEJDCuSvBvK1BC4EP/3/LubvaSkjSokh9C/AiHNNG
8FtJdYCCWbxBRh+DpLu2lA6OKHAC6WcEUIeACIo1tPIF2fAvFpyL+sNaAqh5RYxZ
BpN6HBRy1BA1AjqdRw0nWc2aTIUmyOCLZYbKvarlytNTNtD3un2+yN6ImQBWR2W3
V8Q9xb0ujzwD6JhrzJ2IDXkxUA3n5eSY4N6m1nycSJJI7E/Fh+VIwFRCddPTQP4M
KNii+XjH7HtwMDUUXjmMyeVSDOCYe2TkjBms332dS9PGuqTutmxWBp6sjakFraqm
uZX2xKaCmiuMm2pY/bK5m7Q/I9+5nnVpYiiyFOlizFLU5niM5EFgK/+yhG1VFi9N
+JXVn3+Sw9tnDSOwtNMl3ze3UbvmHJvH969ygb/ge1XQZnJwaHkfl1ud0wCBOElX
QLc6s2xPtX5eHOfP5y7CJrwsqEMffmR2COtmcoQvgqk7LebQLi8T+ekAbtVXxg2z
a0oLD/UI65cv388EwKh2AGrMTiNkjUIAx21TbetK3MPTZ3e7/PejyIYhyG6uKYGi
dA9zKv+bciGQnLWG97kLOyKMju7ZiDGxKuMvfvMxlgqTuLJIMUNo0YuB45QBvvtB
Uk7EDGDwsV379ERXcbzBJG4+Yhq4lvleW3Zl/nYMePLPa7jEUHyg7+vYGI991fuw
kcNQiI8mswAdRd+mx1ck
=lPk6
-----END PGP SIGNATURE-----

--ySXqf0m0EduKBqw5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140829172311.GP2737>