You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
1
(33) |
2
(15) |
3
(20) |
4
(22) |
5
(13) |
|
6
(12) |
7
(32) |
8
(17) |
9
(31) |
10
(21) |
11
(7) |
12
(13) |
|
13
(13) |
14
(12) |
15
(10) |
16
(8) |
17
(7) |
18
(28) |
19
(5) |
|
20
(5) |
21
(7) |
22
(11) |
23
(7) |
24
(13) |
25
(7) |
26
(7) |
|
27
(7) |
28
(15) |
29
(30) |
30
(21) |
31
(6) |
|
|
|
From: Bill H. <bil...@ki...> - 2008-07-01 19:22:15
|
I would like to ping the you folks on this feature request that I submitted: http://bugs.kde.org/show_bug.cgi?id=148932 I use the feature every day, and it is quite useful. Any chance of it getting incorporated into valgrind? Thanks. -- Bill Hoffman Kitware, Inc. 28 Corporate Drive Clifton Park, NY 12065 bil...@ki... http://www.kitware.com 518-371-3971 (phone and fax) |
|
From: Josef W. <Jos...@gm...> - 2008-07-01 17:01:51
|
On Tuesday 01 July 2008, Bart Van Assche wrote: > On Tue, Jul 1, 2008 at 4:22 PM, Josef Weidendorfer > <Jos...@gm...> wrote: > > However, recently I asked Julian if he is fine with a short chapter about KCachegrind, > > and he agreed that this could be useful. > > The reason that I suggested to add some info about the way KCachegrind Ah, I thought the question was how to embed images into the manual, for your own tool ;-) > presents profiling data is that as far as I know this is a unique > feature. Yes, treemaps are not used often. But they are not really easy to understand without some explanation. A 1-dimensional split-up of cost probably would be enough in most cases and should be totally self-explaining. However, I agree that KCachegrind proved to be quite a good experimental prototype. > I do not know of any other profiler GUI that is as good as > KCachegrind. I consider Callgrind + KCachegrind as a strong > combination, but currently this is not emphasized in the callgrind > manual. This is true. Josef > > Bart. > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers > |
|
From: Tom H. <to...@co...> - 2008-07-01 15:02:45
|
In message <486A45F8.9080404@BitWagon.com>
John Reiser <jr...@bi...> wrote:
> Tom Hughes wrote:
>> In message <486A3F31.4070800@BitWagon.com>
>> John Reiser <jr...@bi...> wrote:
>>
>>
>>>I'd like a review of the reasons why memcheck gives "less good" diagnosis
>>>for access to a page that is mapped with PROT_NONE, versus access to a page
>>>that is not mapped at all.
>>
>>
>> Because memcheck's new_mem_mmap hook always marks the new block as
>> defined regardless of the permissions.
>
> Thank you, Tom. That's the mechanism for the observed behavior.
>
> [To the group] Is there any discussion about the policy?
> What are the tradeoffs for new_mem_mmap() doing something different
> for PROT_NONE ?
Well we would have to arrange for it to do something sensible if the
permissions were changed with mprotect, bearing in mind the current
comment in the code which says:
// Nb: we don't do anything with mprotect. This means that V bits are
// preserved if a program, for example, marks some memory as inaccessible
// and then later marks it as accessible again.
//
// If an access violation occurs (eg. writing to read-only memory) we let
// it fault and print an informative termination message. This doesn't
// happen if the program catches the signal, though, which is bad. If we
// had two A bits (for readability and writability) that were completely
// distinct from V bits, then we could handle all this properly.
As that comment explains, in general terms we don't attempt to track
and enforce access permissions and instead leave that to the OS, so
even if we fixed this you still wouldn't be warned a write to
read-only memory or a read from write-only memory.
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|
|
From: John R.
|
Tom Hughes wrote: > In message <486A3F31.4070800@BitWagon.com> > John Reiser <jr...@bi...> wrote: > > >>I'd like a review of the reasons why memcheck gives "less good" diagnosis >>for access to a page that is mapped with PROT_NONE, versus access to a page >>that is not mapped at all. > > > Because memcheck's new_mem_mmap hook always marks the new block as > defined regardless of the permissions. Thank you, Tom. That's the mechanism for the observed behavior. [To the group] Is there any discussion about the policy? What are the tradeoffs for new_mem_mmap() doing something different for PROT_NONE ? -- |
|
From: Tom H. <to...@co...> - 2008-07-01 14:48:46
|
In message <486A3F31.4070800@BitWagon.com>
John Reiser <jr...@bi...> wrote:
> I'd like a review of the reasons why memcheck gives "less good" diagnosis
> for access to a page that is mapped with PROT_NONE, versus access to a page
> that is not mapped at all.
Because memcheck's new_mem_mmap hook always marks the new block as
defined regardless of the permissions.
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|
|
From: Bart V. A. <bar...@gm...> - 2008-07-01 14:42:36
|
On Tue, Jul 1, 2008 at 4:22 PM, Josef Weidendorfer <Jos...@gm...> wrote: > However, recently I asked Julian if he is fine with a short chapter about KCachegrind, > and he agreed that this could be useful. The reason that I suggested to add some info about the way KCachegrind presents profiling data is that as far as I know this is a unique feature. I do not know of any other profiler GUI that is as good as KCachegrind. I consider Callgrind + KCachegrind as a strong combination, but currently this is not emphasized in the callgrind manual. Bart. |
|
From: John R.
|
Hi,
I'd like a review of the reasons why memcheck gives "less good" diagnosis
for access to a page that is mapped with PROT_NONE, versus access to a page
that is not mapped at all.
This code
-----
#include <sys/types.h>
#include <sys/mman.h>
main()
{
return *(char *)mmap(0, 4096, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
}
-----
gets only an after-the-fact message
-----
==6145== Process terminating with default action of signal 11 (SIGSEGV)
==6145== Bad permissions for mapped region at address 0x4027000
==6145== at 0x80483B9: main (prot_none.c:6)
-----
whereas the related code:
return *(char *)0;
gets a message both before and after the actual reference:
-----
==6152== Invalid read of size 1
==6152== at 0x8048357: main (prot_none.c:6)
==6152== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==6152==
==6152== Process terminating with default action of signal 11 (SIGSEGV)
==6152== Access not within mapped region at address 0x0
==6152== at 0x8048357: main (prot_none.c:6)
-----
Why does the PROT_NONE page omit a before-the-fact message such as
-----
==6145== Invalid read of size 1
==6145== at 0x8048357: main (prot_none.c:6)
==6145== Address 0x4027000 has PROT_NONE
-----
[All examples tested on x86 linux-2.6.24 using one-day-old code from SVN.]
--
|
|
From: Josef W. <Jos...@gm...> - 2008-07-01 14:22:04
|
On Tuesday 01 July 2008, Bart Van Assche wrote: > By the way, do you know whether it is technically possible to include > bitmap images in the Valgrind documentation ? Good question. Valgrinds manual does not use any image data up to now. But e.g. KDE is using docbook XML, too, and they have screenshots. I just searched in there SVN a little bit, see websvn.kde.org. Two examples: <screenshot> <screeninfo>Here is a screenshot of &kgraphviewer;</screeninfo> <mediaobject> <imageobject> <imagedata fileref="kgraphviewer-snap-main.png" format="PNG"/> </imageobject> <imageobject> <imagedata fileref="kgraphviewer-snap-main.eps" format="EPS"/> </imageobject> <textobject> <phrase>The main &kgraphviewer; window displaying one of the &graphviz; examples</phrase> </textobject> </mediaobject> </screenshot> and <para>To zoom, you can either use the <guibutton><inlinemediaobject> <imageobject> <imagedata fileref="kgraphviewer-but-zoomin.png" format="PNG" /> </imageobject> </inlinemediaobject> </guibutton> and <guibutton><inlinemediaobject> <imageobject> <imagedata fileref="kgraphviewer-but-zoomout.png" format="PNG" /> </imageobject> </inlinemediaobject> </guibutton> However, I have no idea whether this generally is allowed with docbook XML (4.2), or whether these are KDE-specific extensions. > As you know KCachegrind > has a view where the relative amount of time is represented as a > rectangular area. Maybe it would be a good idea to add a screenshot of > this view to the callgrind manual ? Yeah. KCachegrind is not packaged with Valgrind, so it is a little bit out of place. The manual explains the use of the command line tool/script "callgrind_annotate" instead. However, recently I asked Julian if he is fine with a short chapter about KCachegrind, and he agreed that this could be useful. Josef |
|
From: <sv...@va...> - 2008-07-01 14:13:18
|
Author: bart
Date: 2008-07-01 15:13:25 +0100 (Tue, 01 Jul 2008)
New Revision: 8332
Log:
Added an additional suppression pattern.
Modified:
trunk/glibc-2.X-drd.supp
Modified: trunk/glibc-2.X-drd.supp
===================================================================
--- trunk/glibc-2.X-drd.supp 2008-07-01 13:46:33 UTC (rev 8331)
+++ trunk/glibc-2.X-drd.supp 2008-07-01 14:13:25 UTC (rev 8332)
@@ -304,6 +304,16 @@
obj:/usr/lib*/libgomp.so*
}
{
+ libX11-XListFontsWithInfo
+ exp-drd:CondErr
+ fun:pthread_cond_init*
+ fun:_XReply
+ fun:XListFontsWithInfo
+ obj:/usr/lib*/libX11.so*
+ fun:XCreateOC
+ fun:XCreateFontSet
+}
+{
libxcb-xcb_wait_for_reply
exp-drd:CondErr
fun:pthread_cond_destroy*
|
|
From: <sv...@va...> - 2008-07-01 13:46:32
|
Author: bart Date: 2008-07-01 14:46:33 +0100 (Tue, 01 Jul 2008) New Revision: 8331 Log: Updated to do list. Modified: trunk/exp-drd/TODO.txt Modified: trunk/exp-drd/TODO.txt =================================================================== --- trunk/exp-drd/TODO.txt 2008-07-01 13:45:03 UTC (rev 8330) +++ trunk/exp-drd/TODO.txt 2008-07-01 13:46:33 UTC (rev 8331) @@ -1,18 +1,12 @@ -Last updated May 14, 2008. +Last updated July 1, 2008. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Data-race detection algorithm ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Find out why the following invocations run slowly (high number of mutex - operations ?): - (cd exp-drd/splash2/codes/apps/raytrace/inputs && time ../../../../../../vg-in-place --tool=exp-drd --check-stack-var=yes ../RAYTRACE balls4.env) - (cd exp-drd/splash2/codes/apps/raytrace && time ../../../../../vg-in-place --tool=exp-drd --check-stack-var=yes ./RAYTRACE inputs/teapot.env) -- Test whether file with DRD client requests is installed properly. - Let DRD print a warning message when, after 30s runtime, the ratio of the number of mutex lock / unlock calls to the number of executed basic blocks exceeds a certain threshold. Test with Firefox and nautilus. -- Continue discussion about unification of DRD and Helgrind client requests. - Propose to rename exp-drd back to drd. - Memory pool support. - Add locking order checking. Start from the following information: @@ -28,7 +22,6 @@ Testing ~~~~~~~ -- Find out the memory overhead for exp-drd on the SPLASH-2 benchmarks (ITC: 20x) - Measure the performance and the memory overhead of exp-drd on the PARSEC benchmark (http://parsec.cs.princeton.edu/license.htm). - Test with Synfig Studio (see also http://bugs.kde.org/show_bug.cgi?id=158555) @@ -37,24 +30,6 @@ Documentation ~~~~~~~~~~~~~ -- Document the command-line options of the exp-drd tool. -- Explain that happens-before race detectors are also suited for certain - classes of programs that do not follow a locking discipline - (e.g. exp-drd/test/matinv.c). -- Add a note about how much stack is needed for exp-drd itself. - Explain how to handle transactions (with regard to locking order). - Continue the discussion on the Valgrind mailing list about docbook and 'make dist'. See also http://bugs.kde.org/show_bug.cgi?id=162121. - - -Limitations -~~~~~~~~~~~ -- openSUSE 10.3, ppc: unless the glibc debuginfo packages is installed, - false positives are reported on ld.so. - See also https://bugzilla.novell.com/show_bug.cgi?id=396197. -- ppc: reports false positives on atomic operations (VEX limitation). See also - https://bugs.kde.org/show_bug.cgi?id=162354. -- Does not work with a glibc library compiled with linuxthreads -- NPTL is - required for proper operation. -- Does not work when compiled with gcc 2.95 -- probably a bug in the - optimizer of gcc 2.95. |
|
From: <sv...@va...> - 2008-07-01 13:44:57
|
Author: bart Date: 2008-07-01 14:45:03 +0100 (Tue, 01 Jul 2008) New Revision: 8330 Log: Added missing DRD command-line options for the OpenMP test programs. Modified: trunk/exp-drd/tests/omp_matinv.vgtest trunk/exp-drd/tests/omp_matinv_racy.vgtest trunk/exp-drd/tests/omp_prime_racy.vgtest Modified: trunk/exp-drd/tests/omp_matinv.vgtest =================================================================== --- trunk/exp-drd/tests/omp_matinv.vgtest 2008-07-01 13:43:44 UTC (rev 8329) +++ trunk/exp-drd/tests/omp_matinv.vgtest 2008-07-01 13:45:03 UTC (rev 8330) @@ -1,3 +1,4 @@ prereq: ./run_openmp_test ./omp_matinv prog: omp_matinv +vgopts: --check-stack-var=yes --var-info=yes args: 30 -t 15 -q Modified: trunk/exp-drd/tests/omp_matinv_racy.vgtest =================================================================== --- trunk/exp-drd/tests/omp_matinv_racy.vgtest 2008-07-01 13:43:44 UTC (rev 8329) +++ trunk/exp-drd/tests/omp_matinv_racy.vgtest 2008-07-01 13:45:03 UTC (rev 8330) @@ -1,4 +1,5 @@ prereq: ./run_openmp_test ./omp_matinv prog: omp_matinv +vgopts: --check-stack-var=yes --var-info=yes args: 3 -t 2 -q -r stderr_filter: filter_error_summary Modified: trunk/exp-drd/tests/omp_prime_racy.vgtest =================================================================== --- trunk/exp-drd/tests/omp_prime_racy.vgtest 2008-07-01 13:43:44 UTC (rev 8329) +++ trunk/exp-drd/tests/omp_prime_racy.vgtest 2008-07-01 13:45:03 UTC (rev 8330) @@ -1,4 +1,5 @@ prereq: ./run_openmp_test ./omp_prime prog: omp_prime +vgopts: --check-stack-var=yes --var-info=yes args: 4 -q stderr_filter: filter_error_summary |
|
From: <sv...@va...> - 2008-07-01 13:43:38
|
Author: bart
Date: 2008-07-01 14:43:44 +0100 (Tue, 01 Jul 2008)
New Revision: 8329
Log:
Continued working on the DRD documentation.
Modified:
trunk/exp-drd/docs/drd-manual.xml
Modified: trunk/exp-drd/docs/drd-manual.xml
===================================================================
--- trunk/exp-drd/docs/drd-manual.xml 2008-07-01 13:16:23 UTC (rev 8328)
+++ trunk/exp-drd/docs/drd-manual.xml 2008-07-01 13:43:44 UTC (rev 8329)
@@ -805,6 +805,103 @@
</itemizedlist>
</para>
+<para>
+There is one message that needs further explanation, namely sending a
+signal to a condition variable while no lock is held on the mutex
+associated with the signal. Consider e.g. the example <xref
+linkend="Racy use of pthread_cond_wait()"></xref>. In this example the
+code in thread 1 passes if <literal>flag != 0</literal>, or waits
+until it has been signaled by thread 2. If however the code of thread
+1 is scheduled after the <literal>pthread_mutex_unlock()</literal>
+call in thread 2 and before thread 2 calls
+<literal>pthread_cond_signal()</literal>, thread 1 will block
+indefinitely. The code in the example <xref linkend="Correct use of
+pthread_cond_wait()"></xref> never blocks indefinitely.
+</para>
+
+<para>
+Because most calls of <function>pthread_cond_signal()</function> or
+<function>pthread_cond_broadcast()</function> while no lock is held on
+the mutex associated with the condition variable are racy, by default
+DRD reports such calls.
+</para>
+
+<table
+ frame="none"
+ id="Racy use of pthread_cond_wait()"
+ xreflabel="Racy use of pthread_cond_wait()"
+>
+<title>Racy use of pthread_cond_wait()</title>
+<tgroup cols='2' align='left' colsep='1' rowsep='1'>
+ <colspec colname='thread1'/>
+ <colspec colname='thread2'/>
+ <thead>
+ <row>
+ <entry align="center">Thread 1</entry>
+ <entry align="center">Thread 2</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+<programlisting><![CDATA[
+pthread_mutex_lock(&mutex);
+if (! flag)
+ pthread_cond_wait(&cond, &mutex);
+pthread_mutex_unlock(&mutex);
+]]></programlisting>
+ </entry>
+ <entry>
+<programlisting><![CDATA[
+pthread_mutex_lock(&mutex);
+flag = 1;
+pthread_mutex_unlock(&mutex);
+pthread_cond_signal(&cond);
+]]></programlisting>
+ </entry>
+ </row>
+ </tbody>
+</tgroup>
+</table>
+
+<table
+ frame="none"
+ id="Correct use of pthread_cond_wait()"
+ xreflabel="Correct use of pthread_cond_wait()"
+>
+<title>Correct use of pthread_cond_wait()</title>
+<tgroup cols='2' align='left' colsep='1' rowsep='1'>
+ <colspec colname='thread1'/>
+ <colspec colname='thread2'/>
+ <thead>
+ <row>
+ <entry align="center">Thread 1</entry>
+ <entry align="center">Thread 2</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+<programlisting><![CDATA[
+pthread_mutex_lock(&mutex);
+if (! flag)
+ pthread_cond_wait(&cond, &mutex);
+pthread_mutex_unlock(&mutex);
+]]></programlisting>
+ </entry>
+ <entry>
+<programlisting><![CDATA[
+pthread_mutex_lock(&mutex);
+flag = 1;
+pthread_cond_signal(&cond);
+pthread_mutex_unlock(&mutex);
+]]></programlisting>
+ </entry>
+ </row>
+ </tbody>
+</tgroup>
+</table>
+
</sect2>
@@ -812,10 +909,83 @@
<title>Client Requests</title>
<para>
-Just as for other Valgrind tools it is possible to pass information
-from a client program to the DRD tool.
+Just as for other Valgrind tools it is possible to let a client
+program interact with the DRD tool.
</para>
+<para>
+The interface between client programs and the DRD tool is defined in
+the header file <literal><valgrind/drd.h></literal>. The
+available client requests are:
+<itemizedlist>
+ <listitem>
+ <para>
+ <varname>VG_USERREQ__DRD_GET_VALGRIND_THREAD_ID</varname>.
+ Query the thread ID that was assigned by the Valgrind core to
+ the thread executing this client request. Valgrind's thread ID's
+ start at one and are recycled in case a thread stops.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <varname>VG_USERREQ__DRD_GET_DRD_THREAD_ID</varname>.
+ Query the thread ID that was assigned by DRD to
+ the thread executing this client request. DRD's thread ID's
+ start at one and are never recycled.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <varname>VG_USERREQ__DRD_START_SUPPRESSION</varname>. Some
+ applications contain intentional races. There exist
+ e.g. applications where the same value is assigned to a shared
+ variable from two different threads. It may be more convenient
+ to suppress such races than to solve these. This client request
+ allows to suppress such races. See also the macro
+ <literal>DRD_IGNORE_VAR(x)</literal> defined in
+ <literal><valgrind/drd.h></literal>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <varname>VG_USERREQ__DRD_FINISH_SUPPRESSION</varname>. Tell DRD
+ to no longer ignore data races in the address range that was
+ suppressed via
+ <varname>VG_USERREQ__DRD_START_SUPPRESSION</varname>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <varname>VG_USERREQ__DRD_START_TRACE_ADDR</varname>. Trace all
+ load and store activity on the specified address range. When DRD
+ reports a data race on a specified variable, and it's not
+ immediately clear which source code statements triggered the
+ conflicting accesses, it can be helpful to trace all activity on
+ the offending memory location. See also the macro
+ <literal>DRD_TRACE_VAR(x)</literal> defined in
+ <literal><valgrind/drd.h></literal>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <varname>VG_USERREQ__DRD_STOP_TRACE_ADDR</varname>. Do no longer
+ trace load and store activity for the specified address range.
+ range.
+ </para>
+ </listitem>
+</itemizedlist>
+</para>
+
+<para>
+Note: if you compiled Valgrind yourself, the header file
+<literal><valgrind/drd.h></literal> will have been installed in
+the directory <literal>/usr/include</literal> by the command
+<literal>make install</literal>. If you obtained Valgrind by
+installing it as a package however, you will probably have to install
+another package with a name like <literal>valgrind-devel</literal>
+before Valgrind's header files are present.
+</para>
+
</sect2>
@@ -823,6 +993,87 @@
<title>Debugging OpenMP Programs With DRD</title>
<para>
+OpenMP stands for <emphasis>Open Multi-Processing</emphasis>. The
+OpenMP standard consists of a set of compiler directives for C, C++
+and Fortran programs that allows a compiler to transform a sequential
+program into a parallel program. OpenMP is well suited for HPC
+applications and allows to work at a higher level compared to direct
+use of the POSIX threads API. While OpenMP ensures that the POSIX API
+is used correctly, OpenMP programs can still contain data races. So it
+makes sense to verify OpenMP programs with a thread checking tool.
+</para>
+
+<para>
+DRD supports OpenMP shared-memory programs generated by gcc. The gcc
+compiler supports OpenMP since version 4.2.0. Gcc's runtime support
+for OpenMP programs is provided by a library called
+<literal>libgomp</literal>. The synchronization primites implemented
+in this library use Linux' futex system call directly, unless the
+library has been configured with the
+<literal>--disable-linux-futex</literal> flag. DRD only supports
+libgomp libraries that have been configured with this flag and in
+which symbol information is present. For most Linux distributions this
+means that you will have to recompile gcc. See also the script
+<literal>exp-drd/scripts/download-and-build-gcc</literal> in the
+Valgrind source tree for an example of how to compile gcc. You will
+also have to make sure that the newly compiled
+<literal>libgomp.so</literal> library is loaded when OpenMP programs
+are started. This is possible by adding a line similar to the
+following to your shell startup script:
+</para>
+<programlisting><![CDATA[
+export LD_LIBRARY_PATH=~/gcc-4.3.1/lib64:~/gcc-4.3.1/lib:
+]]></programlisting>
+
+<para>
+As an example, the test OpenMP test program
+<literal>exp-drd/scripts/omp_matinv</literal> triggers a data race
+when the option -r has been specified on the command line. The data
+race is triggered by the following code:
+</para>
+<programlisting><![CDATA[
+#pragma omp parallel for private(j)
+for (j = 0; j < rows; j++)
+{
+ if (i != j)
+ {
+ const elem_t factor = a[j * cols + i];
+ for (k = 0; k < cols; k++)
+ {
+ a[j * cols + k] -= a[i * cols + k] * factor;
+ }
+ }
+}
+]]></programlisting>
+
+<para>
+The above code is racy because the variable <literal>k</literal> has
+not been declared private. DRD will print the following error message
+for the above code:
+</para>
+<programlisting><![CDATA[
+$ valgrind --check-stack-var=yes --var-info=yes --tool=exp-drd exp-drd/tests/omp_matinv 3 -t 2 -r
+...
+Conflicting store by thread 1/1 at 0x7fefffbc4 size 4
+ at 0x4014A0: gj.omp_fn.0 (omp_matinv.c:203)
+ by 0x401211: gj (omp_matinv.c:159)
+ by 0x40166A: invert_matrix (omp_matinv.c:238)
+ by 0x4019B4: main (omp_matinv.c:316)
+Allocation context: unknown.
+...
+]]></programlisting>
+<para>
+In the above output the function name <function>gj.omp_fn.0</function>
+has been generated by gcc from the function name
+<function>gj</function>. Unfortunately the variable name
+(<literal>k</literal>) is not shown as the allocation context -- it is
+not clear to me whether this is caused by Valgrind or whether this is
+caused by gcc. The most usable information in the above output is the
+source file name and the line number where the data race has been detected
+(<literal>omp_matinv.c:203</literal>).
+</para>
+
+<para>
For more information about OpenMP, see also
<ulink url="http://openmp.org/">openmp.org</ulink>.
</para>
@@ -855,14 +1106,6 @@
</listitem>
<listitem>
<para>
- When running DRD on a PowerPC CPU, DRD will report false
- positives on atomic operations. See also Valgrind bug <ulink
- url="http://bugs.kde.org/show_bug.cgi?id=162354">
- 162354</ulink>.
- </para>
- </listitem>
- <listitem>
- <para>
DRD, just like memcheck, will refuse to start on Linux
distributions where all symbol information has been removed from
ld.so. This is a.o. the case for the PPC editions of openSUSE
|
|
From: <sv...@va...> - 2008-07-01 13:16:14
|
Author: bart
Date: 2008-07-01 14:16:23 +0100 (Tue, 01 Jul 2008)
New Revision: 8328
Log:
Exit if the required argument is missing.
Modified:
trunk/exp-drd/tests/omp_matinv.c
trunk/exp-drd/tests/omp_prime.c
Modified: trunk/exp-drd/tests/omp_matinv.c
===================================================================
--- trunk/exp-drd/tests/omp_matinv.c 2008-07-01 13:16:07 UTC (rev 8327)
+++ trunk/exp-drd/tests/omp_matinv.c 2008-07-01 13:16:23 UTC (rev 8328)
@@ -299,6 +299,7 @@
if (optind + 1 != argc)
{
fprintf(stderr, "Error: wrong number of arguments.\n");
+ return 1;
}
matrix_size = atoi(argv[optind]);
Modified: trunk/exp-drd/tests/omp_prime.c
===================================================================
--- trunk/exp-drd/tests/omp_prime.c 2008-07-01 13:16:07 UTC (rev 8327)
+++ trunk/exp-drd/tests/omp_prime.c 2008-07-01 13:16:23 UTC (rev 8328)
@@ -57,6 +57,7 @@
if (optind + 1 != argc)
{
fprintf(stderr, "Error: wrong number of arguments.\n");
+ return 1;
}
n = atoi(argv[optind]);
|
|
From: <sv...@va...> - 2008-07-01 13:16:00
|
Author: bart Date: 2008-07-01 14:16:07 +0100 (Tue, 01 Jul 2008) New Revision: 8327 Log: Do not accept statically linked executables. Modified: trunk/exp-drd/tests/run_openmp_test Modified: trunk/exp-drd/tests/run_openmp_test =================================================================== --- trunk/exp-drd/tests/run_openmp_test 2008-07-01 13:15:31 UTC (rev 8326) +++ trunk/exp-drd/tests/run_openmp_test 2008-07-01 13:16:07 UTC (rev 8327) @@ -8,6 +8,11 @@ ./supported_libpthread || exit $? +# Do not accept any statically linked executable. +if /usr/bin/file "$1" | grep -q 'statically linked'; then + exit 1 +fi + if [ "$(uname)" = Linux ]; then # Let the dynamic linker/loader print the path of libgomp. See also man ld.so |
|
From: <sv...@va...> - 2008-07-01 13:15:25
|
Author: bart
Date: 2008-07-01 14:15:31 +0100 (Tue, 01 Jul 2008)
New Revision: 8326
Log:
Converted VG_(message)() / tl_assert() calls into VG_(maybe_record_error)() calls.
Modified:
trunk/exp-drd/drd_barrier.c
Modified: trunk/exp-drd/drd_barrier.c
===================================================================
--- trunk/exp-drd/drd_barrier.c 2008-07-01 09:35:21 UTC (rev 8325)
+++ trunk/exp-drd/drd_barrier.c 2008-07-01 13:15:31 UTC (rev 8326)
@@ -226,7 +226,13 @@
{
if (p->pre_waiters_left != p->count || p->post_waiters_left != p->count)
{
- VG_(message)(Vg_UserMsg, "Error: reinitialization with active waiters");
+ BarrierErrInfo bei = { p->a1 };
+ VG_(maybe_record_error)(VG_(get_running_tid)(),
+ BarrierErr,
+ VG_(get_IP)(VG_(get_running_tid)()),
+ "Reinitialization of barrier with active"
+ " waiters",
+ &bei);
}
p->count = count;
}
@@ -260,6 +266,16 @@
return;
}
+ if (p->pre_waiters_left != p->count || p->post_waiters_left != p->count)
+ {
+ BarrierErrInfo bei = { p->a1 };
+ VG_(maybe_record_error)(VG_(get_running_tid)(),
+ BarrierErr,
+ VG_(get_IP)(VG_(get_running_tid)()),
+ "Destruction of a barrier with active waiters",
+ &bei);
+ }
+
clientobj_remove(p->a1, ClientBarrier);
}
@@ -344,7 +360,23 @@
struct barrier_thread_info* r;
q = VG_(OSetGen_Lookup)(p->oset, &word_tid);
- tl_assert(q);
+ if (q == 0)
+ {
+ BarrierErrInfo bei = { p->a1 };
+ VG_(maybe_record_error)(VG_(get_running_tid)(),
+ BarrierErr,
+ VG_(get_IP)(VG_(get_running_tid)()),
+ "Error in barrier implementation"
+ " -- barrier_wait() started before"
+ " barrier_destroy() and finished after"
+ " barrier_destroy()",
+ &bei);
+
+ q = VG_(OSetGen_AllocNode)(p->oset, sizeof(*q));
+ barrier_thread_initialize(q, tid, p->pre_iteration);
+ VG_(OSetGen_Insert)(p->oset, q);
+ tl_assert(VG_(OSetGen_Lookup)(p->oset, &word_tid) == q);
+ }
VG_(OSetGen_ResetIter)(p->oset);
for ( ; (r = VG_(OSetGen_Next)(p->oset)) != 0; )
{
|
|
From: Bart V. A. <bar...@gm...> - 2008-07-01 11:35:21
|
On Tue, Jul 1, 2008 at 12:20 PM, vibi <vib...@cm...> wrote: > hello, > Is there any one working on porting valgrind to arm9 platform. > I am gointo start working on that. > Can some one give me some directions on the same. Please start with searching trough the archives of this mailing list -- this has already been discussed in the past. Bart. |
|
From: vibi <vib...@cm...> - 2008-07-01 11:05:38
|
hello, Is there any one working on porting valgrind to arm9 platform. I am gointo start working on that. Can some one give me some directions on the same. Thanks in advance Thanks & regards vibi sreenivasan |
|
From: Bart V. A. <bar...@gm...> - 2008-07-01 09:53:22
|
On Tue, Jul 1, 2008 at 11:39 AM, Josef Weidendorfer <Jos...@gm...> wrote: > On Tuesday 01 July 2008, Bart Van Assche wrote: >> Can you please have a look at the patch below ? I came across this >> while looking for an example of a tool interface header file. > > Ah, I obviously did not fix the second occurence of this comment > in the file. By the way, do you know whether it is technically possible to include bitmap images in the Valgrind documentation ? As you know KCachegrind has a view where the relative amount of time is represented as a rectangular area. Maybe it would be a good idea to add a screenshot of this view to the callgrind manual ? Bart. |
|
From: Josef W. <Jos...@gm...> - 2008-07-01 09:39:51
|
On Tuesday 01 July 2008, Bart Van Assche wrote: > Hello Josef, > > Can you please have a look at the patch below ? I came across this > while looking for an example of a tool interface header file. Ah, I obviously did not fix the second occurence of this comment in the file. Just committed, thanks! Josef > > Thanks, > > Bart. > > Index: callgrind/callgrind.h > =================================================================== > --- callgrind/callgrind.h (revision 8321) > +++ callgrind/callgrind.h (working copy) > @@ -49,7 +49,7 @@ > ---------------------------------------------------------------- > > Notice that the above BSD-style license applies to this one file > - (vgprof.h) only. The entire rest of Valgrind is licensed under > + (callgrind.h) only. The entire rest of Valgrind is licensed under > the terms of the GNU General Public License, version 2. See the > COPYING file in the source distribution for details. > |
|
From: <sv...@va...> - 2008-07-01 09:35:15
|
Author: weidendo
Date: 2008-07-01 10:35:21 +0100 (Tue, 01 Jul 2008)
New Revision: 8325
Log:
Fix typo found by Bart
Modified:
trunk/callgrind/callgrind.h
Modified: trunk/callgrind/callgrind.h
===================================================================
--- trunk/callgrind/callgrind.h 2008-07-01 08:48:56 UTC (rev 8324)
+++ trunk/callgrind/callgrind.h 2008-07-01 09:35:21 UTC (rev 8325)
@@ -49,7 +49,7 @@
----------------------------------------------------------------
Notice that the above BSD-style license applies to this one file
- (vgprof.h) only. The entire rest of Valgrind is licensed under
+ (callgrind.h) only. The entire rest of Valgrind is licensed under
the terms of the GNU General Public License, version 2. See the
COPYING file in the source distribution for details.
|
|
From: <sv...@va...> - 2008-07-01 08:48:49
|
Author: bart
Date: 2008-07-01 09:48:56 +0100 (Tue, 01 Jul 2008)
New Revision: 8324
Log:
- Renamed the client request VG_USERREQ__GET_THREAD_SELF into
VG_USERREQ__DRD_GET_VALGRIND_THREAD_ID.
- Added a new client request, namely VG_USERREQ__DRD_GET_DRD_THREAD_ID.
- Merged the header file priv_drd_clientreq.h into drd_clientreq.h.
- Removed #include "../drd.h" from the regression tests that do not
perform client requests.
Removed:
trunk/exp-drd/priv_drd_clientreq.h
Modified:
trunk/exp-drd/Makefile.am
trunk/exp-drd/drd.h
trunk/exp-drd/drd_barrier.c
trunk/exp-drd/drd_clientreq.c
trunk/exp-drd/drd_clientreq.h
trunk/exp-drd/drd_main.c
trunk/exp-drd/drd_mutex.c
trunk/exp-drd/drd_rwlock.c
trunk/exp-drd/drd_semaphore.c
trunk/exp-drd/tests/fp_race.c
trunk/exp-drd/tests/omp_prime.c
trunk/exp-drd/tests/pth_cond_race.c
trunk/exp-drd/tests/pth_detached.c
trunk/exp-drd/tests/pth_detached_sem.c
trunk/exp-drd/tests/rwlock_race.c
trunk/exp-drd/tests/sem_as_mutex.c
trunk/exp-drd/tests/sigalrm.c
Modified: trunk/exp-drd/Makefile.am
===================================================================
--- trunk/exp-drd/Makefile.am 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/Makefile.am 2008-07-01 08:48:56 UTC (rev 8324)
@@ -120,7 +120,6 @@
drd_thread.h \
drd_track.h \
drd_vc.h \
- priv_drd_clientreq.h \
pub_drd_bitmap.h
exp_drd_x86_linux_SOURCES = $(DRD_SOURCES_COMMON)
Modified: trunk/exp-drd/drd.h
===================================================================
--- trunk/exp-drd/drd.h 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/drd.h 2008-07-01 08:48:56 UTC (rev 8324)
@@ -82,8 +82,11 @@
enum
{
/* Ask the core the thread ID assigned by Valgrind. */
- VG_USERREQ__GET_THREAD_SELF = VG_USERREQ_TOOL_BASE('D','R'),
+ VG_USERREQ__DRD_GET_VALGRIND_THREAD_ID = VG_USERREQ_TOOL_BASE('D','R'),
/* args: none. */
+ /* Ask the core the thread ID assigned by DRD. */
+ VG_USERREQ__DRD_GET_DRD_THREAD_ID,
+ /* args: none. */
/* To tell the drd tool to suppress data race detection on the specified */
/* address range. */
@@ -104,10 +107,20 @@
static __inline__
+int vg_get_valgrind_threadid(void)
+{
+ int res;
+ VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_GET_VALGRIND_THREAD_ID,
+ 0, 0, 0, 0, 0);
+ return res;
+}
+
+static __inline__
int vg_get_drd_threadid(void)
{
int res;
- VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__GET_THREAD_SELF, 0,0,0,0,0);
+ VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_GET_DRD_THREAD_ID,
+ 0, 0, 0, 0, 0);
return res;
}
Modified: trunk/exp-drd/drd_barrier.c
===================================================================
--- trunk/exp-drd/drd_barrier.c 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/drd_barrier.c 2008-07-01 08:48:56 UTC (rev 8324)
@@ -27,7 +27,6 @@
#include "drd_clientobj.h"
#include "drd_error.h"
#include "drd_suppression.h"
-#include "priv_drd_clientreq.h"
#include "pub_tool_errormgr.h" // VG_(maybe_record_error)()
#include "pub_tool_libcassert.h" // tl_assert()
#include "pub_tool_libcprint.h" // VG_(printf)()
Modified: trunk/exp-drd/drd_clientreq.c
===================================================================
--- trunk/exp-drd/drd_clientreq.c 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/drd_clientreq.c 2008-07-01 08:48:56 UTC (rev 8324)
@@ -31,7 +31,6 @@
#include "drd_thread.h"
#include "drd_track.h"
#include "drd_rwlock.h"
-#include "priv_drd_clientreq.h"
#include "pub_tool_basics.h" // Bool
#include "pub_tool_debuginfo.h" // VG_(describe_IP)()
#include "pub_tool_libcassert.h"
@@ -133,10 +132,14 @@
switch (arg[0])
{
- case VG_USERREQ__GET_THREAD_SELF:
+ case VG_USERREQ__DRD_GET_VALGRIND_THREAD_ID:
result = vg_tid;
break;
+ case VG_USERREQ__DRD_GET_DRD_THREAD_ID:
+ result = drd_tid;
+ break;
+
case VG_USERREQ__DRD_START_SUPPRESSION:
drd_start_suppression(arg[1], arg[1] + arg[2], "client");
break;
Modified: trunk/exp-drd/drd_clientreq.h
===================================================================
--- trunk/exp-drd/drd_clientreq.h 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/drd_clientreq.h 2008-07-01 08:48:56 UTC (rev 8324)
@@ -1,3 +1,28 @@
+/*
+ This file is part of drd, a data race detector.
+
+ Copyright (C) 2006-2008 Bart Van Assche
+ bar...@gm...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+
#ifndef __DRD_CLIENTREQ_H
#define __DRD_CLIENTREQ_H
@@ -163,5 +188,7 @@
gomp_barrier = 2
} BarrierT;
+void drd_clientreq_init(void);
+
#endif // __DRD_CLIENTREQ_H
Modified: trunk/exp-drd/drd_main.c
===================================================================
--- trunk/exp-drd/drd_main.c 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/drd_main.c 2008-07-01 08:48:56 UTC (rev 8324)
@@ -39,7 +39,6 @@
#include "drd_track.h"
#include "drd_vc.h"
#include "libvex_guest_offsets.h"
-#include "priv_drd_clientreq.h"
#include "pub_drd_bitmap.h"
#include "pub_tool_vki.h" // Must be included before pub_tool_libcproc
#include "pub_tool_basics.h"
Modified: trunk/exp-drd/drd_mutex.c
===================================================================
--- trunk/exp-drd/drd_mutex.c 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/drd_mutex.c 2008-07-01 08:48:56 UTC (rev 8324)
@@ -26,7 +26,6 @@
#include "drd_clientobj.h"
#include "drd_error.h"
#include "drd_mutex.h"
-#include "priv_drd_clientreq.h"
#include "pub_tool_vki.h"
#include "pub_tool_errormgr.h" // VG_(maybe_record_error)()
#include "pub_tool_libcassert.h" // tl_assert()
Modified: trunk/exp-drd/drd_rwlock.c
===================================================================
--- trunk/exp-drd/drd_rwlock.c 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/drd_rwlock.c 2008-07-01 08:48:56 UTC (rev 8324)
@@ -26,7 +26,6 @@
#include "drd_clientobj.h"
#include "drd_error.h"
#include "drd_rwlock.h"
-#include "priv_drd_clientreq.h"
#include "pub_tool_vki.h"
#include "pub_tool_errormgr.h" // VG_(maybe_record_error)()
#include "pub_tool_libcassert.h" // tl_assert()
Modified: trunk/exp-drd/drd_semaphore.c
===================================================================
--- trunk/exp-drd/drd_semaphore.c 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/drd_semaphore.c 2008-07-01 08:48:56 UTC (rev 8324)
@@ -27,7 +27,6 @@
#include "drd_error.h"
#include "drd_semaphore.h"
#include "drd_suppression.h"
-#include "priv_drd_clientreq.h"
#include "pub_tool_errormgr.h" // VG_(maybe_record_error)()
#include "pub_tool_libcassert.h" // tl_assert()
#include "pub_tool_libcprint.h" // VG_(printf)()
Deleted: trunk/exp-drd/priv_drd_clientreq.h
===================================================================
--- trunk/exp-drd/priv_drd_clientreq.h 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/priv_drd_clientreq.h 2008-07-01 08:48:56 UTC (rev 8324)
@@ -1,30 +0,0 @@
-/*
- This file is part of drd, a data race detector.
-
- Copyright (C) 2006-2008 Bart Van Assche
- bar...@gm...
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#ifndef __PRIV_DRD_CLIENTREQ_H
-#define __PRIV_DRD_CLIENTREQ_H
-
-void drd_clientreq_init(void);
-
-#endif /* __PRIV_DRD_CLIENTREQ_H */
Modified: trunk/exp-drd/tests/fp_race.c
===================================================================
--- trunk/exp-drd/tests/fp_race.c 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/tests/fp_race.c 2008-07-01 08:48:56 UTC (rev 8324)
@@ -28,9 +28,9 @@
#include <stdio.h> // printf()
#include <pthread.h>
#include <unistd.h> // usleep()
-#include "../drd.h"
+
// Local functions declarations.
static void* thread_func(void*);
Modified: trunk/exp-drd/tests/omp_prime.c
===================================================================
--- trunk/exp-drd/tests/omp_prime.c 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/tests/omp_prime.c 2008-07-01 08:48:56 UTC (rev 8324)
@@ -10,7 +10,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h> // getopt()
-#include "../drd.h"
static int is_prime(int* const pflag, int v)
Modified: trunk/exp-drd/tests/pth_cond_race.c
===================================================================
--- trunk/exp-drd/tests/pth_cond_race.c 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/tests/pth_cond_race.c 2008-07-01 08:48:56 UTC (rev 8324)
@@ -6,7 +6,6 @@
#include <stdio.h> // printf()
#include <pthread.h>
#include <unistd.h> // usleep()
-#include "../drd.h"
// Local functions declarations.
Modified: trunk/exp-drd/tests/pth_detached.c
===================================================================
--- trunk/exp-drd/tests/pth_detached.c 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/tests/pth_detached.c 2008-07-01 08:48:56 UTC (rev 8324)
@@ -8,7 +8,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include "../drd.h"
static int s_finished_count;
Modified: trunk/exp-drd/tests/pth_detached_sem.c
===================================================================
--- trunk/exp-drd/tests/pth_detached_sem.c 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/tests/pth_detached_sem.c 2008-07-01 08:48:56 UTC (rev 8324)
@@ -13,7 +13,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include "../drd.h"
static sem_t s_sem;
Modified: trunk/exp-drd/tests/rwlock_race.c
===================================================================
--- trunk/exp-drd/tests/rwlock_race.c 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/tests/rwlock_race.c 2008-07-01 08:48:56 UTC (rev 8324)
@@ -11,9 +11,9 @@
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
-#include "../drd.h"
+
static pthread_rwlock_t s_rwlock;
static int s_racy;
Modified: trunk/exp-drd/tests/sem_as_mutex.c
===================================================================
--- trunk/exp-drd/tests/sem_as_mutex.c 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/tests/sem_as_mutex.c 2008-07-01 08:48:56 UTC (rev 8324)
@@ -29,9 +29,9 @@
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h> // usleep()
-#include "../drd.h"
+
// Local functions declarations.
static void* thread_func(void*);
Modified: trunk/exp-drd/tests/sigalrm.c
===================================================================
--- trunk/exp-drd/tests/sigalrm.c 2008-07-01 07:46:21 UTC (rev 8323)
+++ trunk/exp-drd/tests/sigalrm.c 2008-07-01 08:48:56 UTC (rev 8324)
@@ -31,7 +31,7 @@
char msg[256];
snprintf(msg, sizeof(msg),
"%spid %d / kernel thread ID %d / Valgrind thread ID %d\n",
- label, getpid(), getktid(), vg_get_drd_threadid());
+ label, getpid(), getktid(), vg_get_valgrind_threadid());
write(STDOUT_FILENO, msg, strlen(msg));
}
}
@@ -61,7 +61,7 @@
if (argc > 1)
s_debug = 1;
- vgthreadid = vg_get_drd_threadid();
+ vgthreadid = vg_get_valgrind_threadid();
print_thread_id("main: ");
|
|
From: Bart V. A. <bar...@gm...> - 2008-07-01 08:10:25
|
Hello Josef,
Can you please have a look at the patch below ? I came across this
while looking for an example of a tool interface header file.
Thanks,
Bart.
Index: callgrind/callgrind.h
===================================================================
--- callgrind/callgrind.h (revision 8321)
+++ callgrind/callgrind.h (working copy)
@@ -49,7 +49,7 @@
----------------------------------------------------------------
Notice that the above BSD-style license applies to this one file
- (vgprof.h) only. The entire rest of Valgrind is licensed under
+ (callgrind.h) only. The entire rest of Valgrind is licensed under
the terms of the GNU General Public License, version 2. See the
COPYING file in the source distribution for details.
|
|
From: Dirk M. <dm...@gm...> - 2008-07-01 08:03:04
|
On Tuesday 01 July 2008, Julian Seward wrote: > Er, no, I don't think it's thread safe, or at least it would be difficult > to construct an argument that it would. It would be much better to have > the caller allocate the buffer. Uglifies the code.. a bit.. > What is the reason for needing VG_(ToXML) anyway? I thought the > XML output stuff worked OK as it is. VG_(printf) uses "%t" as a "xml-escaped %s" attribute. This does not if gcc format checking is enabled, as %t is a nonstandard extension, which it doesn't understand. I've asked you some time ago wether it would be okay to either map it to "%s" and use a ToXml function for the argument, or to use a completely different (non printf-like) function for xml output. I guess the latter makes more sense, as line formatting (printf) doesn't really make sense with xml output, the stream output can be abstracted into something else. Greetings, Dirk |
|
From: Bart V. A. <bar...@gm...> - 2008-07-01 07:49:55
|
On Tue, Jul 1, 2008 at 6:09 AM, Julian Seward <js...@ac...> wrote: > It would be much better to have the caller allocate the buffer. The function VG_(ToXML)() now expects the caller to allocate the buffer. I'm not sure whether the sizes I reserved for these buffers are large enough. > If this function's prototype is in pub_tool_libcprint.h then its > implementation should be in m_libcprint, not in m_debuglog. Fixed. > Also, adding extra includes to m_debuglog.c is not allowed, as per > big comment at the top of that file. Fixed. > What is the reason for needing VG_(ToXML) anyway? I thought the > XML output stuff worked OK as it is. A quote from gcc's -Wformat documentation (from the gcc 4.3.1 manual): "The formats are checked against the format features supported by GNU libc version 2.2. These include all ISO C90 and C99 features, as well as features from the Single Unix Specification and some BSD and GNU extensions." The %t format specifier, used for XML-escaping, is a Valgrind-extension and is not understood by gcc's format checker. That is why I replaced "...%t...", ..., str, ... by "...%s...", ..., ToXML(str), ... Bart. |
|
From: <sv...@va...> - 2008-07-01 07:46:16
|
Author: bart
Date: 2008-07-01 08:46:21 +0100 (Tue, 01 Jul 2008)
New Revision: 8323
Log:
- Moved VG_(ToXML)() from coregrind/m_debuglog to coregrind/m_libcprint.
- VG_(ToXML)() no longer uses an internal buffer -- the caller has to
provide one.
- Modified myvprintf_str_XML_simplistic() from static into extern.
Modified:
branches/FORMATCHECK/coregrind/m_debuglog.c
branches/FORMATCHECK/coregrind/m_errormgr.c
branches/FORMATCHECK/coregrind/m_libcprint.c
branches/FORMATCHECK/coregrind/m_main.c
branches/FORMATCHECK/coregrind/pub_core_debuglog.h
branches/FORMATCHECK/include/pub_tool_libcprint.h
branches/FORMATCHECK/memcheck/mc_errors.c
Modified: branches/FORMATCHECK/coregrind/m_debuglog.c
===================================================================
--- branches/FORMATCHECK/coregrind/m_debuglog.c 2008-06-30 17:10:29 UTC (rev 8322)
+++ branches/FORMATCHECK/coregrind/m_debuglog.c 2008-07-01 07:46:21 UTC (rev 8323)
@@ -49,8 +49,6 @@
#include "pub_core_basics.h" /* basic types */
#include "pub_core_vkiscnums.h" /* for syscall numbers */
#include "pub_core_debuglog.h" /* our own iface */
-#include "pub_core_libcassert.h" /* vg_assert() */
-#include "pub_tool_libcprint.h" /* VG_(ToXML)() */
#include "valgrind.h" /* for RUNNING_ON_VALGRIND */
/*------------------------------------------------------------*/
@@ -450,7 +448,6 @@
#define VG_MSG_COMMA 16 /* Add commas to numbers (for %d, %u) */
#define VG_MSG_ALTFORMAT 32 /* Convert the value to alternate format */
-
/* Copy a string into the buffer. */
static
UInt myvprintf_str ( void(*send)(HChar,void*),
@@ -500,7 +497,6 @@
/* Copy a string into the buffer, escaping bad XML chars. */
-static
UInt myvprintf_str_XML_simplistic ( void(*send)(HChar,void*),
void* send_arg2,
const HChar* str )
@@ -657,7 +653,7 @@
break;
case ',':
case '\'':
- /* If ',' follows '%', commas will be inserted. */
+ /* If ',' or '\'' follows '%', commas will be inserted. */
flags |= VG_MSG_COMMA;
break;
case '-':
@@ -881,29 +877,8 @@
va_end(vargs);
}
-static HChar xml_result_buf[256];
-static int xml_result_buf_pos;
-static void append_to_xml_result_buf(const HChar ch, void* arg2)
-{
- if (xml_result_buf_pos
- <= sizeof(xml_result_buf) / sizeof(xml_result_buf[0]) - 2)
- {
- xml_result_buf[xml_result_buf_pos++] = ch;
- }
-}
-/* Convert a string such that it can be inserted into an XML output stream. */
-extern HChar* VG_(ToXML)(const HChar* str)
-{
- if (str == NULL)
- str = "(null)";
- xml_result_buf_pos = 0;
- myvprintf_str_XML_simplistic(append_to_xml_result_buf, NULL, str);
- xml_result_buf[xml_result_buf_pos] = 0;
- return xml_result_buf;
-}
-
/*--------------------------------------------------------------------*/
/*--- end m_debuglog.c ---*/
/*--------------------------------------------------------------------*/
Modified: branches/FORMATCHECK/coregrind/m_errormgr.c
===================================================================
--- branches/FORMATCHECK/coregrind/m_errormgr.c 2008-06-30 17:10:29 UTC (rev 8322)
+++ branches/FORMATCHECK/coregrind/m_errormgr.c 2008-07-01 07:46:21 UTC (rev 8323)
@@ -699,6 +699,7 @@
{
Supp *su;
Bool any_supp;
+ HChar xml_sname[128];
if (VG_(clo_xml))
VG_(message)(Vg_DebugMsg, "<suppcounts>");
@@ -714,7 +715,8 @@
" <count>%d</count>\n"
" <name>%s</name>\n"
" </pair>",
- su->count, VG_(ToXML)(su->sname));
+ su->count,
+ VG_(ToXML)(xml_sname, sizeof(xml_sname), su->sname));
} else {
VG_(message)(Vg_DebugMsg, "supp: %6d %s", su->count, su->sname);
}
Modified: branches/FORMATCHECK/coregrind/m_libcprint.c
===================================================================
--- branches/FORMATCHECK/coregrind/m_libcprint.c 2008-06-30 17:10:29 UTC (rev 8322)
+++ branches/FORMATCHECK/coregrind/m_libcprint.c 2008-07-01 07:46:21 UTC (rev 8323)
@@ -285,6 +285,47 @@
/* ---------------------------------------------------------------------
+ ToXML()
+ ------------------------------------------------------------------ */
+
+struct xml_buf {
+ HChar* cur;
+ HChar* end;
+};
+
+static void append_to_xml_buf(const HChar ch, void* arg2)
+{
+ struct xml_buf* const xml_buf = arg2;
+
+ if (xml_buf->cur < xml_buf->end)
+ {
+ *xml_buf->cur++ = ch;
+ }
+ else
+ {
+ /* Make sure that it gets noticed if a buffer is too small. */
+ vg_assert(False);
+ }
+}
+
+/* Convert a string such that it can be inserted into an XML output stream. */
+
+extern HChar* VG_(ToXML)(HChar* const buf, const Int size,
+ const HChar* str)
+{
+ static struct xml_buf xml_buf;
+
+ if (str == NULL)
+ str = "(null)";
+ xml_buf.cur = buf;
+ xml_buf.end = buf + size - 1;
+ myvprintf_str_XML_simplistic(append_to_xml_buf, &xml_buf, str);
+ *xml_buf.cur++ = 0;
+ return buf;
+}
+
+
+/* ---------------------------------------------------------------------
elapsed_wallclock_time()
------------------------------------------------------------------ */
Modified: branches/FORMATCHECK/coregrind/m_main.c
===================================================================
--- branches/FORMATCHECK/coregrind/m_main.c 2008-06-30 17:10:29 UTC (rev 8322)
+++ branches/FORMATCHECK/coregrind/m_main.c 2008-07-01 07:46:21 UTC (rev 8323)
@@ -734,6 +734,9 @@
// Get the env var name, print its contents.
Char* qualname;
Char* qual;
+ Char xml_qualname[256];
+ Char xml_qual[256];
+
i++;
qualname = &format[i];
while (True) {
@@ -749,7 +752,9 @@
VG_(message)(Vg_UserMsg, "<logfilequalifier> <var>%s</var> "
"<value>%s</value> </logfilequalifier>",
- VG_(ToXML)(qualname), VG_(ToXML)(qual));
+ VG_(ToXML)(xml_qualname, sizeof(xml_qualname),
+ qualname),
+ VG_(ToXML)(xml_qual, sizeof(xml_qual), qual));
format[i] = '}';
i++;
}
@@ -850,10 +855,13 @@
}
else
if (VG_(clo_xml)) {
+ HChar xml_buf[256];
+
VG_(message)(Vg_UserMsg, "");
VG_(message)(Vg_UserMsg, "<pid>%d</pid>", VG_(getpid)());
VG_(message)(Vg_UserMsg, "<ppid>%d</ppid>", VG_(getppid)());
- VG_(message)(Vg_UserMsg, "<tool>%s</tool>", VG_(ToXML)(toolname));
+ VG_(message)(Vg_UserMsg, "<tool>%s</tool>",
+ VG_(ToXML)(xml_buf, sizeof(xml_buf), toolname));
if (VG_(clo_log_name))
print_file_vars(VG_(clo_log_name));
if (VG_(clo_xml_user_comment)) {
@@ -869,25 +877,30 @@
VG_(message)(Vg_UserMsg, " <vargv>");
if (VG_(name_of_launcher))
VG_(message)(Vg_UserMsg, " <exe>%s</exe>",
- VG_(ToXML)(VG_(name_of_launcher)));
+ VG_(ToXML)(xml_buf, sizeof(xml_buf),
+ VG_(name_of_launcher)));
else
VG_(message)(Vg_UserMsg, " <exe>%s</exe>",
- VG_(ToXML)("(launcher name unknown)"));
+ VG_(ToXML)(xml_buf, sizeof(xml_buf),
+ "(launcher name unknown)"));
for (i = 0; i < VG_(sizeXA)( VG_(args_for_valgrind) ); i++) {
VG_(message)(Vg_UserMsg,
" <arg>%s</arg>",
- VG_(ToXML)(* (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i )));
+ VG_(ToXML)(xml_buf, sizeof(xml_buf),
+ * (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i )));
}
VG_(message)(Vg_UserMsg, " </vargv>");
VG_(message)(Vg_UserMsg, " <argv>");
if (VG_(args_the_exename))
VG_(message)(Vg_UserMsg, " <exe>%s</exe>",
- VG_(ToXML)(VG_(args_the_exename)));
+ VG_(ToXML)(xml_buf, sizeof(xml_buf),
+ VG_(args_the_exename)));
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
VG_(message)(Vg_UserMsg,
" <arg>%s</arg>",
- VG_(ToXML)(* (HChar**) VG_(indexXA)( VG_(args_for_client), i )));
+ VG_(ToXML)(xml_buf, sizeof(xml_buf),
+ * (HChar**) VG_(indexXA)( VG_(args_for_client), i )));
}
VG_(message)(Vg_UserMsg, " </argv>");
@@ -1933,12 +1946,14 @@
//--------------------------------------------------------------
if (VG_(clo_xml)) {
HChar buf[50];
+ HChar xml_buf[256];
+
VG_(elapsed_wallclock_time)(buf);
VG_(message)(Vg_UserMsg, "<status>\n"
" <state>RUNNING</state>\n"
" <time>%s</time>\n"
"</status>",
- VG_(ToXML)(buf));
+ VG_(ToXML)(xml_buf, sizeof(xml_buf), buf));
VG_(message)(Vg_UserMsg, "");
}
@@ -2040,6 +2055,8 @@
if (VG_(clo_xml)) {
HChar buf[50];
+ HChar xml_buf[256];
+
if (VG_(needs).core_errors || VG_(needs).tool_errors) {
VG_(show_error_counts_as_XML)();
VG_(message)(Vg_UserMsg, "");
@@ -2049,7 +2066,7 @@
" <state>FINISHED</state>\n"
" <time>%s</time>\n"
"</status>",
- VG_(ToXML)(buf));
+ VG_(ToXML)(xml_buf, sizeof(xml_buf), buf));
VG_(message)(Vg_UserMsg, "");
}
Modified: branches/FORMATCHECK/coregrind/pub_core_debuglog.h
===================================================================
--- branches/FORMATCHECK/coregrind/pub_core_debuglog.h 2008-06-30 17:10:29 UTC (rev 8322)
+++ branches/FORMATCHECK/coregrind/pub_core_debuglog.h 2008-07-01 07:46:21 UTC (rev 8323)
@@ -84,7 +84,12 @@
va_list vargs
);
+/* Copy a string into the buffer, escaping bad XML chars. */
+UInt myvprintf_str_XML_simplistic ( void(*send)(HChar,void*),
+ void* send_arg2,
+ const HChar* str );
+
#endif // __PUB_CORE_DEBUGLOG_H
/*--------------------------------------------------------------------*/
Modified: branches/FORMATCHECK/include/pub_tool_libcprint.h
===================================================================
--- branches/FORMATCHECK/include/pub_tool_libcprint.h 2008-06-30 17:10:29 UTC (rev 8322)
+++ branches/FORMATCHECK/include/pub_tool_libcprint.h 2008-07-01 07:46:21 UTC (rev 8323)
@@ -90,7 +90,7 @@
extern UInt VG_(vmessage) ( VgMsgKind kind, const HChar* format, va_list vargs ) PRINTF_CHECK(2, 0);
/* Convert a string such that it can be inserted into an XML output stream. */
-extern HChar* VG_(ToXML)(const HChar* const str);
+extern HChar* VG_(ToXML)(HChar* buf, Int size, const HChar* str);
#endif // __PUB_TOOL_LIBCPRINT_H
Modified: branches/FORMATCHECK/memcheck/mc_errors.c
===================================================================
--- branches/FORMATCHECK/memcheck/mc_errors.c 2008-06-30 17:10:29 UTC (rev 8322)
+++ branches/FORMATCHECK/memcheck/mc_errors.c 2008-07-01 07:46:21 UTC (rev 8323)
@@ -262,6 +262,7 @@
{
HChar* xpre = VG_(clo_xml) ? " <auxwhat>" : " ";
HChar* xpost = VG_(clo_xml) ? "</auxwhat>" : "";
+ HChar xml_buf[256];
switch (ai->tag) {
case Addr_Unknown:
@@ -321,7 +322,8 @@
xpre,
(ULong)a,
(ULong)ai->Addr.DataSym.offset,
- VG_(ToXML)(ai->Addr.DataSym.name),
+ VG_(ToXML)(xml_buf, sizeof(xml_buf),
+ ai->Addr.DataSym.name),
xpost);
break;
@@ -339,8 +341,10 @@
"%sAddress 0x%llx is in the %s segment of %s%s",
xpre,
(ULong)a,
- VG_(ToXML)(VG_(pp_SectKind)(ai->Addr.SectKind.kind)),
- VG_(ToXML)(ai->Addr.SectKind.objname),
+ VG_(ToXML)(xml_buf, sizeof(xml_buf),
+ VG_(pp_SectKind)(ai->Addr.SectKind.kind)),
+ VG_(ToXML)(xml_buf, sizeof(xml_buf),
+ ai->Addr.SectKind.objname),
xpost);
break;
@@ -420,6 +424,7 @@
void MC_(pp_Error) ( Error* err )
{
MC_Error* extra = VG_(get_error_extra)(err);
+ HChar xml_buf[256];
switch (VG_(get_error_kind)(err)) {
case Err_CoreMem: {
@@ -569,7 +574,8 @@
if (VG_(clo_xml)) {
VG_(message)(Vg_UserMsg, " <kind>%s</kind>",
- VG_(ToXML)(xml_leak_kind(l->loss_mode)));
+ VG_(ToXML)(xml_buf, sizeof(xml_buf),
+ xml_leak_kind(l->loss_mode)));
} else {
VG_(message)(Vg_UserMsg, "");
}
|