diff options
author | 2022-12-19 09:40:18 +0000 | |
---|---|---|
committer | 2023-01-04 15:15:23 +0000 | |
commit | 5497f749b4d35c7b0767d21cb487e2fee293cd07 (patch) | |
tree | ab9d266fa3e38628486b1dcdbdcbd43237851aed /test/2246-trace-stream/src/Main.java | |
parent | 3cde18ddf4a7af5aabd183eab59f052065270f10 (diff) |
Fix method tracing in non-debuggable runtimes
There are a few fixes needed for correctly supporting method tracing in
non-debuggable runtimes:
1. When we start method tracing we report method entry events for
methods already on the stack with the expectation that method exit
events would be called when method finishes. In non-debuggable
runtimes some of these may not support method exit events, so report
method entry events only if the frame supports them.
2. When method tracing is enabled, we switch the runtime to debuggable.
When we switch to debuggable runtime, we missed updating entrypoints
and deoptimizing boot image. Fix it so we get method entry / exit
events for all methods.
Also updates test 2246-method-trace to work in non-debuggable runtimes.
Bug: 259258187
Test: art/testrunner.py -t 2246
Change-Id: I040416c7cb72062c02312eedb5bcd41da09e53dc
Diffstat (limited to 'test/2246-trace-stream/src/Main.java')
-rw-r--r-- | test/2246-trace-stream/src/Main.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/2246-trace-stream/src/Main.java b/test/2246-trace-stream/src/Main.java index 39f3216d02..37870f14c1 100644 --- a/test/2246-trace-stream/src/Main.java +++ b/test/2246-trace-stream/src/Main.java @@ -36,19 +36,19 @@ public class Main { Main m = new Main(); Thread t = new Thread(() -> { Main m1 = new Main(); - m1.doSomeWork(); + m1.$noinline$doSomeWork(); }, "TestThread2246"); try { if (VMDebug.getMethodTracingMode() != 0) { - VMDebug.stopMethodTracing(); + VMDebug.$noinline$stopMethodTracing(); } VMDebug.startMethodTracing(file.getPath(), out_file.getFD(), 0, 0, false, 0, true); t.start(); t.join(); - m.doSomeWork(); + m.$noinline$doSomeWork(); m.doSomeWorkThrow(); - VMDebug.stopMethodTracing(); + VMDebug.$noinline$stopMethodTracing(); out_file.close(); m.CheckTraceFileFormat(file); } finally { @@ -83,7 +83,7 @@ public class Main { if (!seen_stop_tracing_method) { System.out.println(event_string); } - if (event_string.contains("Main$VMDebug stopMethodTracing")) { + if (event_string.contains("Main$VMDebug $noinline$stopMethodTracing")) { seen_stop_tracing_method = true; } } @@ -111,7 +111,7 @@ public class Main { public void callLeafFunction() {} - public void doSomeWork() { + public void $noinline$doSomeWork() { callOuterFunction(); callLeafFunction(); } @@ -150,7 +150,7 @@ public class Main { startMethodTracingMethod.invoke( null, filename, fd, bufferSize, flags, samplingEnabled, intervalUs, streaming); } - public static void stopMethodTracing() throws Exception { + public static void $noinline$stopMethodTracing() throws Exception { stopMethodTracingMethod.invoke(null); } public static int getMethodTracingMode() throws Exception { |