This is the mail archive of the gdb@sourceware.org mailing list for the GDB 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: How to set the path of shared library in Linux


-----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.


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