From owner-freebsd-hackers@FreeBSD.ORG Tue Dec 4 15:48:04 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1F593D07 for ; Tue, 4 Dec 2012 15:48:04 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id C83978FC12 for ; Tue, 4 Dec 2012 15:48:03 +0000 (UTC) Received: by mail-ob0-f182.google.com with SMTP id 16so5012452obc.13 for ; Tue, 04 Dec 2012 07:48:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=4h8EptCmonJ6c7KiXfjq42jpzUI4KHzJHq8ABZwVpgM=; b=VVXvbewy35i3bmcp6n3NKO8+3wKmKbJkqXvXsWMnGXqeZqCt6EKradqB3Clt2aWIoe hR3Wr9desGiEobDl1W3BZpk/BeazjXCZrtc5RWxsux7QmugStCurCq2XqZkuws7ttqHr mOEhxOcptzC8Aifm741i//1pIJuEwj/K8mYkAqqwmt6XRKmVY7My5GYIqS2/B1IUeZPL xv5zIhQquFzfAaTrVwEE7OWrB9ILufwoF7IjwOI0VQH9ghsOBV7W+g6/8PZ/jmx/c6b+ MD9YqtRB3QCF9swmorGWTxHLATg2H0Dw/XXe1H1fiVHeAiWy9Vqdx1FyoWmQ0VPs4+oO MsGw== Received: by 10.60.24.97 with SMTP id t1mr8876849oef.6.1354636083232; Tue, 04 Dec 2012 07:48:03 -0800 (PST) Received: from monkey-bot.int.fusionio.com ([209.117.142.2]) by mx.google.com with ESMTPS id h2sm1046835obn.11.2012.12.04.07.48.01 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 04 Dec 2012 07:48:02 -0800 (PST) Sender: Warner Losh Subject: Re: libc with debugging symbols? Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=iso-8859-1 From: Warner Losh In-Reply-To: Date: Tue, 4 Dec 2012 08:47:59 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <3D83C1F8-16D4-44A5-9C12-146FC77B3E65@bsdimp.com> References: To: "Myles C. Maxfield" X-Mailer: Apple Mail (2.1085) X-Gm-Message-State: ALoCoQmXlTd2Q7jCfSAa7GCDuU8mmAn3APLm0L5h4jXVQwEJDcfITtduNph9Ci0JyoHaKb7vFeui Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2012 15:48:04 -0000 On Dec 4, 2012, at 1:24 AM, Myles C. Maxfield wrote: > Hello, all, > I'm interested in learning about the internals of how libc works, so I = was > hoping to link a test application with a version of libc that has = debugging > symbols (reading the raw sources only gets me so far). The version of = libc > that comes with FreeBSD doesn't have debugging symbols (nor should = it), so > I'm wondering if there is a way to install / compile my own. >=20 > I have very na=EFvely checked out libc from /base/head at = svn.freebsd.org, > crossed my fingers, and ran 'make', but that didn't work (for many = reasons, > I'm sure). This leads me to the following questions: >=20 > 1. Is it possible to check out the sources of libc (and possibly other > libraries) as they were when the FreeBSD 9.0 release was being = compiled > (since that's what I'm running)? Is there a way to map this to a = particular > SVN revision? Yes. The handbook should cover the different possibilities, but you'll = want to check out the code from http://svn.freebsd.org/base/releng/9.0 > 2. Is there a listing of the tools and versions used to compile libc = at > that time? It's all in what you checked out using the above link. > 3. Many other unix-like distributions have something like a libc-dbg > package in their package manager. Do you think this would be = worthwhile or > even acceptable for me to try to create something similar in the ports > database? (I couldn't find anything that already exists) That's an interesting idea. However, it is easy enough to build what = you need: cd svn-root-location # change this to the real path cd lib/libc make DEBUG_FLAGS=3D-g obj all install clean should suffice. It will add a bunch of space to your root and /usr = partitions, iirc, but disks these days are so huge you won't notice. If = you do, you can install to a different location using DESTDIR. Due to = some interaction between different parts of the system that's a smidge = more complex: cd svn-root-location make redistribute cd lib/libc make DEBUG_FLAGS=3D-g obj all install clean DESTDIR=3D/some/other/path If you are hacking on libc, you can omit the 'clean' step. If you are = rebuilding libc, you can omit the 'obj' after the first time. If you are = hacking on amd64, you may want to add WITHOUT_LIB32=3Dt to the command = line to disable the 32-bit build. To rebuild libc takes just a couple of minutes. Hope this helps. Warner=