User forums > Using Code::Blocks

Debug a shared library

<< < (2/2)

BlueHazzard:
you have to check if your library is build with the -g compiler switch... i don't know if your CMake skript allows adding compiler options, but if so, add -g and try again...

greetins

ifeelfree:
Thanks, I have double-checked. Some build log messages are as follows:
[ 89%] Building CXX object src/abc/CMakeFiles/abcimp.dir/__/ImageProc/abc.cpp.o
cd /home/aaa/Desktop/branch/aaa_branch/build/src/test && /usr/bin/c++   -Dtest_EXPORTS -DVERBOSE -fPIC -fvisibility=hidden -g -std=c++0x -g -fPIC -     -o CMakeFiles/abcimp.dir/__/ImageProc/abc.cpp.o -c /home/aaa/Desktop/branch/irisimp_branch/src/ImageProc/abc.pp
/usr/bin/cmake -E cmake_progress_report /home/aaa/Desktop/branch/aaa_branch/build/CMakeFiles

As you can see, I use two '-g' this time in order to make sure that I am using the right compilation option.


--- Quote from: BlueHazzard on July 30, 2013, 04:36:29 pm ---you have to check if your library is build with the -g compiler switch... i don't know if your CMake skript allows adding compiler options, but if so, add -g and try again...

greetins

--- End quote ---

oBFusCATed:
Try debugging this project with command line gdb, if it works there it is a problem with C::B.
If it doesn't (which will be the case), you have two options:
1. inspecting you build to ensure the proper thing is built in the proper place with the proper options.
2. report the problem to the provider of your gdb

ifeelfree:
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.

oBFusCATed:
 ;D

Navigation

[0] Message Index

[*] Previous page

Go to full version