blob: 6bf6bdaa0b6ab81a6e3623c6064bb1be9ac8a47d [file] [log] [blame]
Alex Lightb4e65072019-04-25 15:10:32 -07001/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package art;
18
19import java.lang.reflect.Executable;
20import java.lang.reflect.Field;
21
22/**
23 * A set of functions to request events that suspend the thread they trigger on.
24 */
25public final class SuspendEvents {
26 /**
27 * Sets up the suspension support. Must be called at the start of the test.
28 */
29 public static native void setupTest();
30
31 public static native void setupSuspendBreakpointFor(Executable meth, long loc, Thread thr);
32 public static native void clearSuspendBreakpointFor(Thread thr);
33
34 public static native void setupSuspendSingleStepAt(Executable meth, long loc, Thread thr);
35 public static native void clearSuspendSingleStepFor(Thread thr);
36
37 public static native void setupFieldSuspendFor(Class klass, Field f, boolean access, Thread thr);
38 public static native void clearFieldSuspendFor(Thread thr);
39
40 public static native void setupSuspendMethodEvent(Executable meth, boolean enter, Thread thr);
41 public static native void clearSuspendMethodEvent(Thread thr);
42
43 public static native void setupSuspendExceptionEvent(
44 Executable meth, boolean is_catch, Thread thr);
45 public static native void clearSuspendExceptionEvent(Thread thr);
46
47 public static native void setupSuspendPopFrameEvent(
48 int offset, Executable breakpointFunction, Thread thr);
49 public static native void clearSuspendPopFrameEvent(Thread thr);
50
51 public static final int EVENT_TYPE_CLASS_LOAD = 55;
52 public static final int EVENT_TYPE_CLASS_PREPARE = 56;
53 public static native void setupSuspendClassEvent(
54 int eventType, String[] interestingNames, Thread thr);
55 public static native void clearSuspendClassEvent(Thread thr);
56
57 public static native void setupWaitForNativeCall(Thread thr);
58 public static native void clearWaitForNativeCall(Thread thr);
59
60 /**
61 * Waits for the given thread to be suspended.
62 * @param thr the thread to wait for.
63 */
64 public static native void waitForSuspendHit(Thread thr);
65}