The following worked for me. Not sure whether there is a better way.
- Install libc6-dbg (which you have already done):
sudo apt-get install libc6-dbg
- Install the eglibc-source package (ubuntu actually uses eglibc):
sudo apt-get install eglibc-source
. - Unpack the tar file that was installed in /usr/src/glibc:
/usr/src/glibc $ sudo tar xvf eglibc-2.19.tar.xz
- Crank up gdb and add in the path to the malloc source:
(gdb) dir /usr/src/glibc/eglibc-2.19/malloc
(gdb) n
13 char *c = malloc(100);
(gdb) s
__GI___libc_malloc (bytes=100) at malloc.c:2876 2876
{
(gdb)