|
|
装完gentoo,用valgrind测试代码有很多问题。
$ cat 1.c
int main()
{
return 0;
}
$ gcc 1.c -o 1
$ valgrind -v --track-origins=yes --trace-children=yes --undef-value-errors=yes --leak-check=full --show-reachable=yes --log-file=debug.log ./1
很多错误信息:
==4528== 401 errors in context 297 of 297:
==4528== Use of uninitialised value of size 8
==4528== at 0x4009082: (within /lib64/ld-2.10.1.so)
==4528== by 0x40095AD: (within /lib64/ld-2.10.1.so)
==4528== by 0x400AD28: (within /lib64/ld-2.10.1.so)
==4528== by 0x40039D8: (within /lib64/ld-2.10.1.so)
==4528== by 0x401422B: (within /lib64/ld-2.10.1.so)
==4528== by 0x4001471: (within /lib64/ld-2.10.1.so)
==4528== by 0x4000BA7: (within /lib64/ld-2.10.1.so)
==4528== Uninitialised value was created by a stack allocation
==4528== at 0x4003BE1: (within /lib64/ld-2.10.1.so)
--4528--
--4528-- supp: 21 dl-hack3-cond-2
--4528-- supp: 4 dl-hack3-cond-3
--4528-- supp: 855 dl-hack3-cond-1
==4528==
==4528== IN SUMMARY: 3805 errors from 297 contexts (suppressed: 880 from 3)
==4528==
==4528== malloc/free: in use at exit: 0 bytes in 0 blocks.
==4528== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==4528==
==4528== All heap blocks were freed -- no leaks are possible.
--4528-- memcheck: sanity checks: 0 cheap, 1 expensive
--4528-- memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use
--4528-- memcheck: auxmaps_L1: 0 searches, 0 cmps, ratio 0:10
--4528-- memcheck: auxmaps_L2: 0 searches, 0 nodes
--4528-- memcheck: SMs: n_issued = 13 (208k, 0M)
--4528-- memcheck: SMs: n_deissued = 0 (0k, 0M)
--4528-- memcheck: SMs: max_noaccess = 524287 (8388592k, 8191M)
--4528-- memcheck: SMs: max_undefined = 0 (0k, 0M)
--4528-- memcheck: SMs: max_defined = 118 (1888k, 1M)
--4528-- memcheck: SMs: max_non_DSM = 13 (208k, 0M)
--4528-- memcheck: max sec V bit nodes: 92 (7k, 0M)
--4528-- memcheck: set_sec_vbits8 calls: 1258 (new: 92, updates: 1166)
--4528-- memcheck: max shadow mem size: 4359k, 4M
--4528-- ocacheL1: 2,182,637 refs 251,780 misses (0 lossage)
--4528-- ocacheL1: 1,923,048 at 0 7,809 at 1
--4528-- ocacheL1: 0 at 2+ 251,842 move-fwds
--4528-- ocacheL1: 100,663,296 sizeB 67,108,864 useful
--4528-- ocacheL2: 251,780 refs 251,780 misses
--4528-- ocacheL2: 0 max nodes 0 curr nodes
--4528-- niacache: 2,256 refs 374 misses
--4528-- translate: fast SP updates identified: 1,130 ( 88.6%)
--4528-- translate: generic_known SP updates identified: 103 ( 8.0%)
--4528-- translate: generic_unknown SP updates identified: 42 ( 3.2%)
--4528-- tt/tc: 3,032 tt lookups requiring 3,047 probes
--4528-- tt/tc: 3,032 fast-cache updates, 2 flushes
--4528-- transtab: new 1,510 (35,136 -> 802,717; ratio 228:10) [0 scs]
--4528-- transtab: dumped 0 (0 -> ??)
--4528-- transtab: discarded 0 (0 -> ??)
--4528-- scheduler: 21,528 jumps (bb entries).
--4528-- scheduler: 0/1,566 major/minor sched events.
--4528-- sanity: 1 cheap, 1 expensive checks.
--4528-- exectx: 1,543 lists, 1,463 contexts (avg 0 per list)
--4528-- exectx: 5,822 searches, 5,291 full compares (908 per 1000)
--4528-- exectx: 110,212 cmp2, 6,379 cmp4, 0 cmpAll
--4528-- errormgr: 398 supplist searches, 23,632 comparisons during search
--4528-- errormgr: 4,685 errlist searches, 174,347 comparisons during search |
|