This is the mail archive of the libc-help@sourceware.org mailing list for the glibc 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: there is a problem when debug glibc compiled by myself with gdb


On Mon, Aug 11, 2014 at 4:56 AM, Guoqiuping <guoqiuping@huawei.com> wrote:

> Would anyone can help me?

The first two commands in GDB that you'll want to use are "where" and
"info shared".

I expect that you'll discover that the crash is happening in the
dynamic loader (ld.so), and that your program loaded the system
libc.so.6, not the /home/hksee/glibc2111/.../libc.so.6 (which would
explain the crash -- mismatch between ld.so and libc.so.6 is not
allowed).


> ../glibc-2.11.1/configure --prefix=/home/hksee/glibc2111 CFLAGS "-O1 -g" = CPPFLAGS "-O1 -g"
> make
> make install

This puts libc.so.6 into /home/hksee/glibc2111/lib64 or some such.

> and then ran my test program in gdb as below, but Segmentation fault happened:
> gdb elf/ld.so
> (gdb) set exec-wrapper env LD_LIBRARY_PATH=~/glibc2111:~/glibc2111/elf

This tells the loader to look for libc.so.6 in glibc2111 or
glibc211/elf. The latter shouldn't exist at all, and the former should
not contain libc.so.6, so the setting is plain wrong.

Likely you want either:

  LD_LIBRARY_PATH=/home/hksee/glibc2111/lib64

or

  /home/hksee/glibc2111/elf/ld.so --library-path
/home/hksee/glibc2111/lib64 ~/tmp/testmalloc


-- 
Paul Pluzhnikov


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