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 > > > > Log: > > Document the whole settings needed to build a debug version of rtld. > > > > Sponsored by: The FreeBSD Foundation > > MFC after: 3 days > > > > Modified: > > head/libexec/rtld-elf/Makefile > > > > Modified: head/libexec/rtld-elf/Makefile > > ============================================================================== > > --- 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$ > > > > +# Use the following command to build local debug version of dynamic > > +# linker: > > +# make DEBUG_FLAGS=-g DEBUG=-DDEBUG MK_TESTS=no all > > + > > .include <src.opts.mk> > > MK_SSP= no > > > > > > 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). > > We have LD_DEBUG environment variable but it only prints if built with > -DDEBUG. > > 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.
pgpHwb4q7zKCk.pgp
Description: PGP signature