linuxdebugginggdbvisualgdb

how to save "set solib-search-path"


I wonder linux gdb debugging.

I have 1 execute file, 1 core dump file. so, I opened it in linux like this,

gdb exefilename -c exefuilename.core

but, I only show error message.

warning: Could not load shared library symbols for 44 libraries, e.g. /usr/local/lib/libboost_system.so.1.55.0.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?

so, I input command,

set solib-search-path /librarypath/

and symbol read succeed. and, I input command

quit

and, I reopen dump file. like this,

gdb exefilename -c exefuilename.core

but still show same error message.

warning: Could not load shared library symbols for 44 libraries, e.g. /usr/local/lib/libboost_system.so.1.55.0.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?

I don't want to show this error message never. so, I want to save library search path. how Can I do?


Solution

  • You can create a file called .gdbinit

    You can put this either in your home folder (and it will be loaded for all projects) or in your current directory (and it will be used for gdb sessions loaded from this folder).

    There are a bunch of interesting examples of various complexity around. I'd keep it simple to start with - just create a .gdbinit in your local folder with that one line

    set solib-search-path /librarypath/
    

    And maybe add more later, if you need to.