blob: 3734ce86341eeb7552e9936421e2543f31645d60 [file] [log] [blame]
Alex Lightc38c3692017-06-27 15:45:14 -07001/*
2 * Copyright (C) 2013 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
17#include <inttypes.h>
Andreas Gampe8cf9cb32017-07-19 09:28:38 -070018
19#include <cstdio>
Alex Lightc38c3692017-06-27 15:45:14 -070020#include <memory>
Alex Lightc38c3692017-06-27 15:45:14 -070021
22#include "android-base/logging.h"
23#include "android-base/stringprintf.h"
24
25#include "jni.h"
26#include "jvmti.h"
27#include "scoped_local_ref.h"
28
29// Test infrastructure
30#include "jni_binder.h"
31#include "jni_helper.h"
32#include "jvmti_helper.h"
33#include "test_env.h"
34#include "ti_macros.h"
35
36namespace art {
37namespace Test993Breakpoints {
38
39extern "C" JNIEXPORT
40jobject JNICALL Java_art_Test993_constructNative(JNIEnv* env,
41 jclass klass ATTRIBUTE_UNUSED,
42 jobject target,
43 jclass clazz) {
44 jmethodID method = env->FromReflectedMethod(target);
45 if (env->ExceptionCheck()) {
46 return nullptr;
47 }
48 return env->NewObject(clazz, method);
49}
50
51extern "C" JNIEXPORT
52void JNICALL Java_art_Test993_invokeNative(JNIEnv* env,
53 jclass klass ATTRIBUTE_UNUSED,
54 jobject target,
55 jclass clazz,
56 jobject thizz) {
57 jmethodID method = env->FromReflectedMethod(target);
58 if (env->ExceptionCheck()) {
59 return;
60 }
61 if (thizz == nullptr) {
62 env->CallStaticVoidMethod(clazz, method);
63 } else {
64 env->CallVoidMethod(thizz, method);
65 }
66}
67
68} // namespace Test993Breakpoints
69} // namespace art
70