title: Attach valgrind with daemon and collect logs for each daemon call
body: <p>I have a client server system, completely written in c++. server runs as <code>/etc/init.d/serverd</code> with start/stop options. <code>Client.exe</code> executes any command as <code>client.exe --options</code>. With each client call, daemon hits.
  I want to attach <code>valgrind</code> with <code>/etc/init.d/serverd</code> to detect leak.
  I tried below options but failed.</p>
  
  <pre><code>/usr/local/bin/valgrind --log-file=valgrind_1.log -v --trace-children=yes --leak-check=full --tool=memcheck --vgdb=yes --vgdb-error=0 /etc/init.d/ serverd start
  </code></pre>
  
  <p>Each time it fails to attached with daemon.</p>
  
  <p>What we want is to attach <code>valgrind</code> with daemon <strong>at starting time</strong> <code>[ the exact point is , I will stop daemon , attach valgrind with it and then start it again ]</code> so that each time , execution of <code>client.exe --options</code>, logs should be generated for daemon in <code>--log-file=valgrind_1.log</code></p>
  
  <p>Does anyone have any idea about how to do the same?</p>