gdb steps into glibc functions
Marc Gonzalez-Sigler
marc.gonzalez-sigler@inria.fr
Tue Oct 21 14:56:00 GMT 2003
Hi,
First of all, I thank you and Daniel for answering my question.
Daniel's suggestion to set auto-solib-add to 0 proved very useful.
Michael Elizabeth Chastain wrote:
> Hello,
>
>
>>GNU gdb 5.0rh-5 Red Hat Linux 7.1
>
>
> That is a very old gdb, and a very old Red Hat Linux, too.
>
> The current releases are: gdb 6.0 and Red Hat Linux 9.
Unfortunately, I have no control over this.
> Look at the value of the environment variable LD_LIBRARY_PATH.
> In particular, see if there is a "/usr/lib/debug" in there.
> Red Hat ships the normal non-debug version of glibc in /lib,
> and the debugging version in /usr/lib/debug. I don't know if
> it was that way back in 7.1, but it likely was.
$ echo $LD_LIBRARY_PATH
/usr/lib:/orc-2.1/usr/ia64-orc-linux/lib/gcc-lib/ia64-orc-linux/2.1
$ ls /usr/lib/debug
ls: /usr/lib/debug: No such file or directory
> Also try "ldd program" on your program and see how the glibc
> reference is getting resolved.
$ ldd /orc-2.1/usr/ia64-orc-linux/bin/ir_b2a
libm.so.6 => /lib/libm.so.6 (0x40028000)
libc.so.6 => /lib/libc.so.6 (0x4004a000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
$ ls -l /lib/libc.*
lrwxrwxrwx 1 root root 13 Mar 13 2002
/lib/libc.so.6 -> libc-2.2.4.so
$ ls -l /lib/libc-2.2.4.so
-rwxr-xr-x 1 root root 5723311 Dec 8 2001
/lib/libc-2.2.4.so
> You can probably strip the library with "strip --strip-debug"
> but it's tricky to do *anything* to glibc on a running system,
> because all the processes on the system have mmap'ed that file.
> If you could boot from a CD-ROM then it would be safer to modify
> glibc. And for your sake, make a backup of the original glibc in
> another directory before you touch glibc.
I think I will stick with Daniel's solution :-)
> Also, use "next" instead of "step". "next" always skips over the
> function. That would give you the behavior you want, without having
> to change anything.
Not really. I do want to step into my code, not the glibc code.
Marc
More information about the Gdb
mailing list