loading gdb source for a shared library

限于喜欢 提交于 2019-12-22 10:24:32

问题


i'm using gdb 7.2 on ubuntu 10.10

while stepping with step i get to a point that looks (literally) like this:

0x00130a2c in boost::contexts::context::impl_t::impl_t(void (*)(void*), void*, unsigned int, boost::contexts::context::impl_t*, std::auto_ptr<boost::contexts::context::allocator_base>) () from /home/lurscher/third_party/boost_1_45_0/stage/lib/libboost_context.so.1.45.0

So i want now to associate the appropiate source files; which likely should be on /home/lurscher/third_party/boost_1_45_0/boost/context and /home/lurscher/third_party/boost_1_45_0/libs/context.

But the truth is i'm not sure how to achieve this, its been years since i had to debug in terminal mode


回答1:


You can compile the third-party library with debugging symbols, and those debugging symbols will chain [i.e. if your app is compiled with debugging symbols, you can step through and see the source lines even within the library]

boost jam takes a debug argument which will instruct it to build a debug version.

in gcc, debug symbols is -g




回答2:


If your library is compiled in the debug mode, but GDB just doesn't find the sources, you should use the dir command to add the source directory to the search list.



来源:https://stackoverflow.com/questions/4801479/loading-gdb-source-for-a-shared-library

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