This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gdb steps into glibc functions


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.

> Does it mean that glibc was compiled with debugging information on 
> this Redhat system? And gdb complains because it cannot find the 
> source code?

Yes, it looks like that is happening.  Your gdb mentions the
source file name and line number for the glibc function,
which means that the source file name must be in glibc.

> If this is the case, then I would obtain the behavior I am used to 
> as soon as I use a version of glibc which was compiled without 
> debugging information, no? Could I just strip the library?

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.

The solution to your problem might be as easy as taking
"/usr/lib/debug" out of LD_LIBRARY_PATH.

Also try "ldd program" on your program and see how the glibc
reference is getting resolved.

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.

> One last question: once I enter a function, say, strcmp(), is finish 
> the correct command to jump out of the function?

Yes.

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.

Hope this helps,

Michael C


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]