我正在使用命令cmake .. -G "CodeBlocks - Ninja
编译我的项目,它工作正常,但是当我运行valgrind时它不会显示任何行号。
这是我正在使用的valgrind命令:valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --log-file="log.txt" ./pony_gpExe
。
以下是输出示例:
==5402== Use of uninitialised value of size 8
==5402== at 0x40447B: get_double_arr_length (in /home/robbie/Dropbox/MIT/pony_gp_ubuntu/build/pony_gpExe)
==5402== by 0x405184: get_test_and_train_data (in /home/robbie/Dropbox/MIT/pony_gp_ubuntu/build/pony_gpExe)
==5402== by 0x4027B3: setup (in /home/robbie/Dropbox/MIT/pony_gp_ubuntu/build/pony_gpExe)
==5402== by 0x402861: main (in /home/robbie/Dropbox/MIT/pony_gp_ubuntu/build/pony_gpExe)
==5402== Uninitialised value was created by a stack allocation
==5402== at 0x405149: get_test_and_train_data (in /home/robbie/Dropbox/MIT/pony_gp_ubuntu/build/pony_gpExe)
不确定这是否有用,但这是我的主要CMakeLists.txt:
cmake_minimum_required(VERSION 3.4.3)
project (pony_gp)
set(DIR ${pony_gp_SOURCE_DIR})
file(GLOB_RECURSE pony_gp_SOURCES "${DIR}/src/*.c")
file(GLOB_RECURSE pony_gp_HEADERS "${DIR}/include/*.h")
foreach (_headerFile ${pony_gp_HEADERS})
get_filename_component(_dir ${_headerFile} PATH)
list (APPEND pony_gp_INCLUDE_DIRS ${_dir})
endforeach()
list(REMOVE_DUPLICATES pony_gp_INCLUDE_DIRS)
include("${DIR}/include/CMakeLists.txt")
include_directories(${pony_gp_INCLUDE_DIRS})
add_executable (pony_gpExe ${pony_gp_SOURCES})
if (CMAKE_COMPILER_IS_GNUCC)
target_link_libraries(pony_gpExe m)
find_program(MEMORYCHECK_COMMAND valgrind)
set(MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full")
set(MEMORYCHECK_SUPPRESSIONS_FILE "${DIR}/valgrind_suppress.txt")
endif()
include(CTest)
add_test(test pony_gpExe)
答案 0 :(得分:2)
您需要告诉cmake
生成调试可执行文件。没有看到你的cmake配置,很难告诉你如何做到这一点,但默认/约定,它应该是:
cmake -DCMAKE_BUILD_TYPE=Debug
有关其他信息,请参阅Debug vs Release in CMAKE上的此答案。
答案 1 :(得分:1)
我希望您使用<%= render 'shared/navbar' unless (controller.controller_name == "messages" && controller.action_name == "new") || (controller.controller_name == "links" && controller.action_name == "edit") || (controller.controller_name == "messages" && controller.action_name == "edit") %>
<%= render 'shared/sidebar' unless current_page?(root_path) || current_page?(edit_user_registration_path) || (controller.controller_name == "companies" && controller.action_name == "index") || (controller.controller_name == "companies" && controller.action_name == "create") || (controller.controller_name == "companies" && controller.action_name == "new") || current_page?(new_company_path) || (controller.controller_name == "links" && controller.action_name == "edit") || (controller.controller_name == "messages" && controller.action_name == "new") || (controller.controller_name == "messages" && controller.action_name == "edit") %>
编译代码并假设您在-g
或Ubuntu
尝试运行这样的Mac OS
,它可以解决Ubuntu中的问题
valgrind
答案 2 :(得分:0)
所以,我不知道为什么,但随机的valgrind开始显示行号...我没有做任何不同的事情,但无论哪种方式都有效......