From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 29 23:39:05 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEF99106566C for ; Fri, 29 Oct 2010 23:39:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 809838FC1B for ; Fri, 29 Oct 2010 23:39:04 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o9TNd003047592 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 30 Oct 2010 02:39:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o9TNd0gm034132; Sat, 30 Oct 2010 02:39:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o9TNd0rm034131; Sat, 30 Oct 2010 02:39:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 30 Oct 2010 02:39:00 +0300 From: Kostik Belousov To: Mark Johnston Message-ID: <20101029233900.GC2392@deviant.kiev.zoral.com.ua> References: <20101029191827.GC1443@mark-laptop-bsd.mark-home> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wD/HYRFy5EhJhSwd" Content-Disposition: inline In-Reply-To: <20101029191827.GC1443@mark-laptop-bsd.mark-home> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-hackers@freebsd.org Subject: Re: Generating userland debugging symbols X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 23:39:05 -0000 --wD/HYRFy5EhJhSwd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 29, 2010 at 03:18:27PM -0400, Mark Johnston wrote: > Hello all, >=20 > I've been working on some changes to the system build scripts that make > it easier to create and install debugging symbols files for the base > userland. What we do in the tree at my work (Sandvine) is use a script > that invokes strip(1) and objcopy(1) to create a separate file containing > the debugging symbols for each binary; so for example, the symbols for=20 > /bin/ls get placed in another directory, e.g. > /usr/local/lib/debug/bin/ls.symbols. >=20 > The name of the symbols file for each binary is encoded in the > .gnu_debuglink segment; when gdb comes across it, it searches a set > of directories for the debug symbols file and loads it if found. >=20 > It turns out to be pretty convenient - one can keep the debugging symbols > on a separate slice or on an NFS-mounted directory if space is an issue, > or package the debug symbols separately and keep them on an FTP server, > ready to install if needed. >=20 > I'm not aware of any infrastructure in place that makes it easy to do > this for the userland programs. What I'm hoping to find out is whether > there's any interest in adding such support. I've discussed this with > Ed Maste to some degree, but it'd be nice to get some additional feedback. >=20 > My basic idea is to add an option to /etc/src.conf that indicates that the > build system should build all the userland programs with debugging symbols > and later extract them. So a user would define something like > WITH_DEBUG_SYMBOLS in src.conf, and then in bsd.own.mk, have something > like >=20 > .if !defined(_WITHOUT_SRCCONF) > .if defined(WITH_DEBUG_SYMBOLS) > SYMBOLS_DIR?=3D/usr/local/lib/debug > STRIP_BIN:=3D" ${SYMBOLS_DIR}" > .endif > .endif >=20 > and then in bsd.prog.mk: >=20 > .if defined(STRIP_BIN) > .PHONY: > export STRIPBIN=3D${STRIP_BIN} > .endif >=20 > so that when install(1) gets run, STRIPBIN will be in the environment. >=20 > In our setup, STRIPBIN points to a script which just uses strip(1) and > objcopy(1) to extract the debug symbols for each binary that gets > installed. Ed suggested that I could just add an option to strip(1) to > do all of this in one command so that we wouldn't need to add a separate > script to the FreeBSD tree for this. It's pretty simple to do - I can > post the patch if anyone wants to see it. This also requires a smallish > change to install(1) which I can also post. >=20 > Any thoughts or suggestions on this approach in general? I'm still > getting to know the FreeBSD system, so I'm open to alternatives. If > there's agreement that this feature might be useful, I'll post my patches. I do think that something like this would be useful. But, shouldn't the DEBUG_FLAGS be also involved in the patch ? The goal would be to have debug symbols for userland staff. esp. the libraries, handled in a similar manner to kernel symbols. But I do like the intent of keeping the symbols in the separate directory. --wD/HYRFy5EhJhSwd Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAkzLWxQACgkQC3+MBN1Mb4imDQCfZ0lNu/wit2eu9hl3sJjxX0ih ZigAoOMeQqE2cWedSI/ApbrFsty3n1ZA =1ADu -----END PGP SIGNATURE----- --wD/HYRFy5EhJhSwd--