blob: 53ff8eae345ac716c57d72bc63c186e916e8ad43 [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) {
Andreas Gampe72c19832017-01-12 13:22:16 -0800121 return ThreadUtil::GetThreadState(env, thread, thread_state_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700122 }
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) {
Andreas Gampe85807442017-01-13 14:40:58 -0800129 return ThreadUtil::GetAllThreads(env, threads_count_ptr, threads_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700130 }
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) {
Nicolas Geoffray87071bf2017-01-16 10:27:16 +0000205 return ERR(NOT_IMPLEMENTED);
Alex Light49948e92016-08-11 15:35:28 -0700206 }
207
208 static jvmtiError GetThreadGroupInfo(jvmtiEnv* env,
209 jthreadGroup group,
210 jvmtiThreadGroupInfo* info_ptr) {
Nicolas Geoffray87071bf2017-01-16 10:27:16 +0000211 return ERR(NOT_IMPLEMENTED);
Alex Light49948e92016-08-11 15:35:28 -0700212 }
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) {
Nicolas Geoffray87071bf2017-01-16 10:27:16 +0000220 return ERR(NOT_IMPLEMENTED);
Alex Light49948e92016-08-11 15:35:28 -0700221 }
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) {
Andreas Gampef6f3b5f2017-01-13 09:21:42 -0800257 return StackUtil::GetFrameCount(env, thread, count_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700258 }
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) {
Andreas Gampef6f3b5f2017-01-13 09:21:42 -0800269 return StackUtil::GetFrameLocation(env, thread, depth, method_ptr, location_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700270 }
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) {
Andreas Gampe70f16392017-01-16 14:20:10 -0800538 return ClassUtil::GetClassLoaderClasses(env, initiating_loader, class_count_ptr, classes_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700539 }
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) {
Alex Light0e692732017-01-10 15:00:05 -0800629 std::string error_msg;
630 jvmtiError res = Redefiner::RedefineClasses(ArtJvmTiEnv::AsArtJvmTiEnv(env),
631 art::Runtime::Current(),
632 art::Thread::Current(),
633 class_count,
634 class_definitions,
635 &error_msg);
636 if (res != OK) {
637 LOG(WARNING) << "FAILURE TO REDEFINE " << error_msg;
638 }
639 return res;
Alex Light49948e92016-08-11 15:35:28 -0700640 }
641
642 static jvmtiError GetObjectSize(jvmtiEnv* env, jobject object, jlong* size_ptr) {
Andreas Gampe50a4e492017-01-06 18:00:20 -0800643 return ObjectUtil::GetObjectSize(env, object, size_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700644 }
645
646 static jvmtiError GetObjectHashCode(jvmtiEnv* env, jobject object, jint* hash_code_ptr) {
Andreas Gampe50a4e492017-01-06 18:00:20 -0800647 return ObjectUtil::GetObjectHashCode(env, object, hash_code_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700648 }
649
650 static jvmtiError GetObjectMonitorUsage(jvmtiEnv* env,
651 jobject object,
652 jvmtiMonitorUsage* info_ptr) {
653 return ERR(NOT_IMPLEMENTED);
654 }
655
656 static jvmtiError GetFieldName(jvmtiEnv* env,
657 jclass klass,
658 jfieldID field,
659 char** name_ptr,
660 char** signature_ptr,
661 char** generic_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800662 return FieldUtil::GetFieldName(env, klass, field, name_ptr, signature_ptr, generic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700663 }
664
665 static jvmtiError GetFieldDeclaringClass(jvmtiEnv* env,
666 jclass klass,
667 jfieldID field,
668 jclass* declaring_class_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800669 return FieldUtil::GetFieldDeclaringClass(env, klass, field, declaring_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700670 }
671
672 static jvmtiError GetFieldModifiers(jvmtiEnv* env,
673 jclass klass,
674 jfieldID field,
675 jint* modifiers_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800676 return FieldUtil::GetFieldModifiers(env, klass, field, modifiers_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700677 }
678
679 static jvmtiError IsFieldSynthetic(jvmtiEnv* env,
680 jclass klass,
681 jfieldID field,
682 jboolean* is_synthetic_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800683 return FieldUtil::IsFieldSynthetic(env, klass, field, is_synthetic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700684 }
685
686 static jvmtiError GetMethodName(jvmtiEnv* env,
687 jmethodID method,
688 char** name_ptr,
689 char** signature_ptr,
690 char** generic_ptr) {
Andreas Gampe3c252f02016-10-27 18:25:17 -0700691 return MethodUtil::GetMethodName(env, method, name_ptr, signature_ptr, generic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700692 }
693
694 static jvmtiError GetMethodDeclaringClass(jvmtiEnv* env,
695 jmethodID method,
696 jclass* declaring_class_ptr) {
Andreas Gampe368a2082016-10-28 17:33:13 -0700697 return MethodUtil::GetMethodDeclaringClass(env, method, declaring_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700698 }
699
700 static jvmtiError GetMethodModifiers(jvmtiEnv* env,
701 jmethodID method,
702 jint* modifiers_ptr) {
Andreas Gampe36bcd4f2016-10-28 18:07:18 -0700703 return MethodUtil::GetMethodModifiers(env, method, modifiers_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700704 }
705
706 static jvmtiError GetMaxLocals(jvmtiEnv* env,
707 jmethodID method,
708 jint* max_ptr) {
Andreas Gampef71832e2017-01-09 11:38:04 -0800709 return MethodUtil::GetMaxLocals(env, method, max_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700710 }
711
712 static jvmtiError GetArgumentsSize(jvmtiEnv* env,
713 jmethodID method,
714 jint* size_ptr) {
Andreas Gampef71832e2017-01-09 11:38:04 -0800715 return MethodUtil::GetArgumentsSize(env, method, size_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700716 }
717
718 static jvmtiError GetLineNumberTable(jvmtiEnv* env,
719 jmethodID method,
720 jint* entry_count_ptr,
721 jvmtiLineNumberEntry** table_ptr) {
Andreas Gampeda3e5612016-12-13 19:00:53 -0800722 return MethodUtil::GetLineNumberTable(env, method, entry_count_ptr, table_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700723 }
724
725 static jvmtiError GetMethodLocation(jvmtiEnv* env,
726 jmethodID method,
727 jlocation* start_location_ptr,
728 jlocation* end_location_ptr) {
Andreas Gampef71832e2017-01-09 11:38:04 -0800729 return MethodUtil::GetMethodLocation(env, method, start_location_ptr, end_location_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700730 }
731
732 static jvmtiError GetLocalVariableTable(jvmtiEnv* env,
733 jmethodID method,
734 jint* entry_count_ptr,
735 jvmtiLocalVariableEntry** table_ptr) {
736 return ERR(NOT_IMPLEMENTED);
737 }
738
739 static jvmtiError GetBytecodes(jvmtiEnv* env,
740 jmethodID method,
741 jint* bytecode_count_ptr,
742 unsigned char** bytecodes_ptr) {
743 return ERR(NOT_IMPLEMENTED);
744 }
745
746 static jvmtiError IsMethodNative(jvmtiEnv* env, jmethodID method, jboolean* is_native_ptr) {
Andreas Gampefdeef522017-01-09 14:40:25 -0800747 return MethodUtil::IsMethodNative(env, method, is_native_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700748 }
749
750 static jvmtiError IsMethodSynthetic(jvmtiEnv* env, jmethodID method, jboolean* is_synthetic_ptr) {
Andreas Gampefdeef522017-01-09 14:40:25 -0800751 return MethodUtil::IsMethodSynthetic(env, method, is_synthetic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700752 }
753
754 static jvmtiError IsMethodObsolete(jvmtiEnv* env, jmethodID method, jboolean* is_obsolete_ptr) {
Andreas Gampefdeef522017-01-09 14:40:25 -0800755 return MethodUtil::IsMethodObsolete(env, method, is_obsolete_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700756 }
757
758 static jvmtiError SetNativeMethodPrefix(jvmtiEnv* env, const char* prefix) {
759 return ERR(NOT_IMPLEMENTED);
760 }
761
762 static jvmtiError SetNativeMethodPrefixes(jvmtiEnv* env, jint prefix_count, char** prefixes) {
763 return ERR(NOT_IMPLEMENTED);
764 }
765
766 static jvmtiError CreateRawMonitor(jvmtiEnv* env, const char* name, jrawMonitorID* monitor_ptr) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800767 return MonitorUtil::CreateRawMonitor(env, name, monitor_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700768 }
769
770 static jvmtiError DestroyRawMonitor(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800771 return MonitorUtil::DestroyRawMonitor(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700772 }
773
774 static jvmtiError RawMonitorEnter(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800775 return MonitorUtil::RawMonitorEnter(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700776 }
777
778 static jvmtiError RawMonitorExit(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800779 return MonitorUtil::RawMonitorExit(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700780 }
781
782 static jvmtiError RawMonitorWait(jvmtiEnv* env, jrawMonitorID monitor, jlong millis) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800783 return MonitorUtil::RawMonitorWait(env, monitor, millis);
Alex Light49948e92016-08-11 15:35:28 -0700784 }
785
786 static jvmtiError RawMonitorNotify(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800787 return MonitorUtil::RawMonitorNotify(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700788 }
789
790 static jvmtiError RawMonitorNotifyAll(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800791 return MonitorUtil::RawMonitorNotifyAll(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700792 }
793
794 static jvmtiError SetJNIFunctionTable(jvmtiEnv* env, const jniNativeInterface* function_table) {
795 return ERR(NOT_IMPLEMENTED);
796 }
797
798 static jvmtiError GetJNIFunctionTable(jvmtiEnv* env, jniNativeInterface** function_table) {
799 return ERR(NOT_IMPLEMENTED);
800 }
801
Andreas Gampe77708d92016-10-07 11:48:21 -0700802 // TODO: This will require locking, so that an agent can't remove callbacks when we're dispatching
803 // an event.
Alex Light49948e92016-08-11 15:35:28 -0700804 static jvmtiError SetEventCallbacks(jvmtiEnv* env,
805 const jvmtiEventCallbacks* callbacks,
806 jint size_of_callbacks) {
Alex Lighte6574242016-08-17 09:56:24 -0700807 ENSURE_VALID_ENV(env);
Andreas Gampe77708d92016-10-07 11:48:21 -0700808 if (size_of_callbacks < 0) {
809 return ERR(ILLEGAL_ARGUMENT);
810 }
811
812 if (callbacks == nullptr) {
813 ArtJvmTiEnv::AsArtJvmTiEnv(env)->event_callbacks.reset();
814 return ERR(NONE);
815 }
816
817 std::unique_ptr<jvmtiEventCallbacks> tmp(new jvmtiEventCallbacks());
818 memset(tmp.get(), 0, sizeof(jvmtiEventCallbacks));
819 size_t copy_size = std::min(sizeof(jvmtiEventCallbacks),
820 static_cast<size_t>(size_of_callbacks));
821 copy_size = art::RoundDown(copy_size, sizeof(void*));
822 memcpy(tmp.get(), callbacks, copy_size);
823
824 ArtJvmTiEnv::AsArtJvmTiEnv(env)->event_callbacks = std::move(tmp);
825
826 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700827 }
828
829 static jvmtiError SetEventNotificationMode(jvmtiEnv* env,
830 jvmtiEventMode mode,
831 jvmtiEvent event_type,
832 jthread event_thread,
833 ...) {
Alex Lighte6574242016-08-17 09:56:24 -0700834 ENSURE_VALID_ENV(env);
835 // TODO: Check for capabilities.
Andreas Gampe77708d92016-10-07 11:48:21 -0700836 art::Thread* art_thread = nullptr;
837 if (event_thread != nullptr) {
838 // TODO: Need non-aborting call here, to return JVMTI_ERROR_INVALID_THREAD.
839 art::ScopedObjectAccess soa(art::Thread::Current());
840 art::MutexLock mu(soa.Self(), *art::Locks::thread_list_lock_);
841 art_thread = art::Thread::FromManagedThread(soa, event_thread);
842
843 if (art_thread == nullptr || // The thread hasn't been started or is already dead.
844 art_thread->IsStillStarting()) {
845 // TODO: We may want to let the EventHandler know, so it could clean up masks, potentially.
846 return ERR(THREAD_NOT_ALIVE);
847 }
848 }
849
850 return gEventHandler.SetEvent(ArtJvmTiEnv::AsArtJvmTiEnv(env), art_thread, event_type, mode);
Alex Light49948e92016-08-11 15:35:28 -0700851 }
852
853 static jvmtiError GenerateEvents(jvmtiEnv* env, jvmtiEvent event_type) {
854 return ERR(NOT_IMPLEMENTED);
855 }
856
857 static jvmtiError GetExtensionFunctions(jvmtiEnv* env,
858 jint* extension_count_ptr,
859 jvmtiExtensionFunctionInfo** extensions) {
Andreas Gampee4c33842017-01-09 10:50:17 -0800860 // We do not have any extension functions.
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 GetExtensionEvents(jvmtiEnv* env,
868 jint* extension_count_ptr,
869 jvmtiExtensionEventInfo** extensions) {
Andreas Gampee4c33842017-01-09 10:50:17 -0800870 // We do not have any extension events.
871 *extension_count_ptr = 0;
872 *extensions = nullptr;
873
874 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700875 }
876
877 static jvmtiError SetExtensionEventCallback(jvmtiEnv* env,
878 jint extension_event_index,
879 jvmtiExtensionEvent callback) {
Andreas Gampee4c33842017-01-09 10:50:17 -0800880 // We do not have any extension events, so any call is illegal.
881 return ERR(ILLEGAL_ARGUMENT);
Alex Light49948e92016-08-11 15:35:28 -0700882 }
883
884 static jvmtiError GetPotentialCapabilities(jvmtiEnv* env, jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700885 ENSURE_VALID_ENV(env);
886 ENSURE_NON_NULL(capabilities_ptr);
887 *capabilities_ptr = kPotentialCapabilities;
888 return OK;
Alex Light49948e92016-08-11 15:35:28 -0700889 }
890
891 static jvmtiError AddCapabilities(jvmtiEnv* env, const jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700892 ENSURE_VALID_ENV(env);
893 ENSURE_NON_NULL(capabilities_ptr);
894 ArtJvmTiEnv* art_env = static_cast<ArtJvmTiEnv*>(env);
895 jvmtiError ret = OK;
896#define ADD_CAPABILITY(e) \
897 do { \
898 if (capabilities_ptr->e == 1) { \
899 if (kPotentialCapabilities.e == 1) { \
900 art_env->capabilities.e = 1;\
901 } else { \
902 ret = ERR(NOT_AVAILABLE); \
903 } \
904 } \
905 } while (false)
906
907 ADD_CAPABILITY(can_tag_objects);
908 ADD_CAPABILITY(can_generate_field_modification_events);
909 ADD_CAPABILITY(can_generate_field_access_events);
910 ADD_CAPABILITY(can_get_bytecodes);
911 ADD_CAPABILITY(can_get_synthetic_attribute);
912 ADD_CAPABILITY(can_get_owned_monitor_info);
913 ADD_CAPABILITY(can_get_current_contended_monitor);
914 ADD_CAPABILITY(can_get_monitor_info);
915 ADD_CAPABILITY(can_pop_frame);
916 ADD_CAPABILITY(can_redefine_classes);
917 ADD_CAPABILITY(can_signal_thread);
918 ADD_CAPABILITY(can_get_source_file_name);
919 ADD_CAPABILITY(can_get_line_numbers);
920 ADD_CAPABILITY(can_get_source_debug_extension);
921 ADD_CAPABILITY(can_access_local_variables);
922 ADD_CAPABILITY(can_maintain_original_method_order);
923 ADD_CAPABILITY(can_generate_single_step_events);
924 ADD_CAPABILITY(can_generate_exception_events);
925 ADD_CAPABILITY(can_generate_frame_pop_events);
926 ADD_CAPABILITY(can_generate_breakpoint_events);
927 ADD_CAPABILITY(can_suspend);
928 ADD_CAPABILITY(can_redefine_any_class);
929 ADD_CAPABILITY(can_get_current_thread_cpu_time);
930 ADD_CAPABILITY(can_get_thread_cpu_time);
931 ADD_CAPABILITY(can_generate_method_entry_events);
932 ADD_CAPABILITY(can_generate_method_exit_events);
933 ADD_CAPABILITY(can_generate_all_class_hook_events);
934 ADD_CAPABILITY(can_generate_compiled_method_load_events);
935 ADD_CAPABILITY(can_generate_monitor_events);
936 ADD_CAPABILITY(can_generate_vm_object_alloc_events);
937 ADD_CAPABILITY(can_generate_native_method_bind_events);
938 ADD_CAPABILITY(can_generate_garbage_collection_events);
939 ADD_CAPABILITY(can_generate_object_free_events);
940 ADD_CAPABILITY(can_force_early_return);
941 ADD_CAPABILITY(can_get_owned_monitor_stack_depth_info);
942 ADD_CAPABILITY(can_get_constant_pool);
943 ADD_CAPABILITY(can_set_native_method_prefix);
944 ADD_CAPABILITY(can_retransform_classes);
945 ADD_CAPABILITY(can_retransform_any_class);
946 ADD_CAPABILITY(can_generate_resource_exhaustion_heap_events);
947 ADD_CAPABILITY(can_generate_resource_exhaustion_threads_events);
948#undef ADD_CAPABILITY
949 return ret;
Alex Light49948e92016-08-11 15:35:28 -0700950 }
951
952 static jvmtiError RelinquishCapabilities(jvmtiEnv* env,
953 const jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700954 ENSURE_VALID_ENV(env);
955 ENSURE_NON_NULL(capabilities_ptr);
956 ArtJvmTiEnv* art_env = reinterpret_cast<ArtJvmTiEnv*>(env);
957#define DEL_CAPABILITY(e) \
958 do { \
959 if (capabilities_ptr->e == 1) { \
960 art_env->capabilities.e = 0;\
961 } \
962 } while (false)
963
964 DEL_CAPABILITY(can_tag_objects);
965 DEL_CAPABILITY(can_generate_field_modification_events);
966 DEL_CAPABILITY(can_generate_field_access_events);
967 DEL_CAPABILITY(can_get_bytecodes);
968 DEL_CAPABILITY(can_get_synthetic_attribute);
969 DEL_CAPABILITY(can_get_owned_monitor_info);
970 DEL_CAPABILITY(can_get_current_contended_monitor);
971 DEL_CAPABILITY(can_get_monitor_info);
972 DEL_CAPABILITY(can_pop_frame);
973 DEL_CAPABILITY(can_redefine_classes);
974 DEL_CAPABILITY(can_signal_thread);
975 DEL_CAPABILITY(can_get_source_file_name);
976 DEL_CAPABILITY(can_get_line_numbers);
977 DEL_CAPABILITY(can_get_source_debug_extension);
978 DEL_CAPABILITY(can_access_local_variables);
979 DEL_CAPABILITY(can_maintain_original_method_order);
980 DEL_CAPABILITY(can_generate_single_step_events);
981 DEL_CAPABILITY(can_generate_exception_events);
982 DEL_CAPABILITY(can_generate_frame_pop_events);
983 DEL_CAPABILITY(can_generate_breakpoint_events);
984 DEL_CAPABILITY(can_suspend);
985 DEL_CAPABILITY(can_redefine_any_class);
986 DEL_CAPABILITY(can_get_current_thread_cpu_time);
987 DEL_CAPABILITY(can_get_thread_cpu_time);
988 DEL_CAPABILITY(can_generate_method_entry_events);
989 DEL_CAPABILITY(can_generate_method_exit_events);
990 DEL_CAPABILITY(can_generate_all_class_hook_events);
991 DEL_CAPABILITY(can_generate_compiled_method_load_events);
992 DEL_CAPABILITY(can_generate_monitor_events);
993 DEL_CAPABILITY(can_generate_vm_object_alloc_events);
994 DEL_CAPABILITY(can_generate_native_method_bind_events);
995 DEL_CAPABILITY(can_generate_garbage_collection_events);
996 DEL_CAPABILITY(can_generate_object_free_events);
997 DEL_CAPABILITY(can_force_early_return);
998 DEL_CAPABILITY(can_get_owned_monitor_stack_depth_info);
999 DEL_CAPABILITY(can_get_constant_pool);
1000 DEL_CAPABILITY(can_set_native_method_prefix);
1001 DEL_CAPABILITY(can_retransform_classes);
1002 DEL_CAPABILITY(can_retransform_any_class);
1003 DEL_CAPABILITY(can_generate_resource_exhaustion_heap_events);
1004 DEL_CAPABILITY(can_generate_resource_exhaustion_threads_events);
1005#undef DEL_CAPABILITY
1006 return OK;
Alex Light49948e92016-08-11 15:35:28 -07001007 }
1008
1009 static jvmtiError GetCapabilities(jvmtiEnv* env, jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001010 ENSURE_VALID_ENV(env);
1011 ENSURE_NON_NULL(capabilities_ptr);
1012 ArtJvmTiEnv* artenv = reinterpret_cast<ArtJvmTiEnv*>(env);
1013 *capabilities_ptr = artenv->capabilities;
1014 return OK;
Alex Light49948e92016-08-11 15:35:28 -07001015 }
1016
1017 static jvmtiError GetCurrentThreadCpuTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) {
1018 return ERR(NOT_IMPLEMENTED);
1019 }
1020
1021 static jvmtiError GetCurrentThreadCpuTime(jvmtiEnv* env, jlong* nanos_ptr) {
1022 return ERR(NOT_IMPLEMENTED);
1023 }
1024
1025 static jvmtiError GetThreadCpuTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) {
1026 return ERR(NOT_IMPLEMENTED);
1027 }
1028
1029 static jvmtiError GetThreadCpuTime(jvmtiEnv* env, jthread thread, jlong* nanos_ptr) {
1030 return ERR(NOT_IMPLEMENTED);
1031 }
1032
1033 static jvmtiError GetTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) {
1034 return ERR(NOT_IMPLEMENTED);
1035 }
1036
1037 static jvmtiError GetTime(jvmtiEnv* env, jlong* nanos_ptr) {
1038 return ERR(NOT_IMPLEMENTED);
1039 }
1040
1041 static jvmtiError GetAvailableProcessors(jvmtiEnv* env, jint* processor_count_ptr) {
1042 return ERR(NOT_IMPLEMENTED);
1043 }
1044
1045 static jvmtiError AddToBootstrapClassLoaderSearch(jvmtiEnv* env, const char* segment) {
1046 return ERR(NOT_IMPLEMENTED);
1047 }
1048
1049 static jvmtiError AddToSystemClassLoaderSearch(jvmtiEnv* env, const char* segment) {
1050 return ERR(NOT_IMPLEMENTED);
1051 }
1052
1053 static jvmtiError GetSystemProperties(jvmtiEnv* env, jint* count_ptr, char*** property_ptr) {
Andreas Gampe1bdaf732017-01-09 19:21:06 -08001054 return PropertiesUtil::GetSystemProperties(env, count_ptr, property_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001055 }
1056
1057 static jvmtiError GetSystemProperty(jvmtiEnv* env, const char* property, char** value_ptr) {
Andreas Gampe1bdaf732017-01-09 19:21:06 -08001058 return PropertiesUtil::GetSystemProperty(env, property, value_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001059 }
1060
1061 static jvmtiError SetSystemProperty(jvmtiEnv* env, const char* property, const char* value) {
Andreas Gampe1bdaf732017-01-09 19:21:06 -08001062 return PropertiesUtil::SetSystemProperty(env, property, value);
Alex Light49948e92016-08-11 15:35:28 -07001063 }
1064
1065 static jvmtiError GetPhase(jvmtiEnv* env, jvmtiPhase* phase_ptr) {
1066 return ERR(NOT_IMPLEMENTED);
1067 }
1068
1069 static jvmtiError DisposeEnvironment(jvmtiEnv* env) {
Alex Lighte6574242016-08-17 09:56:24 -07001070 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001071 delete env;
1072 return OK;
1073 }
1074
1075 static jvmtiError SetEnvironmentLocalStorage(jvmtiEnv* env, const void* data) {
Alex Lighte6574242016-08-17 09:56:24 -07001076 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001077 reinterpret_cast<ArtJvmTiEnv*>(env)->local_data = const_cast<void*>(data);
1078 return OK;
1079 }
1080
1081 static jvmtiError GetEnvironmentLocalStorage(jvmtiEnv* env, void** data_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001082 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001083 *data_ptr = reinterpret_cast<ArtJvmTiEnv*>(env)->local_data;
1084 return OK;
1085 }
1086
1087 static jvmtiError GetVersionNumber(jvmtiEnv* env, jint* version_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001088 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001089 *version_ptr = JVMTI_VERSION;
1090 return OK;
1091 }
1092
1093 static jvmtiError GetErrorName(jvmtiEnv* env, jvmtiError error, char** name_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001094 ENSURE_NON_NULL(name_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001095 switch (error) {
1096#define ERROR_CASE(e) case (JVMTI_ERROR_ ## e) : do { \
Alex Light41960712017-01-06 14:44:23 -08001097 jvmtiError res = CopyString(env, \
1098 "JVMTI_ERROR_"#e, \
1099 reinterpret_cast<unsigned char**>(name_ptr)); \
1100 if (res != OK) { \
1101 *name_ptr = nullptr; \
1102 return res; \
1103 } else { \
1104 return OK; \
1105 } \
Alex Light49948e92016-08-11 15:35:28 -07001106 } while (false)
1107 ERROR_CASE(NONE);
1108 ERROR_CASE(INVALID_THREAD);
1109 ERROR_CASE(INVALID_THREAD_GROUP);
1110 ERROR_CASE(INVALID_PRIORITY);
1111 ERROR_CASE(THREAD_NOT_SUSPENDED);
1112 ERROR_CASE(THREAD_NOT_ALIVE);
1113 ERROR_CASE(INVALID_OBJECT);
1114 ERROR_CASE(INVALID_CLASS);
1115 ERROR_CASE(CLASS_NOT_PREPARED);
1116 ERROR_CASE(INVALID_METHODID);
1117 ERROR_CASE(INVALID_LOCATION);
1118 ERROR_CASE(INVALID_FIELDID);
1119 ERROR_CASE(NO_MORE_FRAMES);
1120 ERROR_CASE(OPAQUE_FRAME);
1121 ERROR_CASE(TYPE_MISMATCH);
1122 ERROR_CASE(INVALID_SLOT);
1123 ERROR_CASE(DUPLICATE);
1124 ERROR_CASE(NOT_FOUND);
1125 ERROR_CASE(INVALID_MONITOR);
1126 ERROR_CASE(NOT_MONITOR_OWNER);
1127 ERROR_CASE(INTERRUPT);
1128 ERROR_CASE(INVALID_CLASS_FORMAT);
1129 ERROR_CASE(CIRCULAR_CLASS_DEFINITION);
1130 ERROR_CASE(FAILS_VERIFICATION);
1131 ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_ADDED);
1132 ERROR_CASE(UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED);
1133 ERROR_CASE(INVALID_TYPESTATE);
1134 ERROR_CASE(UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED);
1135 ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_DELETED);
1136 ERROR_CASE(UNSUPPORTED_VERSION);
1137 ERROR_CASE(NAMES_DONT_MATCH);
1138 ERROR_CASE(UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED);
1139 ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED);
1140 ERROR_CASE(UNMODIFIABLE_CLASS);
1141 ERROR_CASE(NOT_AVAILABLE);
1142 ERROR_CASE(MUST_POSSESS_CAPABILITY);
1143 ERROR_CASE(NULL_POINTER);
1144 ERROR_CASE(ABSENT_INFORMATION);
1145 ERROR_CASE(INVALID_EVENT_TYPE);
1146 ERROR_CASE(ILLEGAL_ARGUMENT);
1147 ERROR_CASE(NATIVE_METHOD);
1148 ERROR_CASE(CLASS_LOADER_UNSUPPORTED);
1149 ERROR_CASE(OUT_OF_MEMORY);
1150 ERROR_CASE(ACCESS_DENIED);
1151 ERROR_CASE(WRONG_PHASE);
1152 ERROR_CASE(INTERNAL);
1153 ERROR_CASE(UNATTACHED_THREAD);
1154 ERROR_CASE(INVALID_ENVIRONMENT);
1155#undef ERROR_CASE
1156 default: {
Alex Light41960712017-01-06 14:44:23 -08001157 jvmtiError res = CopyString(env,
1158 "JVMTI_ERROR_UNKNOWN",
1159 reinterpret_cast<unsigned char**>(name_ptr));
1160 if (res != OK) {
1161 *name_ptr = nullptr;
1162 return res;
1163 } else {
1164 return ERR(ILLEGAL_ARGUMENT);
1165 }
Alex Light49948e92016-08-11 15:35:28 -07001166 }
1167 }
1168 }
1169
1170 static jvmtiError SetVerboseFlag(jvmtiEnv* env, jvmtiVerboseFlag flag, jboolean value) {
1171 return ERR(NOT_IMPLEMENTED);
1172 }
1173
1174 static jvmtiError GetJLocationFormat(jvmtiEnv* env, jvmtiJlocationFormat* format_ptr) {
1175 return ERR(NOT_IMPLEMENTED);
1176 }
Alex Light9c20a142016-08-23 15:05:12 -07001177
1178 // TODO Remove this once events are working.
1179 static jvmtiError RetransformClassWithHook(jvmtiEnv* env,
1180 jclass klass,
1181 jvmtiEventClassFileLoadHook hook) {
1182 std::vector<jclass> classes;
1183 classes.push_back(klass);
1184 return RetransformClassesWithHook(reinterpret_cast<ArtJvmTiEnv*>(env), classes, hook);
1185 }
1186
1187 // TODO This will be called by the event handler for the art::ti Event Load Event
1188 static jvmtiError RetransformClassesWithHook(ArtJvmTiEnv* env,
1189 const std::vector<jclass>& classes,
1190 jvmtiEventClassFileLoadHook hook) {
1191 if (!IsValidEnv(env)) {
1192 return ERR(INVALID_ENVIRONMENT);
1193 }
Alex Lighta01de592016-11-15 10:43:06 -08001194 jvmtiError res = OK;
1195 std::string error;
Alex Light9c20a142016-08-23 15:05:12 -07001196 for (jclass klass : classes) {
1197 JNIEnv* jni_env = nullptr;
1198 jobject loader = nullptr;
1199 std::string name;
1200 jobject protection_domain = nullptr;
1201 jint data_len = 0;
1202 unsigned char* dex_data = nullptr;
1203 jvmtiError ret = OK;
1204 std::string location;
1205 if ((ret = GetTransformationData(env,
1206 klass,
1207 /*out*/&location,
1208 /*out*/&jni_env,
1209 /*out*/&loader,
1210 /*out*/&name,
1211 /*out*/&protection_domain,
1212 /*out*/&data_len,
1213 /*out*/&dex_data)) != OK) {
1214 // TODO Do something more here? Maybe give log statements?
1215 return ret;
1216 }
1217 jint new_data_len = 0;
1218 unsigned char* new_dex_data = nullptr;
1219 hook(env,
1220 jni_env,
1221 klass,
1222 loader,
1223 name.c_str(),
1224 protection_domain,
1225 data_len,
1226 dex_data,
1227 /*out*/&new_data_len,
1228 /*out*/&new_dex_data);
1229 // Check if anything actually changed.
1230 if ((new_data_len != 0 || new_dex_data != nullptr) && new_dex_data != dex_data) {
Alex Light0e692732017-01-10 15:00:05 -08001231 jvmtiClassDefinition def = { klass, new_data_len, new_dex_data };
1232 res = Redefiner::RedefineClasses(env,
1233 art::Runtime::Current(),
1234 art::Thread::Current(),
1235 1,
1236 &def,
1237 &error);
Alex Light9c20a142016-08-23 15:05:12 -07001238 env->Deallocate(new_dex_data);
1239 }
1240 // Deallocate the old dex data.
1241 env->Deallocate(dex_data);
Alex Lighta01de592016-11-15 10:43:06 -08001242 if (res != OK) {
1243 LOG(ERROR) << "FAILURE TO REDEFINE " << error;
1244 return res;
1245 }
Alex Light9c20a142016-08-23 15:05:12 -07001246 }
1247 return OK;
1248 }
Alex Light49948e92016-08-11 15:35:28 -07001249};
1250
1251static bool IsJvmtiVersion(jint version) {
1252 return version == JVMTI_VERSION_1 ||
1253 version == JVMTI_VERSION_1_0 ||
1254 version == JVMTI_VERSION_1_1 ||
1255 version == JVMTI_VERSION_1_2 ||
1256 version == JVMTI_VERSION;
1257}
1258
1259// Creates a jvmtiEnv and returns it with the art::ti::Env that is associated with it. new_art_ti
1260// is a pointer to the uninitialized memory for an art::ti::Env.
1261static void CreateArtJvmTiEnv(art::JavaVMExt* vm, /*out*/void** new_jvmtiEnv) {
1262 struct ArtJvmTiEnv* env = new ArtJvmTiEnv(vm);
1263 *new_jvmtiEnv = env;
Andreas Gampe77708d92016-10-07 11:48:21 -07001264
1265 gEventHandler.RegisterArtJvmTiEnv(env);
Alex Light49948e92016-08-11 15:35:28 -07001266}
1267
1268// A hook that the runtime uses to allow plugins to handle GetEnv calls. It returns true and
1269// places the return value in 'env' if this library can handle the GetEnv request. Otherwise
1270// returns false and does not modify the 'env' pointer.
1271static jint GetEnvHandler(art::JavaVMExt* vm, /*out*/void** env, jint version) {
1272 if (IsJvmtiVersion(version)) {
1273 CreateArtJvmTiEnv(vm, env);
1274 return JNI_OK;
1275 } else {
1276 printf("version 0x%x is not valid!", version);
1277 return JNI_EVERSION;
1278 }
1279}
1280
1281// The plugin initialization function. This adds the jvmti environment.
1282extern "C" bool ArtPlugin_Initialize() {
Andreas Gampee08a2be2016-10-06 13:13:30 -07001283 art::Runtime* runtime = art::Runtime::Current();
1284 runtime->GetJavaVM()->AddEnvironmentHook(GetEnvHandler);
1285 runtime->AddSystemWeakHolder(&gObjectTagTable);
Alex Light49948e92016-08-11 15:35:28 -07001286 return true;
1287}
1288
1289// The actual struct holding all of the entrypoints into the jvmti interface.
1290const jvmtiInterface_1 gJvmtiInterface = {
Alex Light9c20a142016-08-23 15:05:12 -07001291 // SPECIAL FUNCTION: RetransformClassWithHook Is normally reserved1
1292 // TODO Remove once we have events working.
1293 reinterpret_cast<void*>(JvmtiFunctions::RetransformClassWithHook),
1294 // nullptr, // reserved1
Alex Light49948e92016-08-11 15:35:28 -07001295 JvmtiFunctions::SetEventNotificationMode,
Alex Light0e692732017-01-10 15:00:05 -08001296 nullptr, // reserved3
Alex Light49948e92016-08-11 15:35:28 -07001297 JvmtiFunctions::GetAllThreads,
1298 JvmtiFunctions::SuspendThread,
1299 JvmtiFunctions::ResumeThread,
1300 JvmtiFunctions::StopThread,
1301 JvmtiFunctions::InterruptThread,
1302 JvmtiFunctions::GetThreadInfo,
1303 JvmtiFunctions::GetOwnedMonitorInfo, // 10
1304 JvmtiFunctions::GetCurrentContendedMonitor,
1305 JvmtiFunctions::RunAgentThread,
1306 JvmtiFunctions::GetTopThreadGroups,
1307 JvmtiFunctions::GetThreadGroupInfo,
1308 JvmtiFunctions::GetThreadGroupChildren,
1309 JvmtiFunctions::GetFrameCount,
1310 JvmtiFunctions::GetThreadState,
1311 JvmtiFunctions::GetCurrentThread,
1312 JvmtiFunctions::GetFrameLocation,
1313 JvmtiFunctions::NotifyFramePop, // 20
1314 JvmtiFunctions::GetLocalObject,
1315 JvmtiFunctions::GetLocalInt,
1316 JvmtiFunctions::GetLocalLong,
1317 JvmtiFunctions::GetLocalFloat,
1318 JvmtiFunctions::GetLocalDouble,
1319 JvmtiFunctions::SetLocalObject,
1320 JvmtiFunctions::SetLocalInt,
1321 JvmtiFunctions::SetLocalLong,
1322 JvmtiFunctions::SetLocalFloat,
1323 JvmtiFunctions::SetLocalDouble, // 30
1324 JvmtiFunctions::CreateRawMonitor,
1325 JvmtiFunctions::DestroyRawMonitor,
1326 JvmtiFunctions::RawMonitorEnter,
1327 JvmtiFunctions::RawMonitorExit,
1328 JvmtiFunctions::RawMonitorWait,
1329 JvmtiFunctions::RawMonitorNotify,
1330 JvmtiFunctions::RawMonitorNotifyAll,
1331 JvmtiFunctions::SetBreakpoint,
1332 JvmtiFunctions::ClearBreakpoint,
1333 nullptr, // reserved40
1334 JvmtiFunctions::SetFieldAccessWatch,
1335 JvmtiFunctions::ClearFieldAccessWatch,
1336 JvmtiFunctions::SetFieldModificationWatch,
1337 JvmtiFunctions::ClearFieldModificationWatch,
1338 JvmtiFunctions::IsModifiableClass,
1339 JvmtiFunctions::Allocate,
1340 JvmtiFunctions::Deallocate,
1341 JvmtiFunctions::GetClassSignature,
1342 JvmtiFunctions::GetClassStatus,
1343 JvmtiFunctions::GetSourceFileName, // 50
1344 JvmtiFunctions::GetClassModifiers,
1345 JvmtiFunctions::GetClassMethods,
1346 JvmtiFunctions::GetClassFields,
1347 JvmtiFunctions::GetImplementedInterfaces,
1348 JvmtiFunctions::IsInterface,
1349 JvmtiFunctions::IsArrayClass,
1350 JvmtiFunctions::GetClassLoader,
1351 JvmtiFunctions::GetObjectHashCode,
1352 JvmtiFunctions::GetObjectMonitorUsage,
1353 JvmtiFunctions::GetFieldName, // 60
1354 JvmtiFunctions::GetFieldDeclaringClass,
1355 JvmtiFunctions::GetFieldModifiers,
1356 JvmtiFunctions::IsFieldSynthetic,
1357 JvmtiFunctions::GetMethodName,
1358 JvmtiFunctions::GetMethodDeclaringClass,
1359 JvmtiFunctions::GetMethodModifiers,
1360 nullptr, // reserved67
1361 JvmtiFunctions::GetMaxLocals,
1362 JvmtiFunctions::GetArgumentsSize,
1363 JvmtiFunctions::GetLineNumberTable, // 70
1364 JvmtiFunctions::GetMethodLocation,
1365 JvmtiFunctions::GetLocalVariableTable,
1366 JvmtiFunctions::SetNativeMethodPrefix,
1367 JvmtiFunctions::SetNativeMethodPrefixes,
1368 JvmtiFunctions::GetBytecodes,
1369 JvmtiFunctions::IsMethodNative,
1370 JvmtiFunctions::IsMethodSynthetic,
1371 JvmtiFunctions::GetLoadedClasses,
1372 JvmtiFunctions::GetClassLoaderClasses,
1373 JvmtiFunctions::PopFrame, // 80
1374 JvmtiFunctions::ForceEarlyReturnObject,
1375 JvmtiFunctions::ForceEarlyReturnInt,
1376 JvmtiFunctions::ForceEarlyReturnLong,
1377 JvmtiFunctions::ForceEarlyReturnFloat,
1378 JvmtiFunctions::ForceEarlyReturnDouble,
1379 JvmtiFunctions::ForceEarlyReturnVoid,
1380 JvmtiFunctions::RedefineClasses,
1381 JvmtiFunctions::GetVersionNumber,
1382 JvmtiFunctions::GetCapabilities,
1383 JvmtiFunctions::GetSourceDebugExtension, // 90
1384 JvmtiFunctions::IsMethodObsolete,
1385 JvmtiFunctions::SuspendThreadList,
1386 JvmtiFunctions::ResumeThreadList,
1387 nullptr, // reserved94
1388 nullptr, // reserved95
1389 nullptr, // reserved96
1390 nullptr, // reserved97
1391 nullptr, // reserved98
1392 nullptr, // reserved99
1393 JvmtiFunctions::GetAllStackTraces, // 100
1394 JvmtiFunctions::GetThreadListStackTraces,
1395 JvmtiFunctions::GetThreadLocalStorage,
1396 JvmtiFunctions::SetThreadLocalStorage,
1397 JvmtiFunctions::GetStackTrace,
1398 nullptr, // reserved105
1399 JvmtiFunctions::GetTag,
1400 JvmtiFunctions::SetTag,
1401 JvmtiFunctions::ForceGarbageCollection,
1402 JvmtiFunctions::IterateOverObjectsReachableFromObject,
1403 JvmtiFunctions::IterateOverReachableObjects, // 110
1404 JvmtiFunctions::IterateOverHeap,
1405 JvmtiFunctions::IterateOverInstancesOfClass,
1406 nullptr, // reserved113
1407 JvmtiFunctions::GetObjectsWithTags,
1408 JvmtiFunctions::FollowReferences,
1409 JvmtiFunctions::IterateThroughHeap,
1410 nullptr, // reserved117
1411 nullptr, // reserved118
1412 nullptr, // reserved119
1413 JvmtiFunctions::SetJNIFunctionTable, // 120
1414 JvmtiFunctions::GetJNIFunctionTable,
1415 JvmtiFunctions::SetEventCallbacks,
1416 JvmtiFunctions::GenerateEvents,
1417 JvmtiFunctions::GetExtensionFunctions,
1418 JvmtiFunctions::GetExtensionEvents,
1419 JvmtiFunctions::SetExtensionEventCallback,
1420 JvmtiFunctions::DisposeEnvironment,
1421 JvmtiFunctions::GetErrorName,
1422 JvmtiFunctions::GetJLocationFormat,
1423 JvmtiFunctions::GetSystemProperties, // 130
1424 JvmtiFunctions::GetSystemProperty,
1425 JvmtiFunctions::SetSystemProperty,
1426 JvmtiFunctions::GetPhase,
1427 JvmtiFunctions::GetCurrentThreadCpuTimerInfo,
1428 JvmtiFunctions::GetCurrentThreadCpuTime,
1429 JvmtiFunctions::GetThreadCpuTimerInfo,
1430 JvmtiFunctions::GetThreadCpuTime,
1431 JvmtiFunctions::GetTimerInfo,
1432 JvmtiFunctions::GetTime,
1433 JvmtiFunctions::GetPotentialCapabilities, // 140
1434 nullptr, // reserved141
1435 JvmtiFunctions::AddCapabilities,
1436 JvmtiFunctions::RelinquishCapabilities,
1437 JvmtiFunctions::GetAvailableProcessors,
1438 JvmtiFunctions::GetClassVersionNumbers,
1439 JvmtiFunctions::GetConstantPool,
1440 JvmtiFunctions::GetEnvironmentLocalStorage,
1441 JvmtiFunctions::SetEnvironmentLocalStorage,
1442 JvmtiFunctions::AddToBootstrapClassLoaderSearch,
1443 JvmtiFunctions::SetVerboseFlag, // 150
1444 JvmtiFunctions::AddToSystemClassLoaderSearch,
1445 JvmtiFunctions::RetransformClasses,
1446 JvmtiFunctions::GetOwnedMonitorStackDepthInfo,
1447 JvmtiFunctions::GetObjectSize,
1448 JvmtiFunctions::GetLocalInstance,
1449};
1450
1451}; // namespace openjdkjvmti