blob: 129207098d2790eea4f7137a52b5301c4135fe45 [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>
18#include <memory>
19#include <stdio.h>
20
21#include "android-base/logging.h"
22#include "android-base/stringprintf.h"
23
24#include "jni.h"
25#include "jvmti.h"
26#include "scoped_local_ref.h"
27
28// Test infrastructure
29#include "jni_binder.h"
30#include "jni_helper.h"
31#include "jvmti_helper.h"
32#include "test_env.h"
33#include "ti_macros.h"
34
35namespace art {
36namespace Test993Breakpoints {
37
38extern "C" JNIEXPORT
39jobject JNICALL Java_art_Test993_constructNative(JNIEnv* env,
40 jclass klass ATTRIBUTE_UNUSED,
41 jobject target,
42 jclass clazz) {
43 jmethodID method = env->FromReflectedMethod(target);
44 if (env->ExceptionCheck()) {
45 return nullptr;
46 }
47 return env->NewObject(clazz, method);
48}
49
50extern "C" JNIEXPORT
51void JNICALL Java_art_Test993_invokeNative(JNIEnv* env,
52 jclass klass ATTRIBUTE_UNUSED,
53 jobject target,
54 jclass clazz,
55 jobject thizz) {
56 jmethodID method = env->FromReflectedMethod(target);
57 if (env->ExceptionCheck()) {
58 return;
59 }
60 if (thizz == nullptr) {
61 env->CallStaticVoidMethod(clazz, method);
62 } else {
63 env->CallVoidMethod(thizz, method);
64 }
65}
66
67} // namespace Test993Breakpoints
68} // namespace art
69