Re: Purpose
On Tue, Jul 28, 2009 at 8:13 AM, Patrick M. Rutkowski<rutski89@gmail.com> wrote:
> I'm confused about the purpose of the libc6-dbg package if I every
> time I try to step into a libc function I get an error about missing
> source files.
>
> What is this package good for if not stepping into libc code?
The package is good for stepping into libc code, but it's not the only
thing you need.
The package contains unstripped libraries with their original debug
information intact. Without this, you can't do any debugging.
You must also download the libc6 source package and unpack the source.
You must also use the "dirs" command in gdb to setup the source lookup
paths to use the unpacked libc6 source.
You must also debug the application using the alternate libc6-dbg libraries.
e.g.
apt-get source libc6
apt-get install libc6-dbg
su
.... setup symlinks in /usr/lib/debug appropriate for your configuration
e.g.
cd /usr/lib/debug/lib/i686/cmov/
ln -s libc-2.9.so libc.so.6
cd /usr/lib/debug/lib
ln -s ld-2.9.so ld-linux.so.2
cat >> test.c <<EOF
#include <stdio.h>
int
main (void)
{
printf ("Hello World!\n");
return 0;
}
EOF
gcc -o test test.c
carlos@crasus:~/src/debian$ gdb test
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(gdb) set sysroot /usr/lib/debug
(gdb) break main
Breakpoint 1 at 0x80483b2
(gdb) r
Starting program: /home/carlos/src/debian/test
Breakpoint 1, 0x080483b2 in main ()
Current language: auto; currently asm
(gdb) info shared
>From To Syms Read Shared Object Library
0xb80e1830 0xb80f7dff Yes /usr/lib/debug/lib/ld-linux.so.2
0xb7f82580 0xb8093886 Yes /usr/lib/debug/lib/i686/cmov/libc.so.6
(gdb) dir eglibc-2.9/stdio-common/
Source directories searched:
/home/carlos/src/debian/eglibc-2.9/stdio-common:$cdir:$cwd
(gdb) break printf
Breakpoint 2 at 0xb7dfa5a2: file printf.c, line 30.
(gdb) c
Continuing.
Breakpoint 2, __printf (format=0x8048490 "Hello World\n!") at printf.c:30
30 {
Current language: auto; currently c
(gdb) n
35 done = vfprintf (stdout, format, arg);
(gdb) n
Hello World
39 }
(gdb)
Cheers,
Carlos.
Reply to:
- References:
- Purpose
- From: "Patrick M. Rutkowski" <rutski89@gmail.com>