Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Robert Bu" <robert.bu@gmail.com>
To: robert.bu@gmail.com, gdb@sourceware.org
Subject: Re: How to set the path of shared library in Linux
Date: Wed, 27 Feb 2008 03:24:00 -0000	[thread overview]
Message-ID: <a0319f700802261916p29815c85ice625d524367be69@mail.gmail.com> (raw)

-----Original Message-----
From: Daniel Jacobowitz
Sent: 2008-02-27 10:29

> On Wed, Feb 27, 2008 at 10:22:13AM +0800, Robert Bu wrote:
>> Hello,
>>
>> How can I set the search path of the shared libraries in Linux for GDB?
>> I tried "set solib-search-path path_to_my_shared_lib", but GDB still
>> tries the $LD_LIBRARY_PATH first. I have two versions of the same shared
>> library, one is in $LD_LIBRARY_PATH, the other is in
>> path_to_my_shared_libray ( not in $LD_LIBRARY_PATH). GDB just always
>> uses the one in $LD_LIBRARY_PATH.
>
> I'm assuming you are doing local, native debugging (that is, "run").
>
> GDB should load symbols for whichever one your program is actually
> using.  A common problem is that GDB uses a shell to start your
> program; check that it isn't changing the search paths.  If GDB
> is not loading the same one the program is using, please show us a
> complete transcript of the debug session.
>

Thank you for your immediate response.

Yes, I'm doing native debugging. And the GDB version is 6.7.1. Below is
the debug session:

GNU gdb 6.7.1
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) r
Starting program: /home/robert_bu/local/rlxvm_static_gcc323/bin/engine
-c platform/others/rlxvm_config_lance.h
/home/robert_bu/local/rlxvm_static_gcc323/bin/engine: relocation error:
/home/STools/RLX/scv-1.0p2-sysc-2.2.0-gcc-3.2.3/lib-linux/libscv.so:
undefined symbol: _ZN5sc_dt14convert_to_fmtERKSsNS_9sc_numrepEb

Program exited with code 0177.
(gdb) show solib-search-path
The search path for loading non-absolute shared library symbol files is .
(gdb) set solib-search-path /home/robert_bu/local/rlxvm_static_gcc323/lib
(gdb) r
Starting program: /home/robert_bu/local/rlxvm_static_gcc323/bin/engine
-c platform/others/rlxvm_config_lance.h
/home/robert_bu/local/rlxvm_static_gcc323/bin/engine: relocation error:
/home/STools/RLX/scv-1.0p2-sysc-2.2.0-gcc-3.2.3/lib-linux/libscv.so:
undefined symbol: _ZN5sc_dt14convert_to_fmtERKSsNS_9sc_numrepEb

Program exited with code 0177.
(gdb) shell ls /home/robert_bu/local/rlxvm_static_gcc323/lib
librlxvm.a  librlxvm.la*  libscv.so*
(gdb)

As you can see GDB always tries
"/home/STools/RLX/scv-1.0p2-sysc-2.2.0-gcc-3.2.3/lib-linux/" instead of
using "/home/robert_bu/local/rlxvm_static_gcc323/lib" as I set.

However, If I set this path to LD_LIBRARY_PATH, GDB can find it
successfully.


             reply	other threads:[~2008-02-27  3:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-27  3:24 Robert Bu [this message]
2008-02-27  5:49 ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2008-02-27  2:29 Robert Bu
2008-02-27  3:16 ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a0319f700802261916p29815c85ice625d524367be69@mail.gmail.com \
    --to=robert.bu@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox