<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: RFC: Making Valgrind easier to use with multi-process programs</title>
	<atom:link href="http://blog.mozilla.com/nnethercote/2009/04/30/making-valgrind-easier-to-use-with-multi-process-programs/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mozilla.com/nnethercote/2009/04/30/making-valgrind-easier-to-use-with-multi-process-programs/</link>
	<description>Just another Blog.mozilla.com weblog</description>
	<lastBuildDate>Tue, 26 Jan 2010 14:53:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Nick</title>
		<link>http://blog.mozilla.com/nnethercote/2009/04/30/making-valgrind-easier-to-use-with-multi-process-programs/comment-page-1/#comment-154</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Sat, 02 May 2009 01:05:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/nnethercote/?p=90#comment-154</guid>
		<description>Thanks for the details.  I&#039;m still concerned about the complexity for such a simple case.  It&#039;d be nice to achieve &quot;make the common cases easy and the uncommon cases possible&quot;.  Black-lists/white-lists achieve the first half of that;  your suggestion achieves the last half.

I wonder if it would be possible to provide a couple of predicates for making common cases (such as those equivalent to black-listing/white-listing) easy.  Eg. such that you could write this:

  --trace-children-predicate=&quot;blacklist &#039;/usr/bin/python .*&#039;&quot;

and &quot;blacklist&quot; would take the &#039;/usr/bin/python .*&#039; argument, which is a regexp, and do a regexp match against the full command.

So &quot;blacklist&quot; would receive the regexp as its first arg, and then the remaining args (toolname, PID, exec path, etc) as the 2nd and subsequent args.  I think that could be made to work.  Likewise for &quot;whitelist&quot;, etc.

I think that would achieve &quot;make the common cases easy and the uncommon cases possible&quot;.</description>
		<content:encoded><![CDATA[<p>Thanks for the details.  I&#8217;m still concerned about the complexity for such a simple case.  It&#8217;d be nice to achieve &#8220;make the common cases easy and the uncommon cases possible&#8221;.  Black-lists/white-lists achieve the first half of that;  your suggestion achieves the last half.</p>
<p>I wonder if it would be possible to provide a couple of predicates for making common cases (such as those equivalent to black-listing/white-listing) easy.  Eg. such that you could write this:</p>
<p>  &#8211;trace-children-predicate=&#8221;blacklist &#8216;/usr/bin/python .*&#8217;&#8221;</p>
<p>and &#8220;blacklist&#8221; would take the &#8216;/usr/bin/python .*&#8217; argument, which is a regexp, and do a regexp match against the full command.</p>
<p>So &#8220;blacklist&#8221; would receive the regexp as its first arg, and then the remaining args (toolname, PID, exec path, etc) as the 2nd and subsequent args.  I think that could be made to work.  Likewise for &#8220;whitelist&#8221;, etc.</p>
<p>I think that would achieve &#8220;make the common cases easy and the uncommon cases possible&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Reiser</title>
		<link>http://blog.mozilla.com/nnethercote/2009/04/30/making-valgrind-easier-to-use-with-multi-process-programs/comment-page-1/#comment-153</link>
		<dc:creator>John Reiser</dc:creator>
		<pubDate>Fri, 01 May 2009 18:36:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/nnethercote/?p=90#comment-153</guid>
		<description>ARRGGGHHH!  The blog software stripped my meta-syntactic use of less-than and greater-than signs to specify trailing arguments to the shell and perl in those examples above: toolname, PPID, pathname_to_execve, and argv[]_to_execve</description>
		<content:encoded><![CDATA[<p>ARRGGGHHH!  The blog software stripped my meta-syntactic use of less-than and greater-than signs to specify trailing arguments to the shell and perl in those examples above: toolname, PPID, pathname_to_execve, and argv[]_to_execve</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Reiser</title>
		<link>http://blog.mozilla.com/nnethercote/2009/04/30/making-valgrind-easier-to-use-with-multi-process-programs/comment-page-1/#comment-152</link>
		<dc:creator>John Reiser</dc:creator>
		<pubDate>Fri, 01 May 2009 18:34:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/nnethercote/?p=90#comment-152</guid>
		<description>Nick, here&#039;s how the escape character mechanism could work for your case:
  valgrind --trace-children-predicate=&quot;&#124; perl -c \&quot; exit ( $ARGV[5] eq \\\“/usr/bin/python\\\” ? 1 : 0 ) \&quot; &quot; ./my_app
where I have used $ARGV[5] because eventually perl will be invoked with its sixth argument being the pathname to the original execve; see below.

The shell quoting is enough so that vagrind sees:
   --trace-children-predicate=&#124; perl -c &quot; exit ( $ARGV[5] eq \“/usr/bin/python\” ? 1 : 0 ) &quot; 
(which has a trailing space).  Then valgrind interprets the pipe symbol as indicating a literal shell command instead of the name of an executable.  So valgrind invokes a shell as [each argument on a separate line]:
   /bin/sh
   -c
    perl -c &quot; exit ( $ARGV[5] eq \“/usr/bin/python\” ? 1 : 0 ) &quot; 
   
   
   
   
The shell invokes perl with arguments
   /usr/bin/perl
   -c
    exit ( $ARGV[5] eq “/usr/bin/python” ? 1 : 0 ) 
   
   
   
   
which looks like the right stuff.  Of course this would be simpler if arguments did not suffer re-parsing by the various interpreters.</description>
		<content:encoded><![CDATA[<p>Nick, here&#8217;s how the escape character mechanism could work for your case:<br />
  valgrind &#8211;trace-children-predicate=&#8221;| perl -c \&#8221; exit ( $ARGV[5] eq \\\“/usr/bin/python\\\” ? 1 : 0 ) \&#8221; &#8221; ./my_app<br />
where I have used $ARGV[5] because eventually perl will be invoked with its sixth argument being the pathname to the original execve; see below.</p>
<p>The shell quoting is enough so that vagrind sees:<br />
   &#8211;trace-children-predicate=| perl -c &#8221; exit ( $ARGV[5] eq \“/usr/bin/python\” ? 1 : 0 ) &#8221;<br />
(which has a trailing space).  Then valgrind interprets the pipe symbol as indicating a literal shell command instead of the name of an executable.  So valgrind invokes a shell as [each argument on a separate line]:<br />
   /bin/sh<br />
   -c<br />
    perl -c &#8221; exit ( $ARGV[5] eq \“/usr/bin/python\” ? 1 : 0 ) &#8221; </p>
<p>The shell invokes perl with arguments<br />
   /usr/bin/perl<br />
   -c<br />
    exit ( $ARGV[5] eq “/usr/bin/python” ? 1 : 0 ) </p>
<p>which looks like the right stuff.  Of course this would be simpler if arguments did not suffer re-parsing by the various interpreters.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nicholas Nethercote</title>
		<link>http://blog.mozilla.com/nnethercote/2009/04/30/making-valgrind-easier-to-use-with-multi-process-programs/comment-page-1/#comment-151</link>
		<dc:creator>Nicholas Nethercote</dc:creator>
		<pubDate>Thu, 30 Apr 2009 22:51:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/nnethercote/?p=90#comment-151</guid>
		<description>Ka-Hing, Colin:  You are right, Firefox perhaps isn&#039;t the best example to use here, because the extra processes can be easily skipped.

But there are more &quot;genuine&quot; multi-process programs out there (eg. Google Chrome, which I also mentioned).  I made these proposals in response to real users asking for this functionality.</description>
		<content:encoded><![CDATA[<p>Ka-Hing, Colin:  You are right, Firefox perhaps isn&#8217;t the best example to use here, because the extra processes can be easily skipped.</p>
<p>But there are more &#8220;genuine&#8221; multi-process programs out there (eg. Google Chrome, which I also mentioned).  I made these proposals in response to real users asking for this functionality.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nicholas Nethercote</title>
		<link>http://blog.mozilla.com/nnethercote/2009/04/30/making-valgrind-easier-to-use-with-multi-process-programs/comment-page-1/#comment-150</link>
		<dc:creator>Nicholas Nethercote</dc:creator>
		<pubDate>Thu, 30 Apr 2009 22:45:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/nnethercote/?p=90#comment-150</guid>
		<description>John, the escape character idea sounds promising, but I can&#039;t quite see how it would work.  If I want to use this snippet of Perl code as the predicate:

  exit ( $ARGV[0] eq &quot;/usr/bin/python&quot; ? 1 : 0 )

what would the Valgrind command line look like?  I&#039;m particularly unsure if the quoting would work out.  Thanks.</description>
		<content:encoded><![CDATA[<p>John, the escape character idea sounds promising, but I can&#8217;t quite see how it would work.  If I want to use this snippet of Perl code as the predicate:</p>
<p>  exit ( $ARGV[0] eq &#8220;/usr/bin/python&#8221; ? 1 : 0 )</p>
<p>what would the Valgrind command line look like?  I&#8217;m particularly unsure if the quoting would work out.  Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Reiser</title>
		<link>http://blog.mozilla.com/nnethercote/2009/04/30/making-valgrind-easier-to-use-with-multi-process-programs/comment-page-1/#comment-149</link>
		<dc:creator>John Reiser</dc:creator>
		<pubDate>Thu, 30 Apr 2009 14:17:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/nnethercote/?p=90#comment-149</guid>
		<description>The exit code of the predicate process could be interpreted further.  In addition to 0 for &quot;exec, and trace it&quot;, then 1 could be &quot;exec but do not trace&quot; and 2 could be &quot;do not exec&quot; because the predicate has already done it, such as by invoking a different tool, and thus subsuming the original intent to exec.</description>
		<content:encoded><![CDATA[<p>The exit code of the predicate process could be interpreted further.  In addition to 0 for &#8220;exec, and trace it&#8221;, then 1 could be &#8220;exec but do not trace&#8221; and 2 could be &#8220;do not exec&#8221; because the predicate has already done it, such as by invoking a different tool, and thus subsuming the original intent to exec.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Reiser</title>
		<link>http://blog.mozilla.com/nnethercote/2009/04/30/making-valgrind-easier-to-use-with-multi-process-programs/comment-page-1/#comment-148</link>
		<dc:creator>John Reiser</dc:creator>
		<pubDate>Thu, 30 Apr 2009 13:46:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/nnethercote/?p=90#comment-148</guid>
		<description>For making the predicate process mechanism more lightweight, there could be an escape based on the first character of the name.  For instance, &quot;strace -o &#039;&#124; gzip -c &gt;foo&#039;&quot; creates a pipeline for the output of strace, instead of just a filename.  For valgrind, the escape might be just a literal shell script to be invoked as &quot;sh -c &quot;, and with the same arguments as for the heavyweight predicate.</description>
		<content:encoded><![CDATA[<p>For making the predicate process mechanism more lightweight, there could be an escape based on the first character of the name.  For instance, &#8220;strace -o &#8216;| gzip -c &gt;foo&#8217;&#8221; creates a pipeline for the output of strace, instead of just a filename.  For valgrind, the escape might be just a literal shell script to be invoked as &#8220;sh -c &#8220;, and with the same arguments as for the heavyweight predicate.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Colin Walters</title>
		<link>http://blog.mozilla.com/nnethercote/2009/04/30/making-valgrind-easier-to-use-with-multi-process-programs/comment-page-1/#comment-147</link>
		<dc:creator>Colin Walters</dc:creator>
		<pubDate>Thu, 30 Apr 2009 13:46:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/nnethercote/?p=90#comment-147</guid>
		<description>Firefox is not multiprocess.  The extra shell process is an *entirely pointless* waste, and there&#039;s a trivial patch to fix it here for a while which just needs to be reviewed and applied:

https://bugzilla.mozilla.org/show_bug.cgi?id=477724</description>
		<content:encoded><![CDATA[<p>Firefox is not multiprocess.  The extra shell process is an *entirely pointless* waste, and there&#8217;s a trivial patch to fix it here for a while which just needs to be reviewed and applied:</p>
<p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=477724" rel="nofollow">https://bugzilla.mozilla.org/show_bug.cgi?id=477724</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://blog.mozilla.com/nnethercote/2009/04/30/making-valgrind-easier-to-use-with-multi-process-programs/comment-page-1/#comment-146</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Thu, 30 Apr 2009 11:58:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/nnethercote/?p=90#comment-146</guid>
		<description>John&#039;s idea subsumes black-lists, but doesn&#039;t cover whitelists.  One possibility is to have three return values, eg. 0 to trace with the given tool, 1 to trace with Nulgrind, 2 to run natively.  Another possibility is to make the stdout control the tracing, eg. produce &quot;trace&quot;, &quot;nulgrind&quot;, &quot;native&quot;.  (You could even go so far as to name another tool, and thus trace different process with different tools, although that is probably overkill.)  Either way, it would subsume white-lists as well.

So the power is good.  But I&#039;m concerned about convenience, particularly for simple cases like &quot;skip all python sub-processes&quot;.  Having to create a separate program (even a short script) is much more heavyweight than specifying something like --trace-blacklist=&quot;/usr/bin/python *&quot;.  Or is there a way to do the equivalent entirely from the command line that I&#039;m missing?</description>
		<content:encoded><![CDATA[<p>John&#8217;s idea subsumes black-lists, but doesn&#8217;t cover whitelists.  One possibility is to have three return values, eg. 0 to trace with the given tool, 1 to trace with Nulgrind, 2 to run natively.  Another possibility is to make the stdout control the tracing, eg. produce &#8220;trace&#8221;, &#8220;nulgrind&#8221;, &#8220;native&#8221;.  (You could even go so far as to name another tool, and thus trace different process with different tools, although that is probably overkill.)  Either way, it would subsume white-lists as well.</p>
<p>So the power is good.  But I&#8217;m concerned about convenience, particularly for simple cases like &#8220;skip all python sub-processes&#8221;.  Having to create a separate program (even a short script) is much more heavyweight than specifying something like &#8211;trace-blacklist=&#8221;/usr/bin/python *&#8221;.  Or is there a way to do the equivalent entirely from the command line that I&#8217;m missing?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kostya Serebryany</title>
		<link>http://blog.mozilla.com/nnethercote/2009/04/30/making-valgrind-easier-to-use-with-multi-process-programs/comment-page-1/#comment-145</link>
		<dc:creator>Kostya Serebryany</dc:creator>
		<pubDate>Thu, 30 Apr 2009 06:35:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/nnethercote/?p=90#comment-145</guid>
		<description>+1 for John Reiser&#039;s suggestion.
Leave --trace-children as it is now. 
Add another option for a &#039;predicate process&#039;.</description>
		<content:encoded><![CDATA[<p>+1 for John Reiser&#8217;s suggestion.<br />
Leave &#8211;trace-children as it is now.<br />
Add another option for a &#8216;predicate process&#8217;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
