diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/545-tracing-and-jit/src/Main.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/545-tracing-and-jit/src/Main.java b/test/545-tracing-and-jit/src/Main.java index d3c79aeb5e..a2d51d5a8c 100644 --- a/test/545-tracing-and-jit/src/Main.java +++ b/test/545-tracing-and-jit/src/Main.java @@ -84,6 +84,10 @@ public class Main { } } else { if (invocationCount == 0) { + // When running the trace in trace mode, there is already a trace running. + if (VMDebug.getMethodTracingMode() != 0) { + VMDebug.stopMethodTracing(); + } VMDebug.startMethodTracing(file.getPath(), 0, 0, false, 0); } fillJit(); @@ -219,12 +223,14 @@ public class Main { private static class VMDebug { private static final Method startMethodTracingMethod; private static final Method stopMethodTracingMethod; + private static final Method getMethodTracingModeMethod; static { try { Class c = Class.forName("dalvik.system.VMDebug"); startMethodTracingMethod = c.getDeclaredMethod("startMethodTracing", String.class, Integer.TYPE, Integer.TYPE, Boolean.TYPE, Integer.TYPE); stopMethodTracingMethod = c.getDeclaredMethod("stopMethodTracing"); + getMethodTracingModeMethod = c.getDeclaredMethod("getMethodTracingMode"); } catch (Exception e) { throw new RuntimeException(e); } @@ -238,5 +244,8 @@ public class Main { public static void stopMethodTracing() throws Exception { stopMethodTracingMethod.invoke(null); } + public static int getMethodTracingMode() throws Exception { + return (int) getMethodTracingModeMethod.invoke(null); + } } } |