This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Tutorial on debugging with an alternate loader
- From: Daniel De La Zerda <ddelazerda007 at yahoo dot com>
- To: Ryan Arnold <ryan dot arnold at gmail dot com>
- Cc: Carlos O'Donell <carlos at systemhalted dot org>, libc-help at sourceware dot org, pasky at suse dot cz
- Date: Thu, 16 Apr 2009 09:32:11 -0700 (PDT)
- Subject: Tutorial on debugging with an alternate loader
- References: <684720.61839.qm@web63201.mail.re1.yahoo.com> <658187.9102.qm@web63201.mail.re1.yahoo.com> <ff4da150903181257k4e5f1746tf6bf96ebf33f80b4@mail.gmail.com> <335499.11939.qm@web63206.mail.re1.yahoo.com> <119aab440903181350s9a21410tff40cf9d37301819@mail.gmail.com> <588946.38944.qm@web63206.mail.re1.yahoo.com> <119aab440903181431p6b55bf9dnd3f1fb4caffbbf8b@mail.gmail.com> <680017.83123.qm@web63206.mail.re1.yahoo.com> <119aab440903191247h68392104qadfbb4ab0b0a8ea5@mail.gmail.com> <740092.5205.qm@web63206.mail.re1.yahoo.com> <ff4da150903191905r6b284d79s65c3eb0bb7f96e69@mail.gmail.com>
- Reply-to: Daniel De La Zerda <danieldelazerda at gmail dot com>
>Hi Daniel, I wrote wrote a tutorial on this:
>http://sources.redhat.com/glibc/wiki/Debugging/Loader_Debugging#Debugging_With_an_Alternate_Loader
>
>Ryan
I finally am in need to debug my glibc with an alternate loader and I am stuck where you run the script to start gdb with the alternate loader. This is the script I'm using to run gdb with the alternate loader:
#!/bin/bash
GLIBC="/home/devel/src/rpm/BUILD/glibc-2.4-copy/my-glibc-build"
# We need to make sure that gdb is linked against the standalone glibc so that
# it picks up the correct nptl_db/libthread_db.so. So that means invoking gdb
# using the standalone glibc's linker.
${GLIBC}/elf/ld-linux-x86-64.so.2 --library-path \
${GLIBC}:\
${GLIBC}/math:\
${GLIBC}/elf:\
${GLIBC}/dlfcn:\
${GLIBC}/nss:\
${GLIBC}/nis:\
${GLIBC}/rt:\
${GLIBC}/resolv:\
${GLIBC}/crypt:\
${GLIBC}/nptl:\
${GLIBC}/nptl_db:\
gdb -x test.gdb -cd=/home/devel/src/rpm/BUILD/glibc-2.4-copy ${GLIBC}/elf/ld-linux-x86-64.so.2
As you can see it looks very much like the one in your tutorial and here is the test.gdb with the commands:
set environment C -E -x c-header
break _dl_main_dispatch
run --library-path
/home/devel/src/rpm/BUILD/glibc-2.4-copy/my-glibc-build:\
/home/devel/src/rpm/BUILD/glibc-2.4-copy/my-glibc-build/nptl:\
/home/devel/src/rpm/BUILD/glibc-2.4-copy/my-glibc-build/math:\
/home/devel/src/rpm/BUILD/glibc-2.4-copy/my-glibc-build/elf:\
/home/devel/src/rpm/BUILD/glibc-2.4-copy/my-glibc-build/dlfcn:\
/home/devel/src/rpm/BUILD/glibc-2.4-copy/my-glibc-build/nss:\
/home/devel/src/rpm/BUILD/glibc-2.4-copy/my-glibc-build/nis:\
/home/devel/src/rpm/BUILD/glibc-2.4-copy/my-glibc-build/rt:\
/home/devel/src/rpm/BUILD/glibc-2.4-copy/my-glibc-build/resolv:\
/home/devel/src/rpm/BUILD/glibc-2.4-copy/my-glibc-build/crypt:\
/home/devel/src/rpm/BUILD/glibc-2.4-copy/my-glibc-build/nptl:\
/home/devel/src/rpm/BUILD/glibc-2.4-copy/my-glibc-build/nptl_db \
/home/devel/src/rpm/BUILD/test/minicond_clock_test
minicond_clock_test is the executable that I want to debug.
When I run the bash script above I get the following error:
"-x: error while loading shared libraries: -x: cannot open shared object file: No such file or directory"
This is strange because I did an "ls" on every path of the bash script and their are all valid paths. I don't know what else could it be. If you need more information, I will be glad to provide.
Thank you for your time,
Daniel