如何保存 "set solib-search-path"?

3
我想了解Linux中的GDB调试。
我有一个可执行文件和一个核心转储文件。 因此,我在Linux中打开它, 像这样:
gdb exefilename -c exefuilename.core

但是,我只显示错误信息。
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"?

所以,我输入了命令,
set solib-search-path /librarypath/

and symbol read succeed. and, I input command

quit

"并且,我重新打开转储文件。就像这样,"
gdb exefilename -c exefuilename.core

但仍然显示相同的错误信息。
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"?

我不想再显示这个错误消息了。 因此,我想保存图书馆搜索路径。 我该怎么做?
1个回答

5
你可以创建一个名为.gdbinit的文件。
你可以将其放在你的主文件夹中(这样它就会被加载到所有项目中),或者放在当前目录中(这样它就会被用于从该文件夹加载的gdb会话)。
有许多不同复杂度的有趣示例。建议先从简单的开始-只需在本地文件夹中创建一个带有那一行的.gdbinit即可。
set solib-search-path /librarypath/

如果需要的话,您可以稍后添加更多内容。


1
嗨,Windows 怎么办?我在用户路径中有 .gdbinit 文件,但没有变化... - Sixjac

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接