Cmake apparently ignoring CMAKE_BUILD_TYPE? -
so i'm using cmake project. consists of set of shared libraries linked 1 executable. generated in project (there no external targets). each sub project lives in own directory, own cmakelists file.
so make out-of-source build, taking care set cmake_build_type debug, , run cmake, , make. use gnu make 3.81, gcc 4.8.1, binutils 2.23.2 , cmake 3.2.3 on windows box using msys/mingw.
the problem that, when load executable in gdb (version 7.6), place breakpoint on function 1 of shared libraries, , try single step, gdb skips whole function saying has no line number information.
according understanding, line number information part of debugging information, expected generated during compiling process (as per cmake_build_type) didn't, know how can cmake generate line number information (that is, without manually adding compiler-specific options in cmake files, although take if it's solution).
i've tried setting cmake_build_type command line (when invoking cmake utility), inside cmakelists, , modifying cmakecache.txt, , restarting build empty directory no success. made sure cmake_build_type set debug using message command print it's value, , correctly set debug. executed 'make verbose=1' see if correct compiler option added, , found correctly used "-g" option (although have expected -ggdb, more on later). cmake documentation , google did not bring me answers. hypothesis -g option generates basic debugging information (such mappings between functions , memory addresses, , how access arguments) whereas -ggdb generate more in-detail debugging information in gdb-specific format, including said line number informations), troubling fact that, when running executable in gdb, functions defined inside executable have line number information, shared libraries don't, hence confusion.
Comments
Post a Comment