Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Dec 2012 08:47:59 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        "Myles C. Maxfield" <myles.maxfield@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: libc with debugging symbols?
Message-ID:  <3D83C1F8-16D4-44A5-9C12-146FC77B3E65@bsdimp.com>
In-Reply-To: <CALz%2B48WeEboV0v5gS4dui5yThveGGf925JkzDJ2xph0OFn5yag@mail.gmail.com>
References:  <CALz%2B48WeEboV0v5gS4dui5yThveGGf925JkzDJ2xph0OFn5yag@mail.gmail.com>

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

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=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D83C1F8-16D4-44A5-9C12-146FC77B3E65>