From owner-freebsd-hackers@FreeBSD.ORG Sat Oct 30 03:36:17 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 36A1D106566B; Sat, 30 Oct 2010 03:36:17 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id DAB628FC0A; Sat, 30 Oct 2010 03:36:16 +0000 (UTC) Received: by iwn39 with SMTP id 39so4426192iwn.13 for ; Fri, 29 Oct 2010 20:36:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=+pZnqYaUa+7ltGd3fca3OPYP3NfpjWNcpJMLiHzhobs=; b=bEXrRmgRvu5OYT3dioBF1/2IjgdC6hVXaWOq5poEDeJ8mVvP9Pi4RrTw3gXQ16v2f9 /rgHDpS7j217Vtjf+N0nFioDKU5/DtVCgO63jm06Bqu2wpYIxSgU0SiWdg/awQOnSFCu yhD4c4qbPX0vz1ZvPctaAIxp8x/IKL59SqpII= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=N2l5G7tTsGm3DzPjG2DBNeD2XEbQGleV0VuBdlJsZVbxLtzzGGVUOmZ4i7Zre3H1UU brJKEeoALcuMhT+FVZWU1H+i1dIMAZPHSH6N9UghI8kC9uHP5q91P+BvSTCIHLrDUYuL wNJVK7F57wpd2ps48yY9cd8t77VPIf1NAUoCI= Received: by 10.42.209.142 with SMTP id gg14mr9936028icb.529.1288409776093; Fri, 29 Oct 2010 20:36:16 -0700 (PDT) Received: from mark-laptop-bsd.mark-home (CPE00222d75bcd8-CM00222d75bcd5.cpe.net.cable.rogers.com [99.233.53.36]) by mx.google.com with ESMTPS id u6sm4466326ibd.18.2010.10.29.20.36.14 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 29 Oct 2010 20:36:15 -0700 (PDT) Date: Fri, 29 Oct 2010 23:35:59 -0400 From: Mark Johnston To: Garrett Cooper Message-ID: <20101030033559.GA1387@mark-laptop-bsd.mark-home> References: <20101029191827.GC1443@mark-laptop-bsd.mark-home> <20101029233900.GC2392@deviant.kiev.zoral.com.ua> <20101030021000.GA1328@mark-laptop-bsd.mark-home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) 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: Sat, 30 Oct 2010 03:36:17 -0000 On Fri, Oct 29, 2010 at 07:48:31PM -0700, Garrett Cooper wrote: > On Fri, Oct 29, 2010 at 7:10 PM, Mark Johnston wrote: > > On Fri, Oct 29, 2010 at 06:05:08PM -0700, Garrett Cooper wrote: > > > > That's almost exactly what we're doing. I also think it's easier to go with a > > script, but the required changes to strip(1) and install(1) are pretty > > basic. strip(1) and objcopy(1) are both generated from the same source > > file, so it's just a matter of adding an extra option that performs the > > above operations in one command. I have no specific preference on this > > point though. > > Well.. perhaps, but this would impact the performance of standard make > operations across the board, outside of FreeBSD make; trivially I'm > sure, but it's just easier in this case probably to make it shell > based and keep it confined to the FreeBSD build as it's a FreeBSD > specific feature (unless the feature is truly useful enough and you > can get enough folks on the bandwagon to standardize the feature) :/. > I can't see how there'd be any performance difference - all I did was add two options to strip(1), so that instead of pointing STRIPBIN to a script that does strip -o /usr/local/lib/debug/bin/foo.symbols --only-keep-debug /bin/foo strip /bin/foo objcopy --add-gnu-debuglink=foo.symbols /bin/foo I can just use STRIPBIN="strip -e --prefix-dir=/usr/local/lib/debug" Currently, install(1) treats STRIPBIN as a program name; it essentially does a execve(getenv(STRIPBIN)); my change just has it split any arguments into an argv which then can be passed into execve. I'm not sure if this change might be useful on its own. On the whole, I agree that using a script for this is better though. It'll make things easier to change later on, and it's less work to maintain - I doubt my changes to strip(1) would be accepted upsteam anyway, they don't implement any new functionality. > > I'm not familiar with pmake - I'll take a look into it. > > pmake is FreeBSD's make: http://www.freebsd.org/doc/en/books/pmake/ Ah... I'm still getting to know FreeBSD. =) I'll take a look through the docs when I have some spare time this weekend. > > >> I agree with kib@ on both counts and I like this idea. Maybe the > >> directory should be something like /usr/obj/stripped for the stripped > >> binaries and /usr/obj/debug for the debug symbols? (just something I'm > >> tossing out... the hierarchy could be better organized than that..). > >> It might get a bit more hairy to clean up later, but oh well, it's for > >> development :D... > >> Thanks! > >> -Garrett > > > > It took me a while to figure this out, but the absolute path to the > > debug symbols isn't encoded in the .gnu_debuglink segment - just the > > filename is placed there. When gdb loads a binary, it searches a > > predefined set of directories for the file recorded in .gnu_debuglink > > and loads it if it finds it. One of the directories is global - on > > FreeBSD it seems to be /usr/local/lib/debug/ by default. You can > > configure it with > > Hmmm... didn't realize it all went there. What about cases with > compat libraries where we need versioning? That's a good point. Symbols files for libraries should be named by version, so that, say, /lib/libc.so.7 would have its gnu_debuglink point to /usr/local/lib/debug/lib/libc.7.symbols. Is this what you're referring to? Thanks, -Mark