简体   繁体   中英

Debug a shared C++ library with CodeBlocks

I have a question related to debugging a shared library with codeblocks in Ubuntu. I have no problem when I run the program with the shared library. The main problem, however, is that when I debug the program, I cannot go into the source codes of the shared library. The source codes of the shared library is provided, and I build the shared library first before I build the program. I guess that I need to set some parameters for the program's codeblocks project before running the debugging, but I have no idea where I should do the setting. Many thanks.

EDIT:

My project structure is something like that:

./program the running application program that will invoke run_test.so

run_test.so the test dynamic library that will invoke basic_library.so

basic_library.so the library called by run_test.so

When I debug ./program project I can go into the source codes of run_test.so , but when I want to step into the functions coming from basic_library.so in the source code of run_test.so , I have problems. It just ignore the step into command.

After a careful examination, I found the reason why I cannot debug the shared library, in CMAKE scrip I have the following code:

set_target_properties(basic_library PROPERTIES LINK_FLAGS "-W1 --strip-all".

After I remove --strip-all, I can debug now.

You need to build the shared library with debug symbols. There are instructions here
Essentially, Project build options | Produce debugging symbols Project build options | Produce debugging symbols

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM