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: Tutorial on debugging with an alternate loader


After playing with it a little bit I made a minor change to the debug script:

#!/bin/bash

GLIBC="/home/devel/src/rpm/BUILD/glibc-2.4-copy/my-glibc-build"
PWD=`pwd`
# 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 /home/devel/src/rmp/BUILD/test/test.gdb -d /home/devel/src/rpm/BUILD/glibc-2.4-copy ${GLIBC}/elf/ld-linux-x86-64.so.2


In the line before the lastline instead of "${GLIBC}/nptl_db:\" I now have "${GLIBC}/nptl_db \" and I get a different error:

"gdb: error while loading shared libraries: gdb: cannot open shared object file: No such file or directory"

and since it still doesn't say what exactly it can't find I did an "strace" of running the command and found out which files it is looking for and not finding. Here is the file in question from the strace output: "open("/home/devel/src/rpm/BUILD/glibc-2.4-copy/my-glibc-build/etc/ld.so.cache", O_RDONLY) = -1 ENOENT (No such file or directory)".

Just thinking out loud - There is not "etc" directory under my-glibc-build, I think because that gets generated after "ldconfig" is run, but I don't have an "ld.so.conf" file for that.

What would you suggest I do?

Thanks again for your time in helping,

Daniel

 

----- Original Message ----
From: Ryan Arnold <ryan.arnold@gmail.com>
To: Daniel De La Zerda <danieldelazerda@gmail.com>
Cc: Carlos O'Donell <carlos@systemhalted.org>; libc-help@sourceware.org; pasky@suse.cz
Sent: Thursday, April 16, 2009 1:35:29 PM
Subject: Re: Tutorial on debugging with an alternate loader

On Thu, Apr 16, 2009 at 11:32 AM, Daniel De La Zerda
<ddelazerda007@yahoo.com> wrote:
> 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

One problem I see right away is with '_dl_main_dispatch'.  That symbol
isn't available on x86[-64] so you'll have to find somewhere else to
break.

With regard to -x, is this error actually referring to the gdb
environment -x or the gdb invocation?  Perhaps older versions of gdb
don't support -x?

Ryan



      


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