Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

loading gdb source for a shared library

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

like image 847
lurscher Avatar asked Dec 14 '25 09:12

lurscher


2 Answers

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

like image 78
Foo Bah Avatar answered Dec 17 '25 01:12

Foo Bah


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.

like image 22
Sergei Tachenov Avatar answered Dec 16 '25 23:12

Sergei Tachenov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!