blob: ff0fba882aaac6bc3ced93f3d23ea22f44ca0cbe [file] [log] [blame]
Alex Light49948e92016-08-11 15:35:28 -07001/* Copyright (C) 2016 The Android Open Source Project
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * This file implements interfaces from the file jvmti.h. This implementation
5 * is licensed under the same terms as the file jvmti.h. The
6 * copyright and license information for the file jvmti.h follows.
7 *
8 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
9 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10 *
11 * This code is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 2 only, as
13 * published by the Free Software Foundation. Oracle designates this
14 * particular file as subject to the "Classpath" exception as provided
15 * by Oracle in the LICENSE file that accompanied this code.
16 *
17 * This code is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * version 2 for more details (a copy is included in the LICENSE file that
21 * accompanied this code).
22 *
23 * You should have received a copy of the GNU General Public License version
24 * 2 along with this work; if not, write to the Free Software Foundation,
25 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26 *
27 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
28 * or visit www.oracle.com if you need additional information or have any
29 * questions.
30 */
31
Alex Light9c20a142016-08-23 15:05:12 -070032#include <string>
33#include <vector>
34
Alex Light49948e92016-08-11 15:35:28 -070035#include <jni.h>
Alex Light9c20a142016-08-23 15:05:12 -070036
Alex Light49948e92016-08-11 15:35:28 -070037#include "openjdkjvmti/jvmti.h"
38
Andreas Gampedb6dcb62016-09-13 09:05:59 -070039#include "art_jvmti.h"
Andreas Gampe77708d92016-10-07 11:48:21 -070040#include "base/mutex.h"
41#include "events-inl.h"
Alex Light49948e92016-08-11 15:35:28 -070042#include "jni_env_ext-inl.h"
Andreas Gampe6dee92e2016-09-12 19:58:13 -070043#include "obj_ptr-inl.h"
Alex Lighta01de592016-11-15 10:43:06 -080044#include "object_tagging.h"
Alex Light9c20a142016-08-23 15:05:12 -070045#include "runtime.h"
Andreas Gampe6dee92e2016-09-12 19:58:13 -070046#include "scoped_thread_state_change-inl.h"
Andreas Gampe77708d92016-10-07 11:48:21 -070047#include "thread-inl.h"
Alex Lighta01de592016-11-15 10:43:06 -080048#include "thread_list.h"
Andreas Gampee492ae32016-10-28 19:34:57 -070049#include "ti_class.h"
Andreas Gampeab2f0d02017-01-05 17:23:45 -080050#include "ti_field.h"
Andreas Gampeba8df692016-11-01 10:30:44 -070051#include "ti_heap.h"
Andreas Gampe3c252f02016-10-27 18:25:17 -070052#include "ti_method.h"
Andreas Gampe319dbe82017-01-09 16:42:21 -080053#include "ti_monitor.h"
Andreas Gampe50a4e492017-01-06 18:00:20 -080054#include "ti_object.h"
Andreas Gampe1bdaf732017-01-09 19:21:06 -080055#include "ti_properties.h"
Alex Lighta01de592016-11-15 10:43:06 -080056#include "ti_redefine.h"
Andreas Gampeb5eb94a2016-10-27 19:23:09 -070057#include "ti_stack.h"
Andreas Gampeaf13ab92017-01-11 20:57:40 -080058#include "ti_thread.h"
Alex Light9c20a142016-08-23 15:05:12 -070059#include "transform.h"
Alex Light49948e92016-08-11 15:35:28 -070060
61// TODO Remove this at some point by annotating all the methods. It was put in to make the skeleton
62// easier to create.
63#pragma GCC diagnostic ignored "-Wunused-parameter"
64
65namespace openjdkjvmti {
66
Andreas Gampe77708d92016-10-07 11:48:21 -070067EventHandler gEventHandler;
Andreas Gampecc13b222016-10-10 19:09:09 -070068ObjectTagTable gObjectTagTable(&gEventHandler);
Andreas Gampe6dee92e2016-09-12 19:58:13 -070069
Alex Lighte6574242016-08-17 09:56:24 -070070#define ENSURE_NON_NULL(n) \
71 do { \
72 if ((n) == nullptr) { \
73 return ERR(NULL_POINTER); \
74 } \
75 } while (false)
76
Alex Light49948e92016-08-11 15:35:28 -070077class JvmtiFunctions {
78 private:
79 static bool IsValidEnv(jvmtiEnv* env) {
80 return env != nullptr;
81 }
82
Alex Lighte6574242016-08-17 09:56:24 -070083#define ENSURE_VALID_ENV(env) \
84 do { \
85 if (!IsValidEnv(env)) { \
86 return ERR(INVALID_ENVIRONMENT); \
87 } \
88 } while (false)
89
90#define ENSURE_HAS_CAP(env, cap) \
91 do { \
92 ENSURE_VALID_ENV(env); \
93 if (ArtJvmTiEnv::AsArtJvmTiEnv(env)->capabilities.cap != 1) { \
94 return ERR(MUST_POSSESS_CAPABILITY); \
95 } \
96 } while (false)
97
Alex Light49948e92016-08-11 15:35:28 -070098 public:
99 static jvmtiError Allocate(jvmtiEnv* env, jlong size, unsigned char** mem_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700100 ENSURE_VALID_ENV(env);
101 ENSURE_NON_NULL(mem_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700102 if (size < 0) {
103 return ERR(ILLEGAL_ARGUMENT);
104 } else if (size == 0) {
105 *mem_ptr = nullptr;
106 return OK;
107 }
108 *mem_ptr = static_cast<unsigned char*>(malloc(size));
109 return (*mem_ptr != nullptr) ? OK : ERR(OUT_OF_MEMORY);
110 }
111
112 static jvmtiError Deallocate(jvmtiEnv* env, unsigned char* mem) {
Alex Lighte6574242016-08-17 09:56:24 -0700113 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -0700114 if (mem != nullptr) {
115 free(mem);
116 }
117 return OK;
118 }
119
120 static jvmtiError GetThreadState(jvmtiEnv* env, jthread thread, jint* thread_state_ptr) {
121 return ERR(NOT_IMPLEMENTED);
122 }
123
124 static jvmtiError GetCurrentThread(jvmtiEnv* env, jthread* thread_ptr) {
Andreas Gampeaf13ab92017-01-11 20:57:40 -0800125 return ThreadUtil::GetCurrentThread(env, thread_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700126 }
127
128 static jvmtiError GetAllThreads(jvmtiEnv* env, jint* threads_count_ptr, jthread** threads_ptr) {
129 return ERR(NOT_IMPLEMENTED);
130 }
131
132 static jvmtiError SuspendThread(jvmtiEnv* env, jthread thread) {
133 return ERR(NOT_IMPLEMENTED);
134 }
135
136 static jvmtiError SuspendThreadList(jvmtiEnv* env,
137 jint request_count,
138 const jthread* request_list,
139 jvmtiError* results) {
140 return ERR(NOT_IMPLEMENTED);
141 }
142
143 static jvmtiError ResumeThread(jvmtiEnv* env, jthread thread) {
144 return ERR(NOT_IMPLEMENTED);
145 }
146
147 static jvmtiError ResumeThreadList(jvmtiEnv* env,
148 jint request_count,
149 const jthread* request_list,
150 jvmtiError* results) {
151 return ERR(NOT_IMPLEMENTED);
152 }
153
154 static jvmtiError StopThread(jvmtiEnv* env, jthread thread, jobject exception) {
155 return ERR(NOT_IMPLEMENTED);
156 }
157
158 static jvmtiError InterruptThread(jvmtiEnv* env, jthread thread) {
159 return ERR(NOT_IMPLEMENTED);
160 }
161
162 static jvmtiError GetThreadInfo(jvmtiEnv* env, jthread thread, jvmtiThreadInfo* info_ptr) {
Andreas Gampeaf13ab92017-01-11 20:57:40 -0800163 return ThreadUtil::GetThreadInfo(env, thread, info_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700164 }
165
166 static jvmtiError GetOwnedMonitorInfo(jvmtiEnv* env,
167 jthread thread,
168 jint* owned_monitor_count_ptr,
169 jobject** owned_monitors_ptr) {
170 return ERR(NOT_IMPLEMENTED);
171 }
172
173 static jvmtiError GetOwnedMonitorStackDepthInfo(jvmtiEnv* env,
174 jthread thread,
175 jint* monitor_info_count_ptr,
176 jvmtiMonitorStackDepthInfo** monitor_info_ptr) {
177 return ERR(NOT_IMPLEMENTED);
178 }
179
180 static jvmtiError GetCurrentContendedMonitor(jvmtiEnv* env,
181 jthread thread,
182 jobject* monitor_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700183 return ERR(NOT_IMPLEMENTED);
Alex Light49948e92016-08-11 15:35:28 -0700184 }
185
186 static jvmtiError RunAgentThread(jvmtiEnv* env,
187 jthread thread,
188 jvmtiStartFunction proc,
189 const void* arg,
190 jint priority) {
191 return ERR(NOT_IMPLEMENTED);
192 }
193
194 static jvmtiError SetThreadLocalStorage(jvmtiEnv* env, jthread thread, const void* data) {
195 return ERR(NOT_IMPLEMENTED);
196 }
197
198 static jvmtiError GetThreadLocalStorage(jvmtiEnv* env, jthread thread, void** data_ptr) {
199 return ERR(NOT_IMPLEMENTED);
200 }
201
202 static jvmtiError GetTopThreadGroups(jvmtiEnv* env,
203 jint* group_count_ptr,
204 jthreadGroup** groups_ptr) {
205 return ERR(NOT_IMPLEMENTED);
206 }
207
208 static jvmtiError GetThreadGroupInfo(jvmtiEnv* env,
209 jthreadGroup group,
210 jvmtiThreadGroupInfo* info_ptr) {
211 return ERR(NOT_IMPLEMENTED);
212 }
213
214 static jvmtiError GetThreadGroupChildren(jvmtiEnv* env,
215 jthreadGroup group,
216 jint* thread_count_ptr,
217 jthread** threads_ptr,
218 jint* group_count_ptr,
219 jthreadGroup** groups_ptr) {
220 return ERR(NOT_IMPLEMENTED);
221 }
222
223 static jvmtiError GetStackTrace(jvmtiEnv* env,
224 jthread thread,
225 jint start_depth,
226 jint max_frame_count,
227 jvmtiFrameInfo* frame_buffer,
228 jint* count_ptr) {
Andreas Gampeb5eb94a2016-10-27 19:23:09 -0700229 return StackUtil::GetStackTrace(env,
230 thread,
231 start_depth,
232 max_frame_count,
233 frame_buffer,
234 count_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700235 }
236
237 static jvmtiError GetAllStackTraces(jvmtiEnv* env,
238 jint max_frame_count,
239 jvmtiStackInfo** stack_info_ptr,
240 jint* thread_count_ptr) {
Andreas Gampea1a27c62017-01-11 16:37:16 -0800241 return StackUtil::GetAllStackTraces(env, max_frame_count, stack_info_ptr, thread_count_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700242 }
243
244 static jvmtiError GetThreadListStackTraces(jvmtiEnv* env,
245 jint thread_count,
246 const jthread* thread_list,
247 jint max_frame_count,
248 jvmtiStackInfo** stack_info_ptr) {
Andreas Gampeeba32fb2017-01-12 17:40:05 -0800249 return StackUtil::GetThreadListStackTraces(env,
250 thread_count,
251 thread_list,
252 max_frame_count,
253 stack_info_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700254 }
255
256 static jvmtiError GetFrameCount(jvmtiEnv* env, jthread thread, jint* count_ptr) {
257 return ERR(NOT_IMPLEMENTED);
258 }
259
260 static jvmtiError PopFrame(jvmtiEnv* env, jthread thread) {
261 return ERR(NOT_IMPLEMENTED);
262 }
263
264 static jvmtiError GetFrameLocation(jvmtiEnv* env,
265 jthread thread,
266 jint depth,
267 jmethodID* method_ptr,
268 jlocation* location_ptr) {
269 return ERR(NOT_IMPLEMENTED);
270 }
271
272 static jvmtiError NotifyFramePop(jvmtiEnv* env, jthread thread, jint depth) {
273 return ERR(NOT_IMPLEMENTED);
274 }
275
276 static jvmtiError ForceEarlyReturnObject(jvmtiEnv* env, jthread thread, jobject value) {
277 return ERR(NOT_IMPLEMENTED);
278 }
279
280 static jvmtiError ForceEarlyReturnInt(jvmtiEnv* env, jthread thread, jint value) {
281 return ERR(NOT_IMPLEMENTED);
282 }
283
284 static jvmtiError ForceEarlyReturnLong(jvmtiEnv* env, jthread thread, jlong value) {
285 return ERR(NOT_IMPLEMENTED);
286 }
287
288 static jvmtiError ForceEarlyReturnFloat(jvmtiEnv* env, jthread thread, jfloat value) {
289 return ERR(NOT_IMPLEMENTED);
290 }
291
292 static jvmtiError ForceEarlyReturnDouble(jvmtiEnv* env, jthread thread, jdouble value) {
293 return ERR(NOT_IMPLEMENTED);
294 }
295
296 static jvmtiError ForceEarlyReturnVoid(jvmtiEnv* env, jthread thread) {
297 return ERR(NOT_IMPLEMENTED);
298 }
299
300 static jvmtiError FollowReferences(jvmtiEnv* env,
301 jint heap_filter,
302 jclass klass,
303 jobject initial_object,
304 const jvmtiHeapCallbacks* callbacks,
305 const void* user_data) {
Andreas Gampe70bfc8a2016-11-03 11:04:15 -0700306 HeapUtil heap_util(&gObjectTagTable);
307 return heap_util.FollowReferences(env,
308 heap_filter,
309 klass,
310 initial_object,
311 callbacks,
312 user_data);
Alex Light49948e92016-08-11 15:35:28 -0700313 }
314
315 static jvmtiError IterateThroughHeap(jvmtiEnv* env,
316 jint heap_filter,
317 jclass klass,
318 const jvmtiHeapCallbacks* callbacks,
319 const void* user_data) {
Alex Lighte6574242016-08-17 09:56:24 -0700320 ENSURE_HAS_CAP(env, can_tag_objects);
Andreas Gampee54d9922016-10-11 19:55:37 -0700321 HeapUtil heap_util(&gObjectTagTable);
322 return heap_util.IterateThroughHeap(env, heap_filter, klass, callbacks, user_data);
Alex Light49948e92016-08-11 15:35:28 -0700323 }
324
325 static jvmtiError GetTag(jvmtiEnv* env, jobject object, jlong* tag_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700326 ENSURE_HAS_CAP(env, can_tag_objects);
Andreas Gampe6dee92e2016-09-12 19:58:13 -0700327
328 JNIEnv* jni_env = GetJniEnv(env);
329 if (jni_env == nullptr) {
330 return ERR(INTERNAL);
331 }
332
333 art::ScopedObjectAccess soa(jni_env);
334 art::ObjPtr<art::mirror::Object> obj = soa.Decode<art::mirror::Object>(object);
335 if (!gObjectTagTable.GetTag(obj.Ptr(), tag_ptr)) {
336 *tag_ptr = 0;
337 }
338
339 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700340 }
341
342 static jvmtiError SetTag(jvmtiEnv* env, jobject object, jlong tag) {
Alex Lighte6574242016-08-17 09:56:24 -0700343 ENSURE_HAS_CAP(env, can_tag_objects);
344
Andreas Gampe6dee92e2016-09-12 19:58:13 -0700345 if (object == nullptr) {
346 return ERR(NULL_POINTER);
347 }
348
349 JNIEnv* jni_env = GetJniEnv(env);
350 if (jni_env == nullptr) {
351 return ERR(INTERNAL);
352 }
353
354 art::ScopedObjectAccess soa(jni_env);
355 art::ObjPtr<art::mirror::Object> obj = soa.Decode<art::mirror::Object>(object);
Andreas Gampee54eee12016-10-20 19:03:58 -0700356 gObjectTagTable.Set(obj.Ptr(), tag);
Andreas Gampe6dee92e2016-09-12 19:58:13 -0700357
358 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700359 }
360
361 static jvmtiError GetObjectsWithTags(jvmtiEnv* env,
362 jint tag_count,
363 const jlong* tags,
364 jint* count_ptr,
365 jobject** object_result_ptr,
366 jlong** tag_result_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700367 ENSURE_HAS_CAP(env, can_tag_objects);
368
Andreas Gampe5e6046b2016-10-25 12:05:53 -0700369 JNIEnv* jni_env = GetJniEnv(env);
370 if (jni_env == nullptr) {
371 return ERR(INTERNAL);
372 }
373
374 art::ScopedObjectAccess soa(jni_env);
375 return gObjectTagTable.GetTaggedObjects(env,
376 tag_count,
377 tags,
378 count_ptr,
379 object_result_ptr,
380 tag_result_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700381 }
382
383 static jvmtiError ForceGarbageCollection(jvmtiEnv* env) {
Andreas Gampe8da6d032016-10-31 19:31:03 -0700384 return HeapUtil::ForceGarbageCollection(env);
Alex Light49948e92016-08-11 15:35:28 -0700385 }
386
387 static jvmtiError IterateOverObjectsReachableFromObject(
388 jvmtiEnv* env,
389 jobject object,
390 jvmtiObjectReferenceCallback object_reference_callback,
391 const void* user_data) {
392 return ERR(NOT_IMPLEMENTED);
393 }
394
395 static jvmtiError IterateOverReachableObjects(jvmtiEnv* env,
396 jvmtiHeapRootCallback heap_root_callback,
397 jvmtiStackReferenceCallback stack_ref_callback,
398 jvmtiObjectReferenceCallback object_ref_callback,
399 const void* user_data) {
400 return ERR(NOT_IMPLEMENTED);
401 }
402
403 static jvmtiError IterateOverHeap(jvmtiEnv* env,
404 jvmtiHeapObjectFilter object_filter,
405 jvmtiHeapObjectCallback heap_object_callback,
406 const void* user_data) {
407 return ERR(NOT_IMPLEMENTED);
408 }
409
410 static jvmtiError IterateOverInstancesOfClass(jvmtiEnv* env,
411 jclass klass,
412 jvmtiHeapObjectFilter object_filter,
413 jvmtiHeapObjectCallback heap_object_callback,
414 const void* user_data) {
415 return ERR(NOT_IMPLEMENTED);
416 }
417
418 static jvmtiError GetLocalObject(jvmtiEnv* env,
419 jthread thread,
420 jint depth,
421 jint slot,
422 jobject* value_ptr) {
423 return ERR(NOT_IMPLEMENTED);
424 }
425
426 static jvmtiError GetLocalInstance(jvmtiEnv* env,
427 jthread thread,
428 jint depth,
429 jobject* value_ptr) {
430 return ERR(NOT_IMPLEMENTED);
431 }
432
433 static jvmtiError GetLocalInt(jvmtiEnv* env,
434 jthread thread,
435 jint depth,
436 jint slot,
437 jint* value_ptr) {
438 return ERR(NOT_IMPLEMENTED);
439 }
440
441 static jvmtiError GetLocalLong(jvmtiEnv* env,
442 jthread thread,
443 jint depth,
444 jint slot,
445 jlong* value_ptr) {
446 return ERR(NOT_IMPLEMENTED);
447 }
448
449 static jvmtiError GetLocalFloat(jvmtiEnv* env,
450 jthread thread,
451 jint depth,
452 jint slot,
453 jfloat* value_ptr) {
454 return ERR(NOT_IMPLEMENTED);
455 }
456
457 static jvmtiError GetLocalDouble(jvmtiEnv* env,
458 jthread thread,
459 jint depth,
460 jint slot,
461 jdouble* value_ptr) {
462 return ERR(NOT_IMPLEMENTED);
463 }
464
465 static jvmtiError SetLocalObject(jvmtiEnv* env,
466 jthread thread,
467 jint depth,
468 jint slot,
469 jobject value) {
470 return ERR(NOT_IMPLEMENTED);
471 }
472
473 static jvmtiError SetLocalInt(jvmtiEnv* env,
474 jthread thread,
475 jint depth,
476 jint slot,
477 jint value) {
478 return ERR(NOT_IMPLEMENTED);
479 }
480
481 static jvmtiError SetLocalLong(jvmtiEnv* env,
482 jthread thread,
483 jint depth,
484 jint slot,
485 jlong value) {
486 return ERR(NOT_IMPLEMENTED);
487 }
488
489 static jvmtiError SetLocalFloat(jvmtiEnv* env,
490 jthread thread,
491 jint depth,
492 jint slot,
493 jfloat value) {
494 return ERR(NOT_IMPLEMENTED);
495 }
496
497 static jvmtiError SetLocalDouble(jvmtiEnv* env,
498 jthread thread,
499 jint depth,
500 jint slot,
501 jdouble value) {
502 return ERR(NOT_IMPLEMENTED);
503 }
504
505 static jvmtiError SetBreakpoint(jvmtiEnv* env, jmethodID method, jlocation location) {
506 return ERR(NOT_IMPLEMENTED);
507 }
508
509 static jvmtiError ClearBreakpoint(jvmtiEnv* env, jmethodID method, jlocation location) {
510 return ERR(NOT_IMPLEMENTED);
511 }
512
513 static jvmtiError SetFieldAccessWatch(jvmtiEnv* env, jclass klass, jfieldID field) {
514 return ERR(NOT_IMPLEMENTED);
515 }
516
517 static jvmtiError ClearFieldAccessWatch(jvmtiEnv* env, jclass klass, jfieldID field) {
518 return ERR(NOT_IMPLEMENTED);
519 }
520
521 static jvmtiError SetFieldModificationWatch(jvmtiEnv* env, jclass klass, jfieldID field) {
522 return ERR(NOT_IMPLEMENTED);
523 }
524
525 static jvmtiError ClearFieldModificationWatch(jvmtiEnv* env, jclass klass, jfieldID field) {
526 return ERR(NOT_IMPLEMENTED);
527 }
528
529 static jvmtiError GetLoadedClasses(jvmtiEnv* env, jint* class_count_ptr, jclass** classes_ptr) {
Andreas Gampeaa8b60c2016-10-12 12:51:25 -0700530 HeapUtil heap_util(&gObjectTagTable);
531 return heap_util.GetLoadedClasses(env, class_count_ptr, classes_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700532 }
533
534 static jvmtiError GetClassLoaderClasses(jvmtiEnv* env,
535 jobject initiating_loader,
536 jint* class_count_ptr,
537 jclass** classes_ptr) {
538 return ERR(NOT_IMPLEMENTED);
539 }
540
541 static jvmtiError GetClassSignature(jvmtiEnv* env,
542 jclass klass,
543 char** signature_ptr,
544 char** generic_ptr) {
Andreas Gampee492ae32016-10-28 19:34:57 -0700545 return ClassUtil::GetClassSignature(env, klass, signature_ptr, generic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700546 }
547
548 static jvmtiError GetClassStatus(jvmtiEnv* env, jclass klass, jint* status_ptr) {
Andreas Gampeff9d2092017-01-06 09:12:49 -0800549 return ClassUtil::GetClassStatus(env, klass, status_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700550 }
551
552 static jvmtiError GetSourceFileName(jvmtiEnv* env, jclass klass, char** source_name_ptr) {
553 return ERR(NOT_IMPLEMENTED);
554 }
555
556 static jvmtiError GetClassModifiers(jvmtiEnv* env, jclass klass, jint* modifiers_ptr) {
Andreas Gampe64013e52017-01-06 13:07:19 -0800557 return ClassUtil::GetClassModifiers(env, klass, modifiers_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700558 }
559
560 static jvmtiError GetClassMethods(jvmtiEnv* env,
561 jclass klass,
562 jint* method_count_ptr,
563 jmethodID** methods_ptr) {
Andreas Gampe18fee4d2017-01-06 11:36:35 -0800564 return ClassUtil::GetClassMethods(env, klass, method_count_ptr, methods_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700565 }
566
567 static jvmtiError GetClassFields(jvmtiEnv* env,
568 jclass klass,
569 jint* field_count_ptr,
570 jfieldID** fields_ptr) {
Andreas Gampeac587272017-01-05 15:21:34 -0800571 return ClassUtil::GetClassFields(env, klass, field_count_ptr, fields_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700572 }
573
574 static jvmtiError GetImplementedInterfaces(jvmtiEnv* env,
575 jclass klass,
576 jint* interface_count_ptr,
577 jclass** interfaces_ptr) {
Andreas Gampe8b07e472017-01-06 14:20:39 -0800578 return ClassUtil::GetImplementedInterfaces(env, klass, interface_count_ptr, interfaces_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700579 }
580
581 static jvmtiError GetClassVersionNumbers(jvmtiEnv* env,
582 jclass klass,
583 jint* minor_version_ptr,
584 jint* major_version_ptr) {
585 return ERR(NOT_IMPLEMENTED);
586 }
587
588 static jvmtiError GetConstantPool(jvmtiEnv* env,
589 jclass klass,
590 jint* constant_pool_count_ptr,
591 jint* constant_pool_byte_count_ptr,
592 unsigned char** constant_pool_bytes_ptr) {
593 return ERR(NOT_IMPLEMENTED);
594 }
595
596 static jvmtiError IsInterface(jvmtiEnv* env, jclass klass, jboolean* is_interface_ptr) {
Andreas Gampe4fd66ec2017-01-05 14:42:13 -0800597 return ClassUtil::IsInterface(env, klass, is_interface_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700598 }
599
600 static jvmtiError IsArrayClass(jvmtiEnv* env,
601 jclass klass,
602 jboolean* is_array_class_ptr) {
Andreas Gampe4fd66ec2017-01-05 14:42:13 -0800603 return ClassUtil::IsArrayClass(env, klass, is_array_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700604 }
605
606 static jvmtiError IsModifiableClass(jvmtiEnv* env,
607 jclass klass,
608 jboolean* is_modifiable_class_ptr) {
Alex Lighte4a88632017-01-10 07:41:24 -0800609 return Redefiner::IsModifiableClass(env, klass, is_modifiable_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700610 }
611
612 static jvmtiError GetClassLoader(jvmtiEnv* env, jclass klass, jobject* classloader_ptr) {
Andreas Gampe8f5b6032017-01-06 15:50:55 -0800613 return ClassUtil::GetClassLoader(env, klass, classloader_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700614 }
615
616 static jvmtiError GetSourceDebugExtension(jvmtiEnv* env,
617 jclass klass,
618 char** source_debug_extension_ptr) {
619 return ERR(NOT_IMPLEMENTED);
620 }
621
622 static jvmtiError RetransformClasses(jvmtiEnv* env, jint class_count, const jclass* classes) {
623 return ERR(NOT_IMPLEMENTED);
624 }
625
626 static jvmtiError RedefineClasses(jvmtiEnv* env,
627 jint class_count,
628 const jvmtiClassDefinition* class_definitions) {
629 return ERR(NOT_IMPLEMENTED);
630 }
631
632 static jvmtiError GetObjectSize(jvmtiEnv* env, jobject object, jlong* size_ptr) {
Andreas Gampe50a4e492017-01-06 18:00:20 -0800633 return ObjectUtil::GetObjectSize(env, object, size_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700634 }
635
636 static jvmtiError GetObjectHashCode(jvmtiEnv* env, jobject object, jint* hash_code_ptr) {
Andreas Gampe50a4e492017-01-06 18:00:20 -0800637 return ObjectUtil::GetObjectHashCode(env, object, hash_code_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700638 }
639
640 static jvmtiError GetObjectMonitorUsage(jvmtiEnv* env,
641 jobject object,
642 jvmtiMonitorUsage* info_ptr) {
643 return ERR(NOT_IMPLEMENTED);
644 }
645
646 static jvmtiError GetFieldName(jvmtiEnv* env,
647 jclass klass,
648 jfieldID field,
649 char** name_ptr,
650 char** signature_ptr,
651 char** generic_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800652 return FieldUtil::GetFieldName(env, klass, field, name_ptr, signature_ptr, generic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700653 }
654
655 static jvmtiError GetFieldDeclaringClass(jvmtiEnv* env,
656 jclass klass,
657 jfieldID field,
658 jclass* declaring_class_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800659 return FieldUtil::GetFieldDeclaringClass(env, klass, field, declaring_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700660 }
661
662 static jvmtiError GetFieldModifiers(jvmtiEnv* env,
663 jclass klass,
664 jfieldID field,
665 jint* modifiers_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800666 return FieldUtil::GetFieldModifiers(env, klass, field, modifiers_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700667 }
668
669 static jvmtiError IsFieldSynthetic(jvmtiEnv* env,
670 jclass klass,
671 jfieldID field,
672 jboolean* is_synthetic_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800673 return FieldUtil::IsFieldSynthetic(env, klass, field, is_synthetic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700674 }
675
676 static jvmtiError GetMethodName(jvmtiEnv* env,
677 jmethodID method,
678 char** name_ptr,
679 char** signature_ptr,
680 char** generic_ptr) {
Andreas Gampe3c252f02016-10-27 18:25:17 -0700681 return MethodUtil::GetMethodName(env, method, name_ptr, signature_ptr, generic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700682 }
683
684 static jvmtiError GetMethodDeclaringClass(jvmtiEnv* env,
685 jmethodID method,
686 jclass* declaring_class_ptr) {
Andreas Gampe368a2082016-10-28 17:33:13 -0700687 return MethodUtil::GetMethodDeclaringClass(env, method, declaring_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700688 }
689
690 static jvmtiError GetMethodModifiers(jvmtiEnv* env,
691 jmethodID method,
692 jint* modifiers_ptr) {
Andreas Gampe36bcd4f2016-10-28 18:07:18 -0700693 return MethodUtil::GetMethodModifiers(env, method, modifiers_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700694 }
695
696 static jvmtiError GetMaxLocals(jvmtiEnv* env,
697 jmethodID method,
698 jint* max_ptr) {
Andreas Gampef71832e2017-01-09 11:38:04 -0800699 return MethodUtil::GetMaxLocals(env, method, max_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700700 }
701
702 static jvmtiError GetArgumentsSize(jvmtiEnv* env,
703 jmethodID method,
704 jint* size_ptr) {
Andreas Gampef71832e2017-01-09 11:38:04 -0800705 return MethodUtil::GetArgumentsSize(env, method, size_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700706 }
707
708 static jvmtiError GetLineNumberTable(jvmtiEnv* env,
709 jmethodID method,
710 jint* entry_count_ptr,
711 jvmtiLineNumberEntry** table_ptr) {
Andreas Gampeda3e5612016-12-13 19:00:53 -0800712 return MethodUtil::GetLineNumberTable(env, method, entry_count_ptr, table_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700713 }
714
715 static jvmtiError GetMethodLocation(jvmtiEnv* env,
716 jmethodID method,
717 jlocation* start_location_ptr,
718 jlocation* end_location_ptr) {
Andreas Gampef71832e2017-01-09 11:38:04 -0800719 return MethodUtil::GetMethodLocation(env, method, start_location_ptr, end_location_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700720 }
721
722 static jvmtiError GetLocalVariableTable(jvmtiEnv* env,
723 jmethodID method,
724 jint* entry_count_ptr,
725 jvmtiLocalVariableEntry** table_ptr) {
726 return ERR(NOT_IMPLEMENTED);
727 }
728
729 static jvmtiError GetBytecodes(jvmtiEnv* env,
730 jmethodID method,
731 jint* bytecode_count_ptr,
732 unsigned char** bytecodes_ptr) {
733 return ERR(NOT_IMPLEMENTED);
734 }
735
736 static jvmtiError IsMethodNative(jvmtiEnv* env, jmethodID method, jboolean* is_native_ptr) {
Andreas Gampefdeef522017-01-09 14:40:25 -0800737 return MethodUtil::IsMethodNative(env, method, is_native_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700738 }
739
740 static jvmtiError IsMethodSynthetic(jvmtiEnv* env, jmethodID method, jboolean* is_synthetic_ptr) {
Andreas Gampefdeef522017-01-09 14:40:25 -0800741 return MethodUtil::IsMethodSynthetic(env, method, is_synthetic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700742 }
743
744 static jvmtiError IsMethodObsolete(jvmtiEnv* env, jmethodID method, jboolean* is_obsolete_ptr) {
Andreas Gampefdeef522017-01-09 14:40:25 -0800745 return MethodUtil::IsMethodObsolete(env, method, is_obsolete_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700746 }
747
748 static jvmtiError SetNativeMethodPrefix(jvmtiEnv* env, const char* prefix) {
749 return ERR(NOT_IMPLEMENTED);
750 }
751
752 static jvmtiError SetNativeMethodPrefixes(jvmtiEnv* env, jint prefix_count, char** prefixes) {
753 return ERR(NOT_IMPLEMENTED);
754 }
755
756 static jvmtiError CreateRawMonitor(jvmtiEnv* env, const char* name, jrawMonitorID* monitor_ptr) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800757 return MonitorUtil::CreateRawMonitor(env, name, monitor_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700758 }
759
760 static jvmtiError DestroyRawMonitor(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800761 return MonitorUtil::DestroyRawMonitor(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700762 }
763
764 static jvmtiError RawMonitorEnter(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800765 return MonitorUtil::RawMonitorEnter(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700766 }
767
768 static jvmtiError RawMonitorExit(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800769 return MonitorUtil::RawMonitorExit(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700770 }
771
772 static jvmtiError RawMonitorWait(jvmtiEnv* env, jrawMonitorID monitor, jlong millis) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800773 return MonitorUtil::RawMonitorWait(env, monitor, millis);
Alex Light49948e92016-08-11 15:35:28 -0700774 }
775
776 static jvmtiError RawMonitorNotify(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800777 return MonitorUtil::RawMonitorNotify(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700778 }
779
780 static jvmtiError RawMonitorNotifyAll(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800781 return MonitorUtil::RawMonitorNotifyAll(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700782 }
783
784 static jvmtiError SetJNIFunctionTable(jvmtiEnv* env, const jniNativeInterface* function_table) {
785 return ERR(NOT_IMPLEMENTED);
786 }
787
788 static jvmtiError GetJNIFunctionTable(jvmtiEnv* env, jniNativeInterface** function_table) {
789 return ERR(NOT_IMPLEMENTED);
790 }
791
Andreas Gampe77708d92016-10-07 11:48:21 -0700792 // TODO: This will require locking, so that an agent can't remove callbacks when we're dispatching
793 // an event.
Alex Light49948e92016-08-11 15:35:28 -0700794 static jvmtiError SetEventCallbacks(jvmtiEnv* env,
795 const jvmtiEventCallbacks* callbacks,
796 jint size_of_callbacks) {
Alex Lighte6574242016-08-17 09:56:24 -0700797 ENSURE_VALID_ENV(env);
Andreas Gampe77708d92016-10-07 11:48:21 -0700798 if (size_of_callbacks < 0) {
799 return ERR(ILLEGAL_ARGUMENT);
800 }
801
802 if (callbacks == nullptr) {
803 ArtJvmTiEnv::AsArtJvmTiEnv(env)->event_callbacks.reset();
804 return ERR(NONE);
805 }
806
807 std::unique_ptr<jvmtiEventCallbacks> tmp(new jvmtiEventCallbacks());
808 memset(tmp.get(), 0, sizeof(jvmtiEventCallbacks));
809 size_t copy_size = std::min(sizeof(jvmtiEventCallbacks),
810 static_cast<size_t>(size_of_callbacks));
811 copy_size = art::RoundDown(copy_size, sizeof(void*));
812 memcpy(tmp.get(), callbacks, copy_size);
813
814 ArtJvmTiEnv::AsArtJvmTiEnv(env)->event_callbacks = std::move(tmp);
815
816 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700817 }
818
819 static jvmtiError SetEventNotificationMode(jvmtiEnv* env,
820 jvmtiEventMode mode,
821 jvmtiEvent event_type,
822 jthread event_thread,
823 ...) {
Alex Lighte6574242016-08-17 09:56:24 -0700824 ENSURE_VALID_ENV(env);
825 // TODO: Check for capabilities.
Andreas Gampe77708d92016-10-07 11:48:21 -0700826 art::Thread* art_thread = nullptr;
827 if (event_thread != nullptr) {
828 // TODO: Need non-aborting call here, to return JVMTI_ERROR_INVALID_THREAD.
829 art::ScopedObjectAccess soa(art::Thread::Current());
830 art::MutexLock mu(soa.Self(), *art::Locks::thread_list_lock_);
831 art_thread = art::Thread::FromManagedThread(soa, event_thread);
832
833 if (art_thread == nullptr || // The thread hasn't been started or is already dead.
834 art_thread->IsStillStarting()) {
835 // TODO: We may want to let the EventHandler know, so it could clean up masks, potentially.
836 return ERR(THREAD_NOT_ALIVE);
837 }
838 }
839
840 return gEventHandler.SetEvent(ArtJvmTiEnv::AsArtJvmTiEnv(env), art_thread, event_type, mode);
Alex Light49948e92016-08-11 15:35:28 -0700841 }
842
843 static jvmtiError GenerateEvents(jvmtiEnv* env, jvmtiEvent event_type) {
844 return ERR(NOT_IMPLEMENTED);
845 }
846
847 static jvmtiError GetExtensionFunctions(jvmtiEnv* env,
848 jint* extension_count_ptr,
849 jvmtiExtensionFunctionInfo** extensions) {
Andreas Gampee4c33842017-01-09 10:50:17 -0800850 // We do not have any extension functions.
851 *extension_count_ptr = 0;
852 *extensions = nullptr;
853
854 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700855 }
856
857 static jvmtiError GetExtensionEvents(jvmtiEnv* env,
858 jint* extension_count_ptr,
859 jvmtiExtensionEventInfo** extensions) {
Andreas Gampee4c33842017-01-09 10:50:17 -0800860 // We do not have any extension events.
861 *extension_count_ptr = 0;
862 *extensions = nullptr;
863
864 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700865 }
866
867 static jvmtiError SetExtensionEventCallback(jvmtiEnv* env,
868 jint extension_event_index,
869 jvmtiExtensionEvent callback) {
Andreas Gampee4c33842017-01-09 10:50:17 -0800870 // We do not have any extension events, so any call is illegal.
871 return ERR(ILLEGAL_ARGUMENT);
Alex Light49948e92016-08-11 15:35:28 -0700872 }
873
874 static jvmtiError GetPotentialCapabilities(jvmtiEnv* env, jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700875 ENSURE_VALID_ENV(env);
876 ENSURE_NON_NULL(capabilities_ptr);
877 *capabilities_ptr = kPotentialCapabilities;
878 return OK;
Alex Light49948e92016-08-11 15:35:28 -0700879 }
880
881 static jvmtiError AddCapabilities(jvmtiEnv* env, const jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700882 ENSURE_VALID_ENV(env);
883 ENSURE_NON_NULL(capabilities_ptr);
884 ArtJvmTiEnv* art_env = static_cast<ArtJvmTiEnv*>(env);
885 jvmtiError ret = OK;
886#define ADD_CAPABILITY(e) \
887 do { \
888 if (capabilities_ptr->e == 1) { \
889 if (kPotentialCapabilities.e == 1) { \
890 art_env->capabilities.e = 1;\
891 } else { \
892 ret = ERR(NOT_AVAILABLE); \
893 } \
894 } \
895 } while (false)
896
897 ADD_CAPABILITY(can_tag_objects);
898 ADD_CAPABILITY(can_generate_field_modification_events);
899 ADD_CAPABILITY(can_generate_field_access_events);
900 ADD_CAPABILITY(can_get_bytecodes);
901 ADD_CAPABILITY(can_get_synthetic_attribute);
902 ADD_CAPABILITY(can_get_owned_monitor_info);
903 ADD_CAPABILITY(can_get_current_contended_monitor);
904 ADD_CAPABILITY(can_get_monitor_info);
905 ADD_CAPABILITY(can_pop_frame);
906 ADD_CAPABILITY(can_redefine_classes);
907 ADD_CAPABILITY(can_signal_thread);
908 ADD_CAPABILITY(can_get_source_file_name);
909 ADD_CAPABILITY(can_get_line_numbers);
910 ADD_CAPABILITY(can_get_source_debug_extension);
911 ADD_CAPABILITY(can_access_local_variables);
912 ADD_CAPABILITY(can_maintain_original_method_order);
913 ADD_CAPABILITY(can_generate_single_step_events);
914 ADD_CAPABILITY(can_generate_exception_events);
915 ADD_CAPABILITY(can_generate_frame_pop_events);
916 ADD_CAPABILITY(can_generate_breakpoint_events);
917 ADD_CAPABILITY(can_suspend);
918 ADD_CAPABILITY(can_redefine_any_class);
919 ADD_CAPABILITY(can_get_current_thread_cpu_time);
920 ADD_CAPABILITY(can_get_thread_cpu_time);
921 ADD_CAPABILITY(can_generate_method_entry_events);
922 ADD_CAPABILITY(can_generate_method_exit_events);
923 ADD_CAPABILITY(can_generate_all_class_hook_events);
924 ADD_CAPABILITY(can_generate_compiled_method_load_events);
925 ADD_CAPABILITY(can_generate_monitor_events);
926 ADD_CAPABILITY(can_generate_vm_object_alloc_events);
927 ADD_CAPABILITY(can_generate_native_method_bind_events);
928 ADD_CAPABILITY(can_generate_garbage_collection_events);
929 ADD_CAPABILITY(can_generate_object_free_events);
930 ADD_CAPABILITY(can_force_early_return);
931 ADD_CAPABILITY(can_get_owned_monitor_stack_depth_info);
932 ADD_CAPABILITY(can_get_constant_pool);
933 ADD_CAPABILITY(can_set_native_method_prefix);
934 ADD_CAPABILITY(can_retransform_classes);
935 ADD_CAPABILITY(can_retransform_any_class);
936 ADD_CAPABILITY(can_generate_resource_exhaustion_heap_events);
937 ADD_CAPABILITY(can_generate_resource_exhaustion_threads_events);
938#undef ADD_CAPABILITY
939 return ret;
Alex Light49948e92016-08-11 15:35:28 -0700940 }
941
942 static jvmtiError RelinquishCapabilities(jvmtiEnv* env,
943 const jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700944 ENSURE_VALID_ENV(env);
945 ENSURE_NON_NULL(capabilities_ptr);
946 ArtJvmTiEnv* art_env = reinterpret_cast<ArtJvmTiEnv*>(env);
947#define DEL_CAPABILITY(e) \
948 do { \
949 if (capabilities_ptr->e == 1) { \
950 art_env->capabilities.e = 0;\
951 } \
952 } while (false)
953
954 DEL_CAPABILITY(can_tag_objects);
955 DEL_CAPABILITY(can_generate_field_modification_events);
956 DEL_CAPABILITY(can_generate_field_access_events);
957 DEL_CAPABILITY(can_get_bytecodes);
958 DEL_CAPABILITY(can_get_synthetic_attribute);
959 DEL_CAPABILITY(can_get_owned_monitor_info);
960 DEL_CAPABILITY(can_get_current_contended_monitor);
961 DEL_CAPABILITY(can_get_monitor_info);
962 DEL_CAPABILITY(can_pop_frame);
963 DEL_CAPABILITY(can_redefine_classes);
964 DEL_CAPABILITY(can_signal_thread);
965 DEL_CAPABILITY(can_get_source_file_name);
966 DEL_CAPABILITY(can_get_line_numbers);
967 DEL_CAPABILITY(can_get_source_debug_extension);
968 DEL_CAPABILITY(can_access_local_variables);
969 DEL_CAPABILITY(can_maintain_original_method_order);
970 DEL_CAPABILITY(can_generate_single_step_events);
971 DEL_CAPABILITY(can_generate_exception_events);
972 DEL_CAPABILITY(can_generate_frame_pop_events);
973 DEL_CAPABILITY(can_generate_breakpoint_events);
974 DEL_CAPABILITY(can_suspend);
975 DEL_CAPABILITY(can_redefine_any_class);
976 DEL_CAPABILITY(can_get_current_thread_cpu_time);
977 DEL_CAPABILITY(can_get_thread_cpu_time);
978 DEL_CAPABILITY(can_generate_method_entry_events);
979 DEL_CAPABILITY(can_generate_method_exit_events);
980 DEL_CAPABILITY(can_generate_all_class_hook_events);
981 DEL_CAPABILITY(can_generate_compiled_method_load_events);
982 DEL_CAPABILITY(can_generate_monitor_events);
983 DEL_CAPABILITY(can_generate_vm_object_alloc_events);
984 DEL_CAPABILITY(can_generate_native_method_bind_events);
985 DEL_CAPABILITY(can_generate_garbage_collection_events);
986 DEL_CAPABILITY(can_generate_object_free_events);
987 DEL_CAPABILITY(can_force_early_return);
988 DEL_CAPABILITY(can_get_owned_monitor_stack_depth_info);
989 DEL_CAPABILITY(can_get_constant_pool);
990 DEL_CAPABILITY(can_set_native_method_prefix);
991 DEL_CAPABILITY(can_retransform_classes);
992 DEL_CAPABILITY(can_retransform_any_class);
993 DEL_CAPABILITY(can_generate_resource_exhaustion_heap_events);
994 DEL_CAPABILITY(can_generate_resource_exhaustion_threads_events);
995#undef DEL_CAPABILITY
996 return OK;
Alex Light49948e92016-08-11 15:35:28 -0700997 }
998
999 static jvmtiError GetCapabilities(jvmtiEnv* env, jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001000 ENSURE_VALID_ENV(env);
1001 ENSURE_NON_NULL(capabilities_ptr);
1002 ArtJvmTiEnv* artenv = reinterpret_cast<ArtJvmTiEnv*>(env);
1003 *capabilities_ptr = artenv->capabilities;
1004 return OK;
Alex Light49948e92016-08-11 15:35:28 -07001005 }
1006
1007 static jvmtiError GetCurrentThreadCpuTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) {
1008 return ERR(NOT_IMPLEMENTED);
1009 }
1010
1011 static jvmtiError GetCurrentThreadCpuTime(jvmtiEnv* env, jlong* nanos_ptr) {
1012 return ERR(NOT_IMPLEMENTED);
1013 }
1014
1015 static jvmtiError GetThreadCpuTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) {
1016 return ERR(NOT_IMPLEMENTED);
1017 }
1018
1019 static jvmtiError GetThreadCpuTime(jvmtiEnv* env, jthread thread, jlong* nanos_ptr) {
1020 return ERR(NOT_IMPLEMENTED);
1021 }
1022
1023 static jvmtiError GetTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) {
1024 return ERR(NOT_IMPLEMENTED);
1025 }
1026
1027 static jvmtiError GetTime(jvmtiEnv* env, jlong* nanos_ptr) {
1028 return ERR(NOT_IMPLEMENTED);
1029 }
1030
1031 static jvmtiError GetAvailableProcessors(jvmtiEnv* env, jint* processor_count_ptr) {
1032 return ERR(NOT_IMPLEMENTED);
1033 }
1034
1035 static jvmtiError AddToBootstrapClassLoaderSearch(jvmtiEnv* env, const char* segment) {
1036 return ERR(NOT_IMPLEMENTED);
1037 }
1038
1039 static jvmtiError AddToSystemClassLoaderSearch(jvmtiEnv* env, const char* segment) {
1040 return ERR(NOT_IMPLEMENTED);
1041 }
1042
1043 static jvmtiError GetSystemProperties(jvmtiEnv* env, jint* count_ptr, char*** property_ptr) {
Andreas Gampe1bdaf732017-01-09 19:21:06 -08001044 return PropertiesUtil::GetSystemProperties(env, count_ptr, property_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001045 }
1046
1047 static jvmtiError GetSystemProperty(jvmtiEnv* env, const char* property, char** value_ptr) {
Andreas Gampe1bdaf732017-01-09 19:21:06 -08001048 return PropertiesUtil::GetSystemProperty(env, property, value_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001049 }
1050
1051 static jvmtiError SetSystemProperty(jvmtiEnv* env, const char* property, const char* value) {
Andreas Gampe1bdaf732017-01-09 19:21:06 -08001052 return PropertiesUtil::SetSystemProperty(env, property, value);
Alex Light49948e92016-08-11 15:35:28 -07001053 }
1054
1055 static jvmtiError GetPhase(jvmtiEnv* env, jvmtiPhase* phase_ptr) {
1056 return ERR(NOT_IMPLEMENTED);
1057 }
1058
1059 static jvmtiError DisposeEnvironment(jvmtiEnv* env) {
Alex Lighte6574242016-08-17 09:56:24 -07001060 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001061 delete env;
1062 return OK;
1063 }
1064
1065 static jvmtiError SetEnvironmentLocalStorage(jvmtiEnv* env, const void* data) {
Alex Lighte6574242016-08-17 09:56:24 -07001066 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001067 reinterpret_cast<ArtJvmTiEnv*>(env)->local_data = const_cast<void*>(data);
1068 return OK;
1069 }
1070
1071 static jvmtiError GetEnvironmentLocalStorage(jvmtiEnv* env, void** data_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001072 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001073 *data_ptr = reinterpret_cast<ArtJvmTiEnv*>(env)->local_data;
1074 return OK;
1075 }
1076
1077 static jvmtiError GetVersionNumber(jvmtiEnv* env, jint* version_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001078 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001079 *version_ptr = JVMTI_VERSION;
1080 return OK;
1081 }
1082
1083 static jvmtiError GetErrorName(jvmtiEnv* env, jvmtiError error, char** name_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001084 ENSURE_NON_NULL(name_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001085 switch (error) {
1086#define ERROR_CASE(e) case (JVMTI_ERROR_ ## e) : do { \
Alex Light41960712017-01-06 14:44:23 -08001087 jvmtiError res = CopyString(env, \
1088 "JVMTI_ERROR_"#e, \
1089 reinterpret_cast<unsigned char**>(name_ptr)); \
1090 if (res != OK) { \
1091 *name_ptr = nullptr; \
1092 return res; \
1093 } else { \
1094 return OK; \
1095 } \
Alex Light49948e92016-08-11 15:35:28 -07001096 } while (false)
1097 ERROR_CASE(NONE);
1098 ERROR_CASE(INVALID_THREAD);
1099 ERROR_CASE(INVALID_THREAD_GROUP);
1100 ERROR_CASE(INVALID_PRIORITY);
1101 ERROR_CASE(THREAD_NOT_SUSPENDED);
1102 ERROR_CASE(THREAD_NOT_ALIVE);
1103 ERROR_CASE(INVALID_OBJECT);
1104 ERROR_CASE(INVALID_CLASS);
1105 ERROR_CASE(CLASS_NOT_PREPARED);
1106 ERROR_CASE(INVALID_METHODID);
1107 ERROR_CASE(INVALID_LOCATION);
1108 ERROR_CASE(INVALID_FIELDID);
1109 ERROR_CASE(NO_MORE_FRAMES);
1110 ERROR_CASE(OPAQUE_FRAME);
1111 ERROR_CASE(TYPE_MISMATCH);
1112 ERROR_CASE(INVALID_SLOT);
1113 ERROR_CASE(DUPLICATE);
1114 ERROR_CASE(NOT_FOUND);
1115 ERROR_CASE(INVALID_MONITOR);
1116 ERROR_CASE(NOT_MONITOR_OWNER);
1117 ERROR_CASE(INTERRUPT);
1118 ERROR_CASE(INVALID_CLASS_FORMAT);
1119 ERROR_CASE(CIRCULAR_CLASS_DEFINITION);
1120 ERROR_CASE(FAILS_VERIFICATION);
1121 ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_ADDED);
1122 ERROR_CASE(UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED);
1123 ERROR_CASE(INVALID_TYPESTATE);
1124 ERROR_CASE(UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED);
1125 ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_DELETED);
1126 ERROR_CASE(UNSUPPORTED_VERSION);
1127 ERROR_CASE(NAMES_DONT_MATCH);
1128 ERROR_CASE(UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED);
1129 ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED);
1130 ERROR_CASE(UNMODIFIABLE_CLASS);
1131 ERROR_CASE(NOT_AVAILABLE);
1132 ERROR_CASE(MUST_POSSESS_CAPABILITY);
1133 ERROR_CASE(NULL_POINTER);
1134 ERROR_CASE(ABSENT_INFORMATION);
1135 ERROR_CASE(INVALID_EVENT_TYPE);
1136 ERROR_CASE(ILLEGAL_ARGUMENT);
1137 ERROR_CASE(NATIVE_METHOD);
1138 ERROR_CASE(CLASS_LOADER_UNSUPPORTED);
1139 ERROR_CASE(OUT_OF_MEMORY);
1140 ERROR_CASE(ACCESS_DENIED);
1141 ERROR_CASE(WRONG_PHASE);
1142 ERROR_CASE(INTERNAL);
1143 ERROR_CASE(UNATTACHED_THREAD);
1144 ERROR_CASE(INVALID_ENVIRONMENT);
1145#undef ERROR_CASE
1146 default: {
Alex Light41960712017-01-06 14:44:23 -08001147 jvmtiError res = CopyString(env,
1148 "JVMTI_ERROR_UNKNOWN",
1149 reinterpret_cast<unsigned char**>(name_ptr));
1150 if (res != OK) {
1151 *name_ptr = nullptr;
1152 return res;
1153 } else {
1154 return ERR(ILLEGAL_ARGUMENT);
1155 }
Alex Light49948e92016-08-11 15:35:28 -07001156 }
1157 }
1158 }
1159
1160 static jvmtiError SetVerboseFlag(jvmtiEnv* env, jvmtiVerboseFlag flag, jboolean value) {
1161 return ERR(NOT_IMPLEMENTED);
1162 }
1163
1164 static jvmtiError GetJLocationFormat(jvmtiEnv* env, jvmtiJlocationFormat* format_ptr) {
1165 return ERR(NOT_IMPLEMENTED);
1166 }
Alex Light9c20a142016-08-23 15:05:12 -07001167
1168 // TODO Remove this once events are working.
1169 static jvmtiError RetransformClassWithHook(jvmtiEnv* env,
1170 jclass klass,
1171 jvmtiEventClassFileLoadHook hook) {
1172 std::vector<jclass> classes;
1173 classes.push_back(klass);
1174 return RetransformClassesWithHook(reinterpret_cast<ArtJvmTiEnv*>(env), classes, hook);
1175 }
1176
Alex Light1e07ca62016-12-02 11:40:56 -08001177 static jvmtiError RedefineClassDirect(ArtJvmTiEnv* env,
1178 jclass klass,
1179 jint dex_size,
1180 unsigned char* dex_file) {
1181 if (!IsValidEnv(env)) {
1182 return ERR(INVALID_ENVIRONMENT);
1183 }
1184 jvmtiError ret = OK;
1185 std::string location;
1186 if ((ret = GetClassLocation(env, klass, &location)) != OK) {
1187 // TODO Do something more here? Maybe give log statements?
1188 return ret;
1189 }
1190 std::string error;
1191 ret = Redefiner::RedefineClass(env,
1192 art::Runtime::Current(),
1193 art::Thread::Current(),
1194 klass,
1195 location,
1196 dex_size,
1197 reinterpret_cast<uint8_t*>(dex_file),
1198 &error);
1199 if (ret != OK) {
Alex Light460d1b42017-01-10 15:37:17 +00001200 LOG(WARNING) << "FAILURE TO REDEFINE " << error;
Alex Light1e07ca62016-12-02 11:40:56 -08001201 }
1202 return ret;
1203 }
1204
Alex Light9c20a142016-08-23 15:05:12 -07001205 // TODO This will be called by the event handler for the art::ti Event Load Event
1206 static jvmtiError RetransformClassesWithHook(ArtJvmTiEnv* env,
1207 const std::vector<jclass>& classes,
1208 jvmtiEventClassFileLoadHook hook) {
1209 if (!IsValidEnv(env)) {
1210 return ERR(INVALID_ENVIRONMENT);
1211 }
Alex Lighta01de592016-11-15 10:43:06 -08001212 jvmtiError res = OK;
1213 std::string error;
Alex Light9c20a142016-08-23 15:05:12 -07001214 for (jclass klass : classes) {
1215 JNIEnv* jni_env = nullptr;
1216 jobject loader = nullptr;
1217 std::string name;
1218 jobject protection_domain = nullptr;
1219 jint data_len = 0;
1220 unsigned char* dex_data = nullptr;
1221 jvmtiError ret = OK;
1222 std::string location;
1223 if ((ret = GetTransformationData(env,
1224 klass,
1225 /*out*/&location,
1226 /*out*/&jni_env,
1227 /*out*/&loader,
1228 /*out*/&name,
1229 /*out*/&protection_domain,
1230 /*out*/&data_len,
1231 /*out*/&dex_data)) != OK) {
1232 // TODO Do something more here? Maybe give log statements?
1233 return ret;
1234 }
1235 jint new_data_len = 0;
1236 unsigned char* new_dex_data = nullptr;
1237 hook(env,
1238 jni_env,
1239 klass,
1240 loader,
1241 name.c_str(),
1242 protection_domain,
1243 data_len,
1244 dex_data,
1245 /*out*/&new_data_len,
1246 /*out*/&new_dex_data);
1247 // Check if anything actually changed.
1248 if ((new_data_len != 0 || new_dex_data != nullptr) && new_dex_data != dex_data) {
Alex Lighta01de592016-11-15 10:43:06 -08001249 res = Redefiner::RedefineClass(env,
1250 art::Runtime::Current(),
1251 art::Thread::Current(),
1252 klass,
1253 location,
1254 new_data_len,
1255 new_dex_data,
1256 &error);
Alex Light9c20a142016-08-23 15:05:12 -07001257 env->Deallocate(new_dex_data);
1258 }
1259 // Deallocate the old dex data.
1260 env->Deallocate(dex_data);
Alex Lighta01de592016-11-15 10:43:06 -08001261 if (res != OK) {
1262 LOG(ERROR) << "FAILURE TO REDEFINE " << error;
1263 return res;
1264 }
Alex Light9c20a142016-08-23 15:05:12 -07001265 }
1266 return OK;
1267 }
Alex Light49948e92016-08-11 15:35:28 -07001268};
1269
1270static bool IsJvmtiVersion(jint version) {
1271 return version == JVMTI_VERSION_1 ||
1272 version == JVMTI_VERSION_1_0 ||
1273 version == JVMTI_VERSION_1_1 ||
1274 version == JVMTI_VERSION_1_2 ||
1275 version == JVMTI_VERSION;
1276}
1277
1278// Creates a jvmtiEnv and returns it with the art::ti::Env that is associated with it. new_art_ti
1279// is a pointer to the uninitialized memory for an art::ti::Env.
1280static void CreateArtJvmTiEnv(art::JavaVMExt* vm, /*out*/void** new_jvmtiEnv) {
1281 struct ArtJvmTiEnv* env = new ArtJvmTiEnv(vm);
1282 *new_jvmtiEnv = env;
Andreas Gampe77708d92016-10-07 11:48:21 -07001283
1284 gEventHandler.RegisterArtJvmTiEnv(env);
Alex Light49948e92016-08-11 15:35:28 -07001285}
1286
1287// A hook that the runtime uses to allow plugins to handle GetEnv calls. It returns true and
1288// places the return value in 'env' if this library can handle the GetEnv request. Otherwise
1289// returns false and does not modify the 'env' pointer.
1290static jint GetEnvHandler(art::JavaVMExt* vm, /*out*/void** env, jint version) {
1291 if (IsJvmtiVersion(version)) {
1292 CreateArtJvmTiEnv(vm, env);
1293 return JNI_OK;
1294 } else {
1295 printf("version 0x%x is not valid!", version);
1296 return JNI_EVERSION;
1297 }
1298}
1299
1300// The plugin initialization function. This adds the jvmti environment.
1301extern "C" bool ArtPlugin_Initialize() {
Andreas Gampee08a2be2016-10-06 13:13:30 -07001302 art::Runtime* runtime = art::Runtime::Current();
1303 runtime->GetJavaVM()->AddEnvironmentHook(GetEnvHandler);
1304 runtime->AddSystemWeakHolder(&gObjectTagTable);
Alex Light49948e92016-08-11 15:35:28 -07001305 return true;
1306}
1307
1308// The actual struct holding all of the entrypoints into the jvmti interface.
1309const jvmtiInterface_1 gJvmtiInterface = {
Alex Light9c20a142016-08-23 15:05:12 -07001310 // SPECIAL FUNCTION: RetransformClassWithHook Is normally reserved1
1311 // TODO Remove once we have events working.
1312 reinterpret_cast<void*>(JvmtiFunctions::RetransformClassWithHook),
1313 // nullptr, // reserved1
Alex Light49948e92016-08-11 15:35:28 -07001314 JvmtiFunctions::SetEventNotificationMode,
Alex Light1e07ca62016-12-02 11:40:56 -08001315 // SPECIAL FUNCTION: RedefineClassDirect Is normally reserved3
1316 // TODO Remove once we have events working.
1317 reinterpret_cast<void*>(JvmtiFunctions::RedefineClassDirect),
1318 // nullptr, // reserved3
Alex Light49948e92016-08-11 15:35:28 -07001319 JvmtiFunctions::GetAllThreads,
1320 JvmtiFunctions::SuspendThread,
1321 JvmtiFunctions::ResumeThread,
1322 JvmtiFunctions::StopThread,
1323 JvmtiFunctions::InterruptThread,
1324 JvmtiFunctions::GetThreadInfo,
1325 JvmtiFunctions::GetOwnedMonitorInfo, // 10
1326 JvmtiFunctions::GetCurrentContendedMonitor,
1327 JvmtiFunctions::RunAgentThread,
1328 JvmtiFunctions::GetTopThreadGroups,
1329 JvmtiFunctions::GetThreadGroupInfo,
1330 JvmtiFunctions::GetThreadGroupChildren,
1331 JvmtiFunctions::GetFrameCount,
1332 JvmtiFunctions::GetThreadState,
1333 JvmtiFunctions::GetCurrentThread,
1334 JvmtiFunctions::GetFrameLocation,
1335 JvmtiFunctions::NotifyFramePop, // 20
1336 JvmtiFunctions::GetLocalObject,
1337 JvmtiFunctions::GetLocalInt,
1338 JvmtiFunctions::GetLocalLong,
1339 JvmtiFunctions::GetLocalFloat,
1340 JvmtiFunctions::GetLocalDouble,
1341 JvmtiFunctions::SetLocalObject,
1342 JvmtiFunctions::SetLocalInt,
1343 JvmtiFunctions::SetLocalLong,
1344 JvmtiFunctions::SetLocalFloat,
1345 JvmtiFunctions::SetLocalDouble, // 30
1346 JvmtiFunctions::CreateRawMonitor,
1347 JvmtiFunctions::DestroyRawMonitor,
1348 JvmtiFunctions::RawMonitorEnter,
1349 JvmtiFunctions::RawMonitorExit,
1350 JvmtiFunctions::RawMonitorWait,
1351 JvmtiFunctions::RawMonitorNotify,
1352 JvmtiFunctions::RawMonitorNotifyAll,
1353 JvmtiFunctions::SetBreakpoint,
1354 JvmtiFunctions::ClearBreakpoint,
1355 nullptr, // reserved40
1356 JvmtiFunctions::SetFieldAccessWatch,
1357 JvmtiFunctions::ClearFieldAccessWatch,
1358 JvmtiFunctions::SetFieldModificationWatch,
1359 JvmtiFunctions::ClearFieldModificationWatch,
1360 JvmtiFunctions::IsModifiableClass,
1361 JvmtiFunctions::Allocate,
1362 JvmtiFunctions::Deallocate,
1363 JvmtiFunctions::GetClassSignature,
1364 JvmtiFunctions::GetClassStatus,
1365 JvmtiFunctions::GetSourceFileName, // 50
1366 JvmtiFunctions::GetClassModifiers,
1367 JvmtiFunctions::GetClassMethods,
1368 JvmtiFunctions::GetClassFields,
1369 JvmtiFunctions::GetImplementedInterfaces,
1370 JvmtiFunctions::IsInterface,
1371 JvmtiFunctions::IsArrayClass,
1372 JvmtiFunctions::GetClassLoader,
1373 JvmtiFunctions::GetObjectHashCode,
1374 JvmtiFunctions::GetObjectMonitorUsage,
1375 JvmtiFunctions::GetFieldName, // 60
1376 JvmtiFunctions::GetFieldDeclaringClass,
1377 JvmtiFunctions::GetFieldModifiers,
1378 JvmtiFunctions::IsFieldSynthetic,
1379 JvmtiFunctions::GetMethodName,
1380 JvmtiFunctions::GetMethodDeclaringClass,
1381 JvmtiFunctions::GetMethodModifiers,
1382 nullptr, // reserved67
1383 JvmtiFunctions::GetMaxLocals,
1384 JvmtiFunctions::GetArgumentsSize,
1385 JvmtiFunctions::GetLineNumberTable, // 70
1386 JvmtiFunctions::GetMethodLocation,
1387 JvmtiFunctions::GetLocalVariableTable,
1388 JvmtiFunctions::SetNativeMethodPrefix,
1389 JvmtiFunctions::SetNativeMethodPrefixes,
1390 JvmtiFunctions::GetBytecodes,
1391 JvmtiFunctions::IsMethodNative,
1392 JvmtiFunctions::IsMethodSynthetic,
1393 JvmtiFunctions::GetLoadedClasses,
1394 JvmtiFunctions::GetClassLoaderClasses,
1395 JvmtiFunctions::PopFrame, // 80
1396 JvmtiFunctions::ForceEarlyReturnObject,
1397 JvmtiFunctions::ForceEarlyReturnInt,
1398 JvmtiFunctions::ForceEarlyReturnLong,
1399 JvmtiFunctions::ForceEarlyReturnFloat,
1400 JvmtiFunctions::ForceEarlyReturnDouble,
1401 JvmtiFunctions::ForceEarlyReturnVoid,
1402 JvmtiFunctions::RedefineClasses,
1403 JvmtiFunctions::GetVersionNumber,
1404 JvmtiFunctions::GetCapabilities,
1405 JvmtiFunctions::GetSourceDebugExtension, // 90
1406 JvmtiFunctions::IsMethodObsolete,
1407 JvmtiFunctions::SuspendThreadList,
1408 JvmtiFunctions::ResumeThreadList,
1409 nullptr, // reserved94
1410 nullptr, // reserved95
1411 nullptr, // reserved96
1412 nullptr, // reserved97
1413 nullptr, // reserved98
1414 nullptr, // reserved99
1415 JvmtiFunctions::GetAllStackTraces, // 100
1416 JvmtiFunctions::GetThreadListStackTraces,
1417 JvmtiFunctions::GetThreadLocalStorage,
1418 JvmtiFunctions::SetThreadLocalStorage,
1419 JvmtiFunctions::GetStackTrace,
1420 nullptr, // reserved105
1421 JvmtiFunctions::GetTag,
1422 JvmtiFunctions::SetTag,
1423 JvmtiFunctions::ForceGarbageCollection,
1424 JvmtiFunctions::IterateOverObjectsReachableFromObject,
1425 JvmtiFunctions::IterateOverReachableObjects, // 110
1426 JvmtiFunctions::IterateOverHeap,
1427 JvmtiFunctions::IterateOverInstancesOfClass,
1428 nullptr, // reserved113
1429 JvmtiFunctions::GetObjectsWithTags,
1430 JvmtiFunctions::FollowReferences,
1431 JvmtiFunctions::IterateThroughHeap,
1432 nullptr, // reserved117
1433 nullptr, // reserved118
1434 nullptr, // reserved119
1435 JvmtiFunctions::SetJNIFunctionTable, // 120
1436 JvmtiFunctions::GetJNIFunctionTable,
1437 JvmtiFunctions::SetEventCallbacks,
1438 JvmtiFunctions::GenerateEvents,
1439 JvmtiFunctions::GetExtensionFunctions,
1440 JvmtiFunctions::GetExtensionEvents,
1441 JvmtiFunctions::SetExtensionEventCallback,
1442 JvmtiFunctions::DisposeEnvironment,
1443 JvmtiFunctions::GetErrorName,
1444 JvmtiFunctions::GetJLocationFormat,
1445 JvmtiFunctions::GetSystemProperties, // 130
1446 JvmtiFunctions::GetSystemProperty,
1447 JvmtiFunctions::SetSystemProperty,
1448 JvmtiFunctions::GetPhase,
1449 JvmtiFunctions::GetCurrentThreadCpuTimerInfo,
1450 JvmtiFunctions::GetCurrentThreadCpuTime,
1451 JvmtiFunctions::GetThreadCpuTimerInfo,
1452 JvmtiFunctions::GetThreadCpuTime,
1453 JvmtiFunctions::GetTimerInfo,
1454 JvmtiFunctions::GetTime,
1455 JvmtiFunctions::GetPotentialCapabilities, // 140
1456 nullptr, // reserved141
1457 JvmtiFunctions::AddCapabilities,
1458 JvmtiFunctions::RelinquishCapabilities,
1459 JvmtiFunctions::GetAvailableProcessors,
1460 JvmtiFunctions::GetClassVersionNumbers,
1461 JvmtiFunctions::GetConstantPool,
1462 JvmtiFunctions::GetEnvironmentLocalStorage,
1463 JvmtiFunctions::SetEnvironmentLocalStorage,
1464 JvmtiFunctions::AddToBootstrapClassLoaderSearch,
1465 JvmtiFunctions::SetVerboseFlag, // 150
1466 JvmtiFunctions::AddToSystemClassLoaderSearch,
1467 JvmtiFunctions::RetransformClasses,
1468 JvmtiFunctions::GetOwnedMonitorStackDepthInfo,
1469 JvmtiFunctions::GetObjectSize,
1470 JvmtiFunctions::GetLocalInstance,
1471};
1472
1473}; // namespace openjdkjvmti