How to get the eglibc source code used by Ubuntu?

If you really want to step through the source I'd recommend building a libc without optimisation and without stripping the binaries.

Fortunately, that should be easy - since you've already got the source, you can build packages from it. You'll want to ensure the DEB_BUILD_OPTIONS evnironment variable contains noopt to get -O0 binaries and nostrip to keep the debugging symbols, and then build as normal with debuild:

sudo apt-get build-dep libc6
DEB_BUILD_OPTIONS="noopt nostrip" debuild -us -uc

will build you packages built with -O0 and without the debugging symbols stripped; you can then install them with dpkg and gdb will pick up the debugging symbols. As an added bonus, gdb will also know where to find the source files, so you'll get source listings.

Since we haven't changed the version of the packages, the next time you run an upgrade apt will replace these locally-installed packages with the archive versions.


You can try apt-get source -d libc6-dev and this should give you the source and the diff in deb format. Then you can uncompress it and it should give the sources in tar.gz uncompress this as well.It should be stored in the directory that you ran the apt-get command in.