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]

Tutorial on debugging with an alternate loader


>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


      


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