I've installed valgrind for android and I can confirm it is working as I tried running ls with it, and it works fine.
But how do I execute an android app with a native component I would like to debug? I looked at this question: How to start an android app with valgrind but I have no idea how to follow it. How do you wrap an app in a shell script? What is "wrap." followed by the package name supposed to be?
I tried doing this with com.matthewmitchell.wakeifyplus being my application package:
setprop wrap.com.matthewmitchell.wakeifyplus "logwrapper /data/local/valgrind"
but it says "could not set property". What am I supposed to do? I can't find any step by step guide that works. I did try this (I don't even know what setprop does):
setprop com.matthewmitchell.wakeifyplus "logwrapper /data/local/valgrind"
With /data/local/valgrind being a shell script with execute permissions which is:
#!/system/bin/sh
VGPARAMS='--error-limit=no'
export TMPDIR=/data/data/com.matthewmitchell.wakeifyplus
exec /data/local/Inst/bin/valgrind $VGPARAMS $*
But when I run the app with:
am start -a android.intent.action.MAIN -n com.matthewmitchell.wakeifyplus/.MainActivity
valgrind does not show up in logcat, even after clearing it.
You get the error "could not set property" because you CANNOT set a property name with a length greater than 31, which is the number maximum allowed characters in the property name: https://stackoverflow.com/a/5068818/313113
Try to reduce the package name length to less than or equal 31 characters when you set the property with adb shell setprop.
And use a bash script to simply things.
For further details see my answer here: https://stackoverflow.com/a/19235439/313113
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With