This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: there is a problem when debug glibc compiled by myself with gdb
- From: Paul Pluzhnikov <ppluzhnikov at gmail dot com>
- To: Guoqiuping <guoqiuping at huawei dot com>
- Cc: "libc-help at sourceware dot org" <libc-help at sourceware dot org>
- Date: Mon, 11 Aug 2014 07:46:36 -0700
- Subject: Re: there is a problem when debug glibc compiled by myself with gdb
- Authentication-results: sourceware.org; auth=none
- References: <4FAC9826955FA44394B0A28B6C83E3FE4E860A27 at nkgeml504-mbx dot china dot huawei dot com>
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