现象

碰到一个core , 用gdb 去分析,对应不到代码:

warning: Could not load shared library symbols for 19 libraries, e.g. linux-vdso.so.1.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?

warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7fffe51ae000
Core was generated by `./sbin/tgtd -f'.
Program terminated with signal 11, Segmentation fault.
#0 0x00007f6dfde05212 in ?? ()
(gdb) set solib-search-path ./lib/backing-store/bs_bec_ebs.so
linux-vdso.so.1: Not a directory.
(gdb) bt
#0 0x00007f6dfde05212 in ?? ()
#1 0x0000000000000000 in ?? ()
(gdb) info sharedlibrary

解决办法

方法一: 根据提示手动加载

warning: Could not load shared library symbols for 19 libraries, e.g. linux-vdso.so.1.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?

warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7fffe51ae000
Core was generated by `./sbin/tgtd -f'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f6dfde05212 in ?? ()
(gdb) set solib-search-path ./lib/backing-store/bes.so
linux-vdso.so.1: Not a directory.
(gdb) bt
#0  0x00007f6dfde05212 in ?? ()
#1  0x0000000000000000 in ?? ()
(gdb) info sharedlibrary

方法二: 指定加载路径


Core was generated by `./sbin/tgtd -f'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f6dfde05212 in ?? ()
(gdb) set solib-search-path /opt/compiler/gcc-4.8.2/lib/
Reading symbols from /opt/compiler/gcc-4.8.2/lib64/libpthread-2.18.so...(no debugging symbols found)...done.
warning: File "/opt/compiler/gcc-4.8.2/lib64/libthread_db-1.0.so" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
        add-auto-load-safe-path /opt/compiler/gcc-4.8.2/lib64/libthread_db-1.0.so
line to your configuration file "/root/.gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/root/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
Loaded symbols for /opt/compiler/gcc-4.8.2/lib64/libpthread-2.18.so
Reading symbols from /opt/compiler/gcc-4.8.2/lib64/libdl-2.18.so...(no debugging symbols found)...done.
Loaded symbols for /opt/compiler/gcc-4.8.2/lib64/libdl-2.18.so
Reading symbols from /opt/compiler/gcc-4.8.2/lib64/libstdc++.so.6.0.18...done.
Loaded symbols for /opt/compiler/gcc-4.8.2/lib64/libstdc++.so.6.0.18
Reading symbols from /opt/compiler/gcc-4.8.2/lib64/librt-2.18.so...(no debugging symbols found)...done.
Loaded symbols for /opt/compiler/gcc-4.8.2/lib64/librt-2.18.so

参考链接

http://visualgdb.com/gdbreference/commands/set_solib-search-path

http://www.voidcn.com/article/p-roqlkmxp-pz.html