valgrind
Lo script del test harness genera un file di controllo che può essere utilizzato direttamente eseguendo questo comando:
Executing /nz/kit/bin/adm/udxharness -f APPLYOP_CPP_func.harness -k /nz/kit
Il comando può essere eseguito con valgrind, uno strumento per verificare la presenza di perdite di memoria e di buffer overrun, come segue:
[nz@bdrosendev src]$ /usr/local/bin/valgrind --leak-check=full \
--trace-children=yes -v /nz/kit/bin/adm/udxharness \
-f APPLYOP_CPP_func.harness -k /nz/kit
==31254== Memcheck, a memory error detector.
==31254== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.
==31254== Using LibVEX rev 1884, a library for dynamic binary translation.
==31254== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
==31254== Using valgrind-3.4.1, a dynamic binary instrumentation framework.
==31254== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
==31254==
--31254-- Command line
--31254-- /nz/kit/bin/adm/udxharness
--31254-- -f
--31254-- APPLYOP_CPP_func.harness
--31254-- -k
--31254-- /nz/kit
--31254-- Startup, with flags:
--31254-- --leak-check=full
--31254-- --trace-children=yes
--31254-- -v
--31254-- Contents of /proc/version:
--31254-- Linux version 2.6.18-128.el5 (mockbuild@hs20-bc1-7.build.redhat.com)
(gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)) #1 SMP Wed Dec 17 11:41:38 EST
2008
--31254-- Arch and hwcaps: X86, x86-sse1-sse2
--31254-- Page sizes: currently 4096, max supported 4096
--31254-- Valgrind library directory: /usr/local/lib/valgrind
--31254-- Reading syms from /lib/ld-2.5.so (0x7dc000)
--31254-- Reading syms from /nz/kit/bin/adm/udxharness (0x8048000)
--31254-- Reading syms from /usr/local/lib/valgrind/x86-linux/memcheck
(0x38000000)
--31254-- object doesn't have a dynamic symbol table
--31254-- Reading suppressions file: /usr/local/lib/valgrind/default.supp
--31254-- REDIR: 0x7f17b0 (index) redirected to 0x38039953
(vgPlain_x86_linux_REDIR_FOR_index)
--31254-- Reading syms from /usr/local/lib/valgrind/x86-linux/vgpreload_core.so
(0x47c0000)
--31254-- Reading syms from /usr/local/lib/valgrind/x86-
linux/vgpreload_memcheck.so (0x47c6000)
==31254== WARNING: new redirection conflicts with existing -- ignoring it
--31254-- new: 0x007f17b0 (index ) R-> 0x047c97d0 index
--31254-- REDIR: 0x7f1950 (strlen) redirected to 0x47c9990 (strlen)
--31254-- Reading syms from /lib/libdl-2.5.so (0x982000)
--31254-- Reading syms from /lib/libpthread-2.5.so (0x969000)
--31254-- Reading syms from /lib/libm-2.5.so (0x940000)
--31254-- Reading syms from /lib/libc-2.5.so (0x7fa000)
--31254-- REDIR: 0x86aba0 (memset) redirected to 0x47c9cf0 (memset)
--31254-- REDIR: 0x86b090 (memcpy) redirected to 0x47cab90 (memcpy)
--31254-- REDIR: 0x869d00 (rindex) redirected to 0x47c96b0 (rindex)
--31254-- REDIR: 0x869960 (strlen) redirected to 0x47c9970 (strlen)
--31254-- REDIR: 0x865330 (malloc) redirected to 0x47c89f0 (malloc)
--31254-- REDIR: 0x869400 (strcmp) redirected to 0x47c9a40 (strcmp)
--31254-- REDIR: 0x866b30 (free) redirected to 0x47c8590 (free)
--31254-- REDIR: 0x869290 (index) redirected to 0x47c97a0 (index)
starting execution
--31254-- REDIR: 0x86a6a0 (memchr) redirected to 0x47c9b90 (memchr)
--31254-- REDIR: 0x869470 (strcpy) redirected to 0x47cae00 (strcpy)
--31254-- REDIR: 0x869b50 (strncmp) redirected to 0x47c99d0 (strncmp)
--31254-- REDIR: 0x869c50 (strncpy) redirected to 0x47cace0 (strncpy)
--31254-- REDIR: 0x86b940 (rawmemchr) redirected to 0x47c9dc0 (rawmemchr)
--31254-- REDIR: 0x86a840 (bcmp) redirected to 0x47c9c30 (bcmp)
--31254-- REDIR: 0x8690e0 (strcat) redirected to 0x47ca130 (strcat)
--31254-- REDIR: 0x825b00 (setenv) redirected to 0x47c9ea0 (setenv)
--31254-- REDIR: 0x866d20 (realloc) redirected to 0x47c8ab0 (realloc)
--31254-- REDIR: 0x86ac00 (mempcpy) redirected to 0x47ca430 (mempcpy)
--31254-- REDIR: 0x865010 (calloc) redirected to 0x47c7b10 (calloc)
--31254-- Reading syms from
/nz/data/base/200103/library/200649/host/libnzaeparent.so (0x4e52000)
--31254-- Reading syms from /usr/lib/libstdc++.so.6.0.8 (0x9c6000)
--31254-- object doesn't have a symbol table
--31254-- Reading syms from /lib/libgcc_s-4.1.2-20080825.so.1 (0x988000)
--31254-- object doesn't have a symbol table
--31254-- Reading syms from
/nz/data/base/200103/library/200650/host/libnzaeadapters.so (0x7a25000)
--31254-- Reading syms from
/nz/data/base/200103/library/200652/host/libnzaechild.so (0x4eab000)
--31254-- Reading syms from /nz/data/base/200103/udf/217194.oh (0x4c26000)
--31254-- REDIR: 0x86ab30 (memmove) redirected to 0x47c9d40 (memmove)
DOUBLE: 3.000000
Elapsed time: 0m0.903s
External references
vtable for __cxxabiv1::__class_type_info
vtable for __cxxabiv1::__si_class_type_info
operator delete[](void*)
operator delete(void*)
operator new(unsigned int)
cxa_begin_catch
cxa_end_catch
cxa_pure_virtual
gxx_personality_v0
free
nzaeisoAdapUdfClose
nzaeisoAdapUdfCreate
nzaeisoAdapUdfGetReturn
nzaeisoAdapUdfGetSizerResult
nzaeisoAdapUdfSetController
nzaeisoAdapUdfSwitchToSizerMode
nzaeisoCtrlUdfClose
nzaeisoCtrlUdfCreate
nzaeisoCtrlUdfGetResult
nzaeisoCtrlUdfNewInput
nzaeisoCtrlUdfNoMoreInput
nzaeisoCtrlUdfSetAdapter
sprintf
strcmp
strdup
throwError
Our UDX object used 0 bytes (may be rounded up to nearest page 4096)
Our UDX return value takes up 8 bytes, with 669 bytes for miscellaneous
Our UDX arguments take up 30 bytes, with 34 bytes for miscellaneous
Our UDX state values take up 0 bytes, with 8 bytes for miscellaneous
State information may be doubled, since we need two states for merge
--31254-- Discarding syms at 0x4eb3fb0-0x4ed1b64 in \
/nz/data/base/200103/library/200652/host/libnzaechild.so due to munmap()
--31254-- Discarding syms at 0x4c27b90-0x4c28c54 in \
/nz/data/base/200103/udf/217194.oh due to munmap()
--31254-- Discarding syms at 0x7a41250-0x7a62d44 in \
/nz/data/base/200103/library/200650/host/libnzaeadapters.so due to \
munmap()
--31254-- Discarding syms at 0x4e613f0-0x4e975d4 in
/nz/data/base/200103/library/200649/host/libnzaeparent.so due to munmap()
--31254-- Discarding syms at 0xa05c50-0xa810c4 in /usr/lib/libstdc++.so.6.0.8 \
due to munmap()
--31254-- Discarding syms at 0x989660-0x990e94 in /lib/libgcc_s-4.1.2-
20080825.so.1 due to munmap()
==31254==
==31254== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 39 from 1)
--31254--
--31254-- supp: 39 dl_relocate_object
==31254== malloc/free: in use at exit: 136 bytes in 4 blocks.
==31254== malloc/free: 464 allocs, 460 frees, 5,522,815 bytes allocated.
==31254==
==31254== searching for pointers to 4 not-freed blocks.
==31254== checked 170,496 bytes.
==31254==
==31254== 12 bytes in 1 blocks are definitely lost in loss record 1 of 4
==31254== at 0x47C8A58: malloc (vg_replace_malloc.c:207)
==31254== by 0x8153666: operator new(unsigned int) (new_op.cc:57)
==31254== by 0x809D52B: __static_initialization_and_destruction_0(int, int) \
(udxharnessimpl.cpp:45)
==31254== by 0x809D583: global constructors keyed to stmt \
(udxharnessimpl.cpp:724)
==31254== by 0x8159864: (within /nz/kit/bin/adm/udxharness)
==31254== by 0x809C74C: (within /nz/kit/bin/adm/udxharness)
==31254== by 0x81597D1: __libc_csu_init (in /nz/kit/bin/adm/udxharness)
==31254== by 0x80FE30: (below main) (in /lib/libc-2.5.so)
==31254==
==31254== LEAK SUMMARY:
==31254== definitely lost: 12 bytes in 1 blocks.
==31254== possibly lost: 0 bytes in 0 blocks.
==31254== still reachable: 124 bytes in 3 blocks.
==31254== suppressed: 0 bytes in 0 blocks.
==31254== Reachable blocks (those to which a pointer was found) are not shown.
==31254== To see them, rerun with: --leak-check=full --show-reachable=yes
--31254-- memcheck: sanity checks: 15 cheap, 2 expensive
--31254-- memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use
--31254-- memcheck: auxmaps_L1: 0 searches, 0 cmps, ratio 0:10
--31254-- memcheck: auxmaps_L2: 0 searches, 0 nodes
--31254-- memcheck: SMs: n_issued = 40 (640k, 0M)
--31254-- memcheck: SMs: n_deissued = 6 (96k, 0M)
--31254-- memcheck: SMs: max_noaccess = 65535 (1048560k, 1023M)
--31254-- memcheck: SMs: max_undefined = 81 (1296k, 1M)
--31254-- memcheck: SMs: max_defined = 66 (1056k, 1M)
--31254-- memcheck: SMs: max_non_DSM = 38 (608k, 0M)
--31254-- memcheck: max sec V bit nodes: 1 (0k, 0M)
--31254-- memcheck: set_sec_vbits8 calls: 1 (new: 1, updates: 0)
--31254-- memcheck: max shadow mem size: 912k, 0M
--31254-- translate: fast SP updates identified: 10,841 ( 88.8%)
--31254-- translate: generic_known SP updates identified: 881 ( 7.2%)
--31254-- translate: generic_unknown SP updates identified: 481 ( 3.9%)
--31254-- tt/tc: 16,569 tt lookups requiring 17,820 probes
--31254-- tt/tc: 16,569 fast-cache updates, 9 flushes
--31254-- transtab: new 7,737 (178,651 -> 2,537,524; ratio 142:10) [0 scs]
--31254-- transtab: dumped 0 (0 -> ??)
--31254-- transtab: discarded 1,824 (37,849 -> ??)
--31254-- scheduler: 1,505,348 jumps (bb entries).
--31254-- scheduler: 15/10,159 major/minor sched events.
--31254-- sanity: 16 cheap, 2 expensive checks.
--31254-- exectx: 1,543 lists, 1,449 contexts (avg 0 per list)
--31254-- exectx: 2,327 searches, 1,766 full compares (758 per 1000)
--31254-- exectx: 3 cmp2, 178 cmp4, 0 cmpAll
--31254-- errormgr: 17 supplist searches, 515 comparisons during search
--31254-- errormgr: 39 errlist searches, 178 comparisons during search