2014-02-20 73 views
0

我有一些問題使用Valgrind檢查內存泄漏(並瞭解我在fprintf中獲得的段錯誤),但似乎有一些o未初始化的值使用不是來自我的代碼。 我是新來的調試器調試,所以我可能會錯過一些東西。OpenMP未初始化的值和Valgrind

我知道Valgrind是不是舒適與我的默認GCC的OpenMP(http://valgrind.org/docs/manual/drd-manual.html#drd-manual.openmp),但我使用它,compilimg我的代碼以-pedantic -Wall -static -O0 -g -fopenmp我沒有得到任何錯誤。

然而,隨着

valgrind --leak-check=full --track-origins=yes --error-limit=no --log-file=./logfile ~/developing/trunk/gop.exe 

運行Valgrind的,當我在日誌文件中得到了很多的警告開始

==5944== Memcheck, a memory error detector 
==5944== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. 
==5944== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info 
==5944== Command: /home/henrique/developing/trunk/gop.exe 
==5944== Parent PID: 11534 
==5944== 
==5944== Syscall param set_robust_list(head) points to uninitialised byte(s) 
==5944== at 0x4983DF: __pthread_initialize_minimal (nptl-init.c:369) 
==5944== by 0x498920: (below main) (libc-start.c:146) 
==5944== Address 0x4000bf0 is not stack'd, malloc'd or (recently) free'd 
==5944== Uninitialised value was created 
==5944== at 0x513A6A: brk (brk.c:32) 
==5944== by 0x4ED4EB: sbrk (sbrk.c:54) 
==5944== by 0x498C13: __libc_setup_tls (libc-tls.c:150) 
==5944== by 0x498366: __pthread_initialize_minimal (nptl-init.c:296) 
==5944== by 0x498920: (below main) (libc-start.c:146) 

,然後讓很多警告(千!)的一個類似低於

==5944== Conditional jump or move depends on uninitialised value(s) 
==5944== at 0x4EF546: __linkin_atfork (register-atfork.c:119) 
==5944== by 0x4BA5D3: ptmalloc_init (arena.c:388) 
==5944== by 0x4BB283: malloc_hook_ini (hooks.c:32) 
==5944== by 0x51842B: _dl_init_paths (dl-load.c:732) 
==5944== by 0x4F097A: _dl_non_dynamic_init (dl-support.c:268) 
==5944== by 0x4F1352: __libc_init_first (init-first.c:83) 
==5944== by 0x49895B: (below main) (libc-start.c:165) 
==5944== Uninitialised value was created 
==5944== at 0x513A6A: brk (brk.c:32) 
==5944== by 0x4ED4EB: sbrk (sbrk.c:54) 
==5944== by 0x498C13: __libc_setup_tls (libc-tls.c:150) 
==5944== by 0x498366: __pthread_initialize_minimal (nptl-init.c:296) 
==5944== by 0x498920: (below main) (libc-start.c:146) 

我在編譯或運行Valgrind時丟失了什麼?或者我的代碼真的有所有這些錯誤?

非常感謝!

回答

0

一些圖書館確實有很多小警告,比如你正在展示的警告。 我不認爲他們來自你的代碼在這裏看到它們發生的文件的名稱。

你必須在其他地方找你的段錯誤。嘗試使用gdb運行它,查看它停止的位置並在錯誤周圍打印值以查看發生了什麼。

希望它有幫助:)

相關問題