|
From: Umesh K. <ume...@gm...> - 2011-12-16 12:16:01
|
Hi All ,
Please attachment(threads.c) for the thread sample ,where sample is
multithread and below is the gcc switches used to compile the sample .
# gcc -lpthread -o threads threads.c
Question the sample has the issues like
1)accessing like uninitialsed variable.
2)write overflow.
.
why valgrind tools like helgrind/drd or memcheck unable to detect those
errors and here the o.p from them for the attached sample .
==7969== Memcheck, a memory error detector
==7969== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==7969== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==7969== Command: ./threads
==7969==
*
**
****
***
==7969==
==7969== HEAP SUMMARY:
==7969== in use at exit: 1 bytes in 1 blocks
==7969== total heap usage: 5 allocs, 4 frees, 1,089 bytes allocated
==7969==
==7969== 1 bytes in 1 blocks are definitely lost in loss record 1 of 1
==7969== at 0x4A0610C: malloc (vg_replace_malloc.c:195)
==7969== by 0x4006D5: second_thread (in
/home/umesh/valgrind/c/datarace/threads)
==7969== by 0x33F90062E6: start_thread (in /lib64/libpthread-2.5.so)
==7969== by 0x33F84CE3BC: clone (in /lib64/libc-2.5.so)
==7969==
==7969== LEAK SUMMARY:
==7969== definitely lost: 1 bytes in 1 blocks
==7969== indirectly lost: 0 bytes in 0 blocks
==7969== possibly lost: 0 bytes in 0 blocks
==7969== still reachable: 0 bytes in 0 blocks
==7969== suppressed: 0 bytes in 0 blocks
==7969==
==7969== For counts of detected and suppressed errors, rerun with: -v
==7969== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4)
Helgrind output
[umesh@localhost datarace]$ vi threads.c
[umesh@localhost datarace]$ valgrind --tool=helgrind ./threads
==7979== Helgrind, a thread error detector
==7979== Copyright (C) 2007-2009, and GNU GPL'd, by OpenWorks LLP et al.
==7979== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==7979== Command: ./threads
==7979==
*
**
***
****
==7979==
==7979== For counts of detected and suppressed errors, rerun with: -v
==7979== Use --history-level=approx or =none to gain increased speed, at
==7979== the cost of reduced accuracy of conflicting-access information
==7979== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 79 from 70)
Did i missing something here ,Please any comments are welcomed
Thanks
~Umesh
|