title: How to start an android app with valgrind
body: <p>I've been searching for the last week trying to find an answer to this question. </p>
  
  <p>How do I start an Android app with valgrind? I know I can start an app with the 'am' command, but it starts the app and exits.</p>
  
  <p>I'm writing an app that uses the NDK for native C code, and I need to check it for suspected memory errors.</p>
  
  <p>Edit: </p>
  
  <p>I've learned a little more. You can "wrap" an app with a shell script.</p>
  
  <p>Here's the shell script I'm using:</p>
  
  <pre><code>#!/system/bin/sh
  VGPARAMS='--error-limit=no'
  export TMPDIR=/data/data/com.starlon.froyvisuals
  exec /data/local/Inst/bin/valgrind $VGPARAMS $*
  </code></pre>
  
  <p>And here's setprop:</p>
  
  <pre><code>adb shell setprop wrap.com.starlon.froyvisuals "logwrapper valgrind"
  </code></pre>
  
  <p>And here's how I start the app:</p>
  
  <pre><code>adb shell am start -n com.starlon.froyvisuals/.FroyVisuals
  </code></pre>
  
  <p>I don't think this is right, because I'm not sure where the shell script fits in and I'm not seeing anything in logcat. Any hints?</p>
  
  <p>Edit2: 
  Oh the shell script is indicated with "setprop" command above. So</p>
  
  <pre><code>adb shell setprop wrap.com.starlon.froyvisuals "logwrapper /data/local/val.sh"
  </code></pre>
  
  <p>I'm still not seeing anything in logcat.</p>