debugging - 由于缺少符号,我无法在代码块中调试

标签 debugging ubuntu codeblocks

我正在尝试使用代码块进行调试,但无法使其正常工作。我收到以下消息:

Building to ensure sources are up-to-date
Build succeeded
Selecting target: 
femtosim
Adding source dir: /home/dlopez/Simulator/build/
Adding source dir: /home/dlopez/Simulator/
Changing directory to: /home/dlopez/Simulator/build/femtosim
Adding file: /home/dlopez/Simulator/build/femtosim/femtosim
Starting debugger: 
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
(no debugging symbols found)...done.
Debugger name and version: GNU gdb (GDB) 7.1-ubuntu
No symbol table is loaded.  Use the "file" command.
Breakpoint 1 ("/home/dlopez/Simulator/femtosim/main.cpp:71) pending.
Program exited with code 01.
Debugger finished with status 0

构建日志:
cd /home/dlopez/Simulator/build && /usr/bin/make -f CMakeFiles/Makefile2 femtosim/CMakeFiles/femtosim.dir/rule
make[1]: Entering directory `/home/dlopez/Simulator/build'
/usr/bin/cmake -H/home/dlopez/Simulator -B/home/dlopez/Simulator/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/dlopez/Simulator/build/CMakeFiles 83
/usr/bin/make -f CMakeFiles/Makefile2 femtosim/CMakeFiles/femtosim.dir/all
make[2]: Entering directory `/home/dlopez/Simulator/build'
/usr/bin/make -f femtosim/CMakeFiles/femtosim-lib.dir/build.make femtosim/CMakeFiles/femtosim-lib.dir/depend
make[3]: Entering directory `/home/dlopez/Simulator/build'
cd /home/dlopez/Simulator/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/dlopez/Simulator /home/dlopez/Simulator/femtosim /home/dlopez/Simulator/build /home/dlopez/Simulator/build/femtosim /home/dlopez/Simulator/build/femtosim/CMakeFiles/femtosim-lib.dir/DependInfo.cmake --color=
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/make -f femtosim/CMakeFiles/femtosim-lib.dir/build.make femtosim/CMakeFiles/femtosim-lib.dir/build
make[3]: Entering directory `/home/dlopez/Simulator/build'
make[3]: Nothing to be done for `femtosim/CMakeFiles/femtosim-lib.dir/build'.
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/cmake -E cmake_progress_report /home/dlopez/Simulator/build/CMakeFiles  46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
[ 34%] Built target femtosim-lib
/usr/bin/make -f json/CMakeFiles/json.dir/build.make json/CMakeFiles/json.dir/depend
make[3]: Entering directory `/home/dlopez/Simulator/build'
cd /home/dlopez/Simulator/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/dlopez/Simulator /home/dlopez/Simulator/json /home/dlopez/Simulator/build /home/dlopez/Simulator/build/json /home/dlopez/Simulator/build/json/CMakeFiles/json.dir/DependInfo.cmake --color=
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/make -f json/CMakeFiles/json.dir/build.make json/CMakeFiles/json.dir/build
make[3]: Entering directory `/home/dlopez/Simulator/build'
make[3]: Nothing to be done for `json/CMakeFiles/json.dir/build'.
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/cmake -E cmake_progress_report /home/dlopez/Simulator/build/CMakeFiles  75 76 77
[ 38%] Built target json
/usr/bin/make -f lemon/CMakeFiles/lemon.dir/build.make lemon/CMakeFiles/lemon.dir/depend
make[3]: Entering directory `/home/dlopez/Simulator/build'
cd /home/dlopez/Simulator/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/dlopez/Simulator /home/dlopez/Simulator/lemon /home/dlopez/Simulator/build /home/dlopez/Simulator/build/lemon /home/dlopez/Simulator/build/lemon/CMakeFiles/lemon.dir/DependInfo.cmake --color=
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/make -f lemon/CMakeFiles/lemon.dir/build.make lemon/CMakeFiles/lemon.dir/build
make[3]: Entering directory `/home/dlopez/Simulator/build'
make[3]: Nothing to be done for `lemon/CMakeFiles/lemon.dir/build'.
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/cmake -E cmake_progress_report /home/dlopez/Simulator/build/CMakeFiles  78 79 80 81 82 83 84
[ 46%] Built target lemon
/usr/bin/make -f cwind/CMakeFiles/cwind.dir/build.make cwind/CMakeFiles/cwind.dir/depend
make[3]: Entering directory `/home/dlopez/Simulator/build'
cd /home/dlopez/Simulator/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/dlopez/Simulator /home/dlopez/Simulator/cwind /home/dlopez/Simulator/build /home/dlopez/Simulator/build/cwind /home/dlopez/Simulator/build/cwind/CMakeFiles/cwind.dir/DependInfo.cmake --color=
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/make -f cwind/CMakeFiles/cwind.dir/build.make cwind/CMakeFiles/cwind.dir/build
make[3]: Entering directory `/home/dlopez/Simulator/build'
make[3]: Nothing to be done for `cwind/CMakeFiles/cwind.dir/build'.
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/cmake -E cmake_progress_report /home/dlopez/Simulator/build/CMakeFiles  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
[ 98%] Built target cwind
/usr/bin/make -f femtosim/CMakeFiles/femtosim.dir/build.make femtosim/CMakeFiles/femtosim.dir/depend
make[3]: Entering directory `/home/dlopez/Simulator/build'
cd /home/dlopez/Simulator/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/dlopez/Simulator /home/dlopez/Simulator/femtosim /home/dlopez/Simulator/build /home/dlopez/Simulator/build/femtosim /home/dlopez/Simulator/build/femtosim/CMakeFiles/femtosim.dir/DependInfo.cmake --color=
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/make -f femtosim/CMakeFiles/femtosim.dir/build.make femtosim/CMakeFiles/femtosim.dir/build
make[3]: Entering directory `/home/dlopez/Simulator/build'
make[3]: Nothing to be done for `femtosim/CMakeFiles/femtosim.dir/build'.
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/cmake -E cmake_progress_report /home/dlopez/Simulator/build/CMakeFiles  45
[100%] Built target femtosim
make[2]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/cmake -E cmake_progress_start /home/dlopez/Simulator/build/CMakeFiles 0
make[1]: Leaving directory `/home/dlopez/Simulator/build'
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

注意:
  • 我曾使用外部 cmake 构建我的项目
  • 在项目构建选项中,我正在检查生成调试符号 [-g]。

  • 我需要设置其他路径吗

    这是我的 Cmake 文件:
    CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
    
    SET(PROJECT_NAME "CWIND-NG")
    SET(PROJECT_VERSION_MAJOR "0")
    SET(PROJECT_VERSION_MINOR "1")
    SET(PROJECT_VERSION_PATCH "0")
    SET(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
    
    PROJECT(${PROJECT_NAME})
    
    CONFIGURE_FILE(
      ${CMAKE_SOURCE_DIR}/doc/Doxyfile.in
      ${CMAKE_BINARY_DIR}/doc/Doxyfile
      @ONLY
    )
    
    SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
    
    SET(ENABLE_MPI OFF CACHE BOOL "MPI support.")
    
    IF(ENABLE_MPI)
      FIND_PACKAGE(MPI REQUIRED)
      FIND_PACKAGE(Boost 1.36.0 REQUIRED serialization mpi)
      ADD_DEFINITIONS(-DENABLE_MPI)
    ENDIF(ENABLE_MPI)
    
    IF(CMAKE_COMPILER_IS_GNUCXX)
      SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -ansi")
    ENDIF(CMAKE_COMPILER_IS_GNUCXX)
    
    IF(MSVC)
      ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE)
    ENDIF(MSVC)
    
    SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DCWIND_ASSERTS_ENABLED")
    
    SET(ENABLE_CUFDSIM OFF CACHE BOOL "Build CuFDSim as subproject.")
    IF(ENABLE_CUFDSIM)
      ADD_SUBDIRECTORY(CuFDSim)
    ENDIF(ENABLE_CUFDSIM)
    
    ADD_SUBDIRECTORY(json)
    ADD_SUBDIRECTORY(lemon)
    ADD_SUBDIRECTORY(cwind)
    ADD_SUBDIRECTORY(bin)
    ADD_SUBDIRECTORY(femtosim)
    ADD_SUBDIRECTORY(ltesim)
    
    IF(UNIX)
      ADD_CUSTOM_TARGET(html
    #    COMMAND rm -rf html
        COMMAND doxygen Doxyfile
        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc)
    ELSEIF(WIN32)
      ADD_CUSTOM_TARGET(html
    #    COMMAND if exist html rmdir /s /q html
        COMMAND doxygen Doxyfile
        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc)
    ENDIF(UNIX)
    

    最佳答案

    (no debugging symbols found)...done.



    这是调试失败的主要原因。

    该项目是使用cmake配置编译的,IDE中的-g设置完全没有用,因此CMakeListes.txt中缺少调试配置导致调试符号丢失。

    请引用 this link

    使用调试配置重新生成 Makefile,目标将包含调试符号。

    关于debugging - 由于缺少符号,我无法在代码块中调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11938867/

    相关文章:

    c++ - 如何检测错误写入

    python - 如何捕获 Django 400 错误

    apache - 在 Ubuntu 14.04 VPS (Digital Ocean) 上部署 Flask 应用程序的问题

    php - 向 Apache 和 PHP 公开环境变量

    C++ 代码:: block 自动完成不工作

    osx-mountain-lion - CodeBlocks 在 Mac OS 上意外退出

    c++ - 基本平均程序中的意外数组行为

    python - 找到在标准输出上打印一些调试内容的源代码行

    eclipse - 如何在 Ubuntu 中为 Eclipse 中的调试配置添加 sudo?

    git - 致命的 : Could not read from remote repository. ;因为静态机器登录