1*795d594fSAndroid Build Coastguard Worker /* 2*795d594fSAndroid Build Coastguard Worker * Copyright (C) 2017 The Android Open Source Project 3*795d594fSAndroid Build Coastguard Worker * 4*795d594fSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*795d594fSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*795d594fSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*795d594fSAndroid Build Coastguard Worker * 8*795d594fSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*795d594fSAndroid Build Coastguard Worker * 10*795d594fSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*795d594fSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*795d594fSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*795d594fSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*795d594fSAndroid Build Coastguard Worker * limitations under the License. 15*795d594fSAndroid Build Coastguard Worker */ 16*795d594fSAndroid Build Coastguard Worker 17*795d594fSAndroid Build Coastguard Worker package art; 18*795d594fSAndroid Build Coastguard Worker 19*795d594fSAndroid Build Coastguard Worker import java.lang.reflect.Field; 20*795d594fSAndroid Build Coastguard Worker import java.lang.reflect.Method; 21*795d594fSAndroid Build Coastguard Worker 22*795d594fSAndroid Build Coastguard Worker public class Trace { enableTracing(Class<?> methodClass, Method entryMethod, Method exitMethod, Method fieldAccess, Method fieldModify, Method singleStep, Thread thr)23*795d594fSAndroid Build Coastguard Worker public static native void enableTracing(Class<?> methodClass, 24*795d594fSAndroid Build Coastguard Worker Method entryMethod, 25*795d594fSAndroid Build Coastguard Worker Method exitMethod, 26*795d594fSAndroid Build Coastguard Worker Method fieldAccess, 27*795d594fSAndroid Build Coastguard Worker Method fieldModify, 28*795d594fSAndroid Build Coastguard Worker Method singleStep, 29*795d594fSAndroid Build Coastguard Worker Thread thr); disableTracing(Thread thr)30*795d594fSAndroid Build Coastguard Worker public static native void disableTracing(Thread thr); nativeEnableFramePopEvents()31*795d594fSAndroid Build Coastguard Worker public static native void nativeEnableFramePopEvents(); 32*795d594fSAndroid Build Coastguard Worker enableFieldTracing(Class<?> methodClass, Method fieldAccess, Method fieldModify, Thread thr)33*795d594fSAndroid Build Coastguard Worker public static void enableFieldTracing(Class<?> methodClass, 34*795d594fSAndroid Build Coastguard Worker Method fieldAccess, 35*795d594fSAndroid Build Coastguard Worker Method fieldModify, 36*795d594fSAndroid Build Coastguard Worker Thread thr) { 37*795d594fSAndroid Build Coastguard Worker enableTracing(methodClass, null, null, fieldAccess, fieldModify, null, thr); 38*795d594fSAndroid Build Coastguard Worker } 39*795d594fSAndroid Build Coastguard Worker enableMethodTracing(Class<?> methodClass, Method entryMethod, Method exitMethod, Thread thr)40*795d594fSAndroid Build Coastguard Worker public static void enableMethodTracing(Class<?> methodClass, 41*795d594fSAndroid Build Coastguard Worker Method entryMethod, 42*795d594fSAndroid Build Coastguard Worker Method exitMethod, 43*795d594fSAndroid Build Coastguard Worker Thread thr) { 44*795d594fSAndroid Build Coastguard Worker enableTracing(methodClass, entryMethod, exitMethod, null, null, null, thr); 45*795d594fSAndroid Build Coastguard Worker } 46*795d594fSAndroid Build Coastguard Worker enableFramePopEvents()47*795d594fSAndroid Build Coastguard Worker public static void enableFramePopEvents() { 48*795d594fSAndroid Build Coastguard Worker nativeEnableFramePopEvents(); 49*795d594fSAndroid Build Coastguard Worker } 50*795d594fSAndroid Build Coastguard Worker enableSingleStepTracing(Class<?> methodClass, Method singleStep, Thread thr)51*795d594fSAndroid Build Coastguard Worker public static void enableSingleStepTracing(Class<?> methodClass, 52*795d594fSAndroid Build Coastguard Worker Method singleStep, 53*795d594fSAndroid Build Coastguard Worker Thread thr) { 54*795d594fSAndroid Build Coastguard Worker enableTracing(methodClass, null, null, null, null, singleStep, thr); 55*795d594fSAndroid Build Coastguard Worker } 56*795d594fSAndroid Build Coastguard Worker watchFieldAccess(Field f)57*795d594fSAndroid Build Coastguard Worker public static native void watchFieldAccess(Field f); watchFieldModification(Field f)58*795d594fSAndroid Build Coastguard Worker public static native void watchFieldModification(Field f); watchAllFieldAccesses()59*795d594fSAndroid Build Coastguard Worker public static native void watchAllFieldAccesses(); watchAllFieldModifications()60*795d594fSAndroid Build Coastguard Worker public static native void watchAllFieldModifications(); 61*795d594fSAndroid Build Coastguard Worker 62*795d594fSAndroid Build Coastguard Worker // the names, arguments, and even line numbers of these functions are embedded in the tests so we 63*795d594fSAndroid Build Coastguard Worker // need to add to the bottom and not modify old ones to maintain compat. enableTracing2(Class<?> methodClass, Method entryMethod, Method exitMethod, Method fieldAccess, Method fieldModify, Method singleStep, Method ThreadStart, Method ThreadEnd, Thread thr)64*795d594fSAndroid Build Coastguard Worker public static native void enableTracing2(Class<?> methodClass, 65*795d594fSAndroid Build Coastguard Worker Method entryMethod, 66*795d594fSAndroid Build Coastguard Worker Method exitMethod, 67*795d594fSAndroid Build Coastguard Worker Method fieldAccess, 68*795d594fSAndroid Build Coastguard Worker Method fieldModify, 69*795d594fSAndroid Build Coastguard Worker Method singleStep, 70*795d594fSAndroid Build Coastguard Worker Method ThreadStart, 71*795d594fSAndroid Build Coastguard Worker Method ThreadEnd, 72*795d594fSAndroid Build Coastguard Worker Thread thr); 73*795d594fSAndroid Build Coastguard Worker } 74