valgrind support for --mode sim
GoogleCodeExporter opened this issue · comments
here's the active ingredient:
~/Projects/vogar$ svn diff
Index: src/vogar/HostDalvikVm.java
===================================================================
--- src/vogar/HostDalvikVm.java (revision 100)
+++ src/vogar/HostDalvikVm.java (working copy)
@@ -67,21 +67,28 @@
new File(base + "/system/framework/framework.jar")
);
- return new VmCommandBuilder()
+ boolean valgrind = true;
+ VmCommandBuilder builder = new VmCommandBuilder()
+ .workingDir(workingDirectory)
+ .temp(workingDirectory)
.env("ANDROID_PRINTF_LOG", "tag")
.env("ANDROID_LOG_TAGS", "*:w")
.env("ANDROID_DATA", dalvikCache.getParent())
.env("ANDROID_ROOT", base + "/system")
.env("LD_LIBRARY_PATH", base + "/system/lib")
- .env("DYLD_LIBRARY_PATH", base + "/system/lib")
- .vmCommand(base + "/system/bin/dalvikvm")
- .workingDir(workingDirectory)
- .temp(workingDirectory)
+ .env("DYLD_LIBRARY_PATH", base + "/system/lib");
+ if (valgrind) {
+ builder.vmCommand("valgrind", "--leak-check=full", base +
"/system/bin/dalvikvm");
+ } else {
+ builder.vmCommand(base + "/system/bin/dalvikvm");
+ }
+ builder
.vmArgs("-Xbootclasspath:" + bootClasspath.toString())
.vmArgs("-Duser.home=" + workingDirectory)
.vmArgs("-Duser.language=en")
.vmArgs("-Duser.region=US")
.vmArgs("-Djavax.net.ssl.trustStore=" + base + "/system/etc/security/cacerts.bks");
+ return builder;
}
@Override protected Classpath getRuntimeClasspath(Action action) {
~/Projects/vogar$
two things are missing:
1. we need a better way to decide whether we want valgrind. a command-line
option is probably fine, and trivial.
2. we need a way to ensure we actually see valgrind's output. but that's a
special case of a more general bug, which i'll raise separately.
i'll add a --valgrind command-line option and submit what i've got. i've been
finding this useful even though i've had to manually faff about to get the
valgrind output.
Original issue reported on code.google.com by e...@google.com
on 22 Jun 2010 at 10:15
revision 101 adds a command-line option to turn valgrind on for --mode sim.
Original comment by e...@google.com
on 22 Jun 2010 at 10:37
- Changed state: Fixed