How to debug a program wrapped in a libtool script?

。_饼干妹妹 提交于 2019-12-03 06:06:59

This is problem I ran into a couples of days ago and there is no generic answer on SO yet. Only special cases. Here is the answer I found on this page: http://www.gnu.org/software/libtool/manual/html_node/Debugging-executables.html

Until the program is installed, the system does not know where to look for the shared objects. They usually lies in .libs sub-directory of their source folder.

Libtool generates a convenience script to allow debugging before the actual installation is done (who wants to install buggy software before, debug it after?)

Fortunately, the generated script provides a helper for this:

libtool --mode=execute gdb test_mylib
nobar

The solution recommended by the libtool docs is to use static linking during development, as I decribed at: Build libtool application with static linking to local components

To do this, use the --disable-shared option to the ./configure script.

For example:

./configure --enable-debug --disable-shared

Now the generated executable is a directly executable binary rather than a libtool script.

This has the added benefit of roughly halving the build time.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!