blob: 32e3948e3e5d599a395c58adb9450fa7f5bbd715 [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>
Andreas Gampef37e3022017-01-13 17:54:46 -080033#include <type_traits>
Alex Light9c20a142016-08-23 15:05:12 -070034#include <vector>
35
Alex Light49948e92016-08-11 15:35:28 -070036#include <jni.h>
Alex Light9c20a142016-08-23 15:05:12 -070037
Alex Light49948e92016-08-11 15:35:28 -070038#include "openjdkjvmti/jvmti.h"
39
Andreas Gampedb6dcb62016-09-13 09:05:59 -070040#include "art_jvmti.h"
Andreas Gampef37e3022017-01-13 17:54:46 -080041#include "base/logging.h"
Andreas Gampe77708d92016-10-07 11:48:21 -070042#include "base/mutex.h"
43#include "events-inl.h"
Alex Light49948e92016-08-11 15:35:28 -070044#include "jni_env_ext-inl.h"
Andreas Gampe6dee92e2016-09-12 19:58:13 -070045#include "obj_ptr-inl.h"
Alex Lighta01de592016-11-15 10:43:06 -080046#include "object_tagging.h"
Alex Light9c20a142016-08-23 15:05:12 -070047#include "runtime.h"
Andreas Gampe6dee92e2016-09-12 19:58:13 -070048#include "scoped_thread_state_change-inl.h"
Andreas Gampe77708d92016-10-07 11:48:21 -070049#include "thread-inl.h"
Alex Lighta01de592016-11-15 10:43:06 -080050#include "thread_list.h"
Andreas Gampee492ae32016-10-28 19:34:57 -070051#include "ti_class.h"
Andreas Gampeab2f0d02017-01-05 17:23:45 -080052#include "ti_field.h"
Andreas Gampeba8df692016-11-01 10:30:44 -070053#include "ti_heap.h"
Andreas Gampe6f8e4f02017-01-16 18:18:14 -080054#include "ti_jni.h"
Andreas Gampe3c252f02016-10-27 18:25:17 -070055#include "ti_method.h"
Andreas Gampe319dbe82017-01-09 16:42:21 -080056#include "ti_monitor.h"
Andreas Gampe50a4e492017-01-06 18:00:20 -080057#include "ti_object.h"
Andreas Gampe1bdaf732017-01-09 19:21:06 -080058#include "ti_properties.h"
Alex Lighta01de592016-11-15 10:43:06 -080059#include "ti_redefine.h"
Andreas Gampece7732b2017-01-17 15:50:26 -080060#include "ti_search.h"
Andreas Gampeb5eb94a2016-10-27 19:23:09 -070061#include "ti_stack.h"
Andreas Gampeaf13ab92017-01-11 20:57:40 -080062#include "ti_thread.h"
Andreas Gamped18d9e22017-01-16 16:08:45 +000063#include "ti_threadgroup.h"
Andreas Gampe35bcf812017-01-13 16:24:17 -080064#include "ti_timers.h"
Alex Light9c20a142016-08-23 15:05:12 -070065#include "transform.h"
Alex Light49948e92016-08-11 15:35:28 -070066
67// TODO Remove this at some point by annotating all the methods. It was put in to make the skeleton
68// easier to create.
69#pragma GCC diagnostic ignored "-Wunused-parameter"
70
71namespace openjdkjvmti {
72
Andreas Gampe77708d92016-10-07 11:48:21 -070073EventHandler gEventHandler;
Andreas Gampecc13b222016-10-10 19:09:09 -070074ObjectTagTable gObjectTagTable(&gEventHandler);
Andreas Gampe6dee92e2016-09-12 19:58:13 -070075
Alex Lighte6574242016-08-17 09:56:24 -070076#define ENSURE_NON_NULL(n) \
77 do { \
78 if ((n) == nullptr) { \
79 return ERR(NULL_POINTER); \
80 } \
81 } while (false)
82
Alex Light49948e92016-08-11 15:35:28 -070083class JvmtiFunctions {
84 private:
85 static bool IsValidEnv(jvmtiEnv* env) {
86 return env != nullptr;
87 }
88
Alex Lighte6574242016-08-17 09:56:24 -070089#define ENSURE_VALID_ENV(env) \
90 do { \
91 if (!IsValidEnv(env)) { \
92 return ERR(INVALID_ENVIRONMENT); \
93 } \
94 } while (false)
95
96#define ENSURE_HAS_CAP(env, cap) \
97 do { \
98 ENSURE_VALID_ENV(env); \
99 if (ArtJvmTiEnv::AsArtJvmTiEnv(env)->capabilities.cap != 1) { \
100 return ERR(MUST_POSSESS_CAPABILITY); \
101 } \
102 } while (false)
103
Alex Light49948e92016-08-11 15:35:28 -0700104 public:
105 static jvmtiError Allocate(jvmtiEnv* env, jlong size, unsigned char** mem_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700106 ENSURE_VALID_ENV(env);
107 ENSURE_NON_NULL(mem_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700108 if (size < 0) {
109 return ERR(ILLEGAL_ARGUMENT);
110 } else if (size == 0) {
111 *mem_ptr = nullptr;
112 return OK;
113 }
114 *mem_ptr = static_cast<unsigned char*>(malloc(size));
115 return (*mem_ptr != nullptr) ? OK : ERR(OUT_OF_MEMORY);
116 }
117
118 static jvmtiError Deallocate(jvmtiEnv* env, unsigned char* mem) {
Alex Lighte6574242016-08-17 09:56:24 -0700119 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -0700120 if (mem != nullptr) {
121 free(mem);
122 }
123 return OK;
124 }
125
126 static jvmtiError GetThreadState(jvmtiEnv* env, jthread thread, jint* thread_state_ptr) {
Andreas Gampe72c19832017-01-12 13:22:16 -0800127 return ThreadUtil::GetThreadState(env, thread, thread_state_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700128 }
129
130 static jvmtiError GetCurrentThread(jvmtiEnv* env, jthread* thread_ptr) {
Andreas Gampeaf13ab92017-01-11 20:57:40 -0800131 return ThreadUtil::GetCurrentThread(env, thread_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700132 }
133
134 static jvmtiError GetAllThreads(jvmtiEnv* env, jint* threads_count_ptr, jthread** threads_ptr) {
Andreas Gampe85807442017-01-13 14:40:58 -0800135 return ThreadUtil::GetAllThreads(env, threads_count_ptr, threads_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700136 }
137
138 static jvmtiError SuspendThread(jvmtiEnv* env, jthread thread) {
139 return ERR(NOT_IMPLEMENTED);
140 }
141
142 static jvmtiError SuspendThreadList(jvmtiEnv* env,
143 jint request_count,
144 const jthread* request_list,
145 jvmtiError* results) {
146 return ERR(NOT_IMPLEMENTED);
147 }
148
149 static jvmtiError ResumeThread(jvmtiEnv* env, jthread thread) {
150 return ERR(NOT_IMPLEMENTED);
151 }
152
153 static jvmtiError ResumeThreadList(jvmtiEnv* env,
154 jint request_count,
155 const jthread* request_list,
156 jvmtiError* results) {
157 return ERR(NOT_IMPLEMENTED);
158 }
159
160 static jvmtiError StopThread(jvmtiEnv* env, jthread thread, jobject exception) {
161 return ERR(NOT_IMPLEMENTED);
162 }
163
164 static jvmtiError InterruptThread(jvmtiEnv* env, jthread thread) {
165 return ERR(NOT_IMPLEMENTED);
166 }
167
168 static jvmtiError GetThreadInfo(jvmtiEnv* env, jthread thread, jvmtiThreadInfo* info_ptr) {
Andreas Gampeaf13ab92017-01-11 20:57:40 -0800169 return ThreadUtil::GetThreadInfo(env, thread, info_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700170 }
171
172 static jvmtiError GetOwnedMonitorInfo(jvmtiEnv* env,
173 jthread thread,
174 jint* owned_monitor_count_ptr,
175 jobject** owned_monitors_ptr) {
176 return ERR(NOT_IMPLEMENTED);
177 }
178
179 static jvmtiError GetOwnedMonitorStackDepthInfo(jvmtiEnv* env,
180 jthread thread,
181 jint* monitor_info_count_ptr,
182 jvmtiMonitorStackDepthInfo** monitor_info_ptr) {
183 return ERR(NOT_IMPLEMENTED);
184 }
185
186 static jvmtiError GetCurrentContendedMonitor(jvmtiEnv* env,
187 jthread thread,
188 jobject* monitor_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700189 return ERR(NOT_IMPLEMENTED);
Alex Light49948e92016-08-11 15:35:28 -0700190 }
191
192 static jvmtiError RunAgentThread(jvmtiEnv* env,
193 jthread thread,
194 jvmtiStartFunction proc,
195 const void* arg,
196 jint priority) {
197 return ERR(NOT_IMPLEMENTED);
198 }
199
200 static jvmtiError SetThreadLocalStorage(jvmtiEnv* env, jthread thread, const void* data) {
201 return ERR(NOT_IMPLEMENTED);
202 }
203
204 static jvmtiError GetThreadLocalStorage(jvmtiEnv* env, jthread thread, void** data_ptr) {
205 return ERR(NOT_IMPLEMENTED);
206 }
207
208 static jvmtiError GetTopThreadGroups(jvmtiEnv* env,
209 jint* group_count_ptr,
210 jthreadGroup** groups_ptr) {
Andreas Gamped18d9e22017-01-16 16:08:45 +0000211 return ThreadGroupUtil::GetTopThreadGroups(env, group_count_ptr, groups_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700212 }
213
214 static jvmtiError GetThreadGroupInfo(jvmtiEnv* env,
215 jthreadGroup group,
216 jvmtiThreadGroupInfo* info_ptr) {
Andreas Gamped18d9e22017-01-16 16:08:45 +0000217 return ThreadGroupUtil::GetThreadGroupInfo(env, group, info_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700218 }
219
220 static jvmtiError GetThreadGroupChildren(jvmtiEnv* env,
221 jthreadGroup group,
222 jint* thread_count_ptr,
223 jthread** threads_ptr,
224 jint* group_count_ptr,
225 jthreadGroup** groups_ptr) {
Andreas Gamped18d9e22017-01-16 16:08:45 +0000226 return ThreadGroupUtil::GetThreadGroupChildren(env,
227 group,
228 thread_count_ptr,
229 threads_ptr,
230 group_count_ptr,
231 groups_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700232 }
233
234 static jvmtiError GetStackTrace(jvmtiEnv* env,
235 jthread thread,
236 jint start_depth,
237 jint max_frame_count,
238 jvmtiFrameInfo* frame_buffer,
239 jint* count_ptr) {
Andreas Gampeb5eb94a2016-10-27 19:23:09 -0700240 return StackUtil::GetStackTrace(env,
241 thread,
242 start_depth,
243 max_frame_count,
244 frame_buffer,
245 count_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700246 }
247
248 static jvmtiError GetAllStackTraces(jvmtiEnv* env,
249 jint max_frame_count,
250 jvmtiStackInfo** stack_info_ptr,
251 jint* thread_count_ptr) {
Andreas Gampea1a27c62017-01-11 16:37:16 -0800252 return StackUtil::GetAllStackTraces(env, max_frame_count, stack_info_ptr, thread_count_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700253 }
254
255 static jvmtiError GetThreadListStackTraces(jvmtiEnv* env,
256 jint thread_count,
257 const jthread* thread_list,
258 jint max_frame_count,
259 jvmtiStackInfo** stack_info_ptr) {
Andreas Gampeeba32fb2017-01-12 17:40:05 -0800260 return StackUtil::GetThreadListStackTraces(env,
261 thread_count,
262 thread_list,
263 max_frame_count,
264 stack_info_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700265 }
266
267 static jvmtiError GetFrameCount(jvmtiEnv* env, jthread thread, jint* count_ptr) {
Andreas Gampef6f3b5f2017-01-13 09:21:42 -0800268 return StackUtil::GetFrameCount(env, thread, count_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700269 }
270
271 static jvmtiError PopFrame(jvmtiEnv* env, jthread thread) {
272 return ERR(NOT_IMPLEMENTED);
273 }
274
275 static jvmtiError GetFrameLocation(jvmtiEnv* env,
276 jthread thread,
277 jint depth,
278 jmethodID* method_ptr,
279 jlocation* location_ptr) {
Andreas Gampef6f3b5f2017-01-13 09:21:42 -0800280 return StackUtil::GetFrameLocation(env, thread, depth, method_ptr, location_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700281 }
282
283 static jvmtiError NotifyFramePop(jvmtiEnv* env, jthread thread, jint depth) {
284 return ERR(NOT_IMPLEMENTED);
285 }
286
287 static jvmtiError ForceEarlyReturnObject(jvmtiEnv* env, jthread thread, jobject value) {
288 return ERR(NOT_IMPLEMENTED);
289 }
290
291 static jvmtiError ForceEarlyReturnInt(jvmtiEnv* env, jthread thread, jint value) {
292 return ERR(NOT_IMPLEMENTED);
293 }
294
295 static jvmtiError ForceEarlyReturnLong(jvmtiEnv* env, jthread thread, jlong value) {
296 return ERR(NOT_IMPLEMENTED);
297 }
298
299 static jvmtiError ForceEarlyReturnFloat(jvmtiEnv* env, jthread thread, jfloat value) {
300 return ERR(NOT_IMPLEMENTED);
301 }
302
303 static jvmtiError ForceEarlyReturnDouble(jvmtiEnv* env, jthread thread, jdouble value) {
304 return ERR(NOT_IMPLEMENTED);
305 }
306
307 static jvmtiError ForceEarlyReturnVoid(jvmtiEnv* env, jthread thread) {
308 return ERR(NOT_IMPLEMENTED);
309 }
310
311 static jvmtiError FollowReferences(jvmtiEnv* env,
312 jint heap_filter,
313 jclass klass,
314 jobject initial_object,
315 const jvmtiHeapCallbacks* callbacks,
316 const void* user_data) {
Andreas Gampe70bfc8a2016-11-03 11:04:15 -0700317 HeapUtil heap_util(&gObjectTagTable);
318 return heap_util.FollowReferences(env,
319 heap_filter,
320 klass,
321 initial_object,
322 callbacks,
323 user_data);
Alex Light49948e92016-08-11 15:35:28 -0700324 }
325
326 static jvmtiError IterateThroughHeap(jvmtiEnv* env,
327 jint heap_filter,
328 jclass klass,
329 const jvmtiHeapCallbacks* callbacks,
330 const void* user_data) {
Alex Lighte6574242016-08-17 09:56:24 -0700331 ENSURE_HAS_CAP(env, can_tag_objects);
Andreas Gampee54d9922016-10-11 19:55:37 -0700332 HeapUtil heap_util(&gObjectTagTable);
333 return heap_util.IterateThroughHeap(env, heap_filter, klass, callbacks, user_data);
Alex Light49948e92016-08-11 15:35:28 -0700334 }
335
336 static jvmtiError GetTag(jvmtiEnv* env, jobject object, jlong* tag_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700337 ENSURE_HAS_CAP(env, can_tag_objects);
Andreas Gampe6dee92e2016-09-12 19:58:13 -0700338
339 JNIEnv* jni_env = GetJniEnv(env);
340 if (jni_env == nullptr) {
341 return ERR(INTERNAL);
342 }
343
344 art::ScopedObjectAccess soa(jni_env);
345 art::ObjPtr<art::mirror::Object> obj = soa.Decode<art::mirror::Object>(object);
346 if (!gObjectTagTable.GetTag(obj.Ptr(), tag_ptr)) {
347 *tag_ptr = 0;
348 }
349
350 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700351 }
352
353 static jvmtiError SetTag(jvmtiEnv* env, jobject object, jlong tag) {
Alex Lighte6574242016-08-17 09:56:24 -0700354 ENSURE_HAS_CAP(env, can_tag_objects);
355
Andreas Gampe6dee92e2016-09-12 19:58:13 -0700356 if (object == nullptr) {
357 return ERR(NULL_POINTER);
358 }
359
360 JNIEnv* jni_env = GetJniEnv(env);
361 if (jni_env == nullptr) {
362 return ERR(INTERNAL);
363 }
364
365 art::ScopedObjectAccess soa(jni_env);
366 art::ObjPtr<art::mirror::Object> obj = soa.Decode<art::mirror::Object>(object);
Andreas Gampee54eee12016-10-20 19:03:58 -0700367 gObjectTagTable.Set(obj.Ptr(), tag);
Andreas Gampe6dee92e2016-09-12 19:58:13 -0700368
369 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700370 }
371
372 static jvmtiError GetObjectsWithTags(jvmtiEnv* env,
373 jint tag_count,
374 const jlong* tags,
375 jint* count_ptr,
376 jobject** object_result_ptr,
377 jlong** tag_result_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700378 ENSURE_HAS_CAP(env, can_tag_objects);
379
Andreas Gampe5e6046b2016-10-25 12:05:53 -0700380 JNIEnv* jni_env = GetJniEnv(env);
381 if (jni_env == nullptr) {
382 return ERR(INTERNAL);
383 }
384
385 art::ScopedObjectAccess soa(jni_env);
386 return gObjectTagTable.GetTaggedObjects(env,
387 tag_count,
388 tags,
389 count_ptr,
390 object_result_ptr,
391 tag_result_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700392 }
393
394 static jvmtiError ForceGarbageCollection(jvmtiEnv* env) {
Andreas Gampe8da6d032016-10-31 19:31:03 -0700395 return HeapUtil::ForceGarbageCollection(env);
Alex Light49948e92016-08-11 15:35:28 -0700396 }
397
398 static jvmtiError IterateOverObjectsReachableFromObject(
399 jvmtiEnv* env,
400 jobject object,
401 jvmtiObjectReferenceCallback object_reference_callback,
402 const void* user_data) {
403 return ERR(NOT_IMPLEMENTED);
404 }
405
406 static jvmtiError IterateOverReachableObjects(jvmtiEnv* env,
407 jvmtiHeapRootCallback heap_root_callback,
408 jvmtiStackReferenceCallback stack_ref_callback,
409 jvmtiObjectReferenceCallback object_ref_callback,
410 const void* user_data) {
411 return ERR(NOT_IMPLEMENTED);
412 }
413
414 static jvmtiError IterateOverHeap(jvmtiEnv* env,
415 jvmtiHeapObjectFilter object_filter,
416 jvmtiHeapObjectCallback heap_object_callback,
417 const void* user_data) {
418 return ERR(NOT_IMPLEMENTED);
419 }
420
421 static jvmtiError IterateOverInstancesOfClass(jvmtiEnv* env,
422 jclass klass,
423 jvmtiHeapObjectFilter object_filter,
424 jvmtiHeapObjectCallback heap_object_callback,
425 const void* user_data) {
426 return ERR(NOT_IMPLEMENTED);
427 }
428
429 static jvmtiError GetLocalObject(jvmtiEnv* env,
430 jthread thread,
431 jint depth,
432 jint slot,
433 jobject* value_ptr) {
434 return ERR(NOT_IMPLEMENTED);
435 }
436
437 static jvmtiError GetLocalInstance(jvmtiEnv* env,
438 jthread thread,
439 jint depth,
440 jobject* value_ptr) {
441 return ERR(NOT_IMPLEMENTED);
442 }
443
444 static jvmtiError GetLocalInt(jvmtiEnv* env,
445 jthread thread,
446 jint depth,
447 jint slot,
448 jint* value_ptr) {
449 return ERR(NOT_IMPLEMENTED);
450 }
451
452 static jvmtiError GetLocalLong(jvmtiEnv* env,
453 jthread thread,
454 jint depth,
455 jint slot,
456 jlong* value_ptr) {
457 return ERR(NOT_IMPLEMENTED);
458 }
459
460 static jvmtiError GetLocalFloat(jvmtiEnv* env,
461 jthread thread,
462 jint depth,
463 jint slot,
464 jfloat* value_ptr) {
465 return ERR(NOT_IMPLEMENTED);
466 }
467
468 static jvmtiError GetLocalDouble(jvmtiEnv* env,
469 jthread thread,
470 jint depth,
471 jint slot,
472 jdouble* value_ptr) {
473 return ERR(NOT_IMPLEMENTED);
474 }
475
476 static jvmtiError SetLocalObject(jvmtiEnv* env,
477 jthread thread,
478 jint depth,
479 jint slot,
480 jobject value) {
481 return ERR(NOT_IMPLEMENTED);
482 }
483
484 static jvmtiError SetLocalInt(jvmtiEnv* env,
485 jthread thread,
486 jint depth,
487 jint slot,
488 jint value) {
489 return ERR(NOT_IMPLEMENTED);
490 }
491
492 static jvmtiError SetLocalLong(jvmtiEnv* env,
493 jthread thread,
494 jint depth,
495 jint slot,
496 jlong value) {
497 return ERR(NOT_IMPLEMENTED);
498 }
499
500 static jvmtiError SetLocalFloat(jvmtiEnv* env,
501 jthread thread,
502 jint depth,
503 jint slot,
504 jfloat value) {
505 return ERR(NOT_IMPLEMENTED);
506 }
507
508 static jvmtiError SetLocalDouble(jvmtiEnv* env,
509 jthread thread,
510 jint depth,
511 jint slot,
512 jdouble value) {
513 return ERR(NOT_IMPLEMENTED);
514 }
515
516 static jvmtiError SetBreakpoint(jvmtiEnv* env, jmethodID method, jlocation location) {
517 return ERR(NOT_IMPLEMENTED);
518 }
519
520 static jvmtiError ClearBreakpoint(jvmtiEnv* env, jmethodID method, jlocation location) {
521 return ERR(NOT_IMPLEMENTED);
522 }
523
524 static jvmtiError SetFieldAccessWatch(jvmtiEnv* env, jclass klass, jfieldID field) {
525 return ERR(NOT_IMPLEMENTED);
526 }
527
528 static jvmtiError ClearFieldAccessWatch(jvmtiEnv* env, jclass klass, jfieldID field) {
529 return ERR(NOT_IMPLEMENTED);
530 }
531
532 static jvmtiError SetFieldModificationWatch(jvmtiEnv* env, jclass klass, jfieldID field) {
533 return ERR(NOT_IMPLEMENTED);
534 }
535
536 static jvmtiError ClearFieldModificationWatch(jvmtiEnv* env, jclass klass, jfieldID field) {
537 return ERR(NOT_IMPLEMENTED);
538 }
539
540 static jvmtiError GetLoadedClasses(jvmtiEnv* env, jint* class_count_ptr, jclass** classes_ptr) {
Andreas Gampeaa8b60c2016-10-12 12:51:25 -0700541 HeapUtil heap_util(&gObjectTagTable);
542 return heap_util.GetLoadedClasses(env, class_count_ptr, classes_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700543 }
544
545 static jvmtiError GetClassLoaderClasses(jvmtiEnv* env,
546 jobject initiating_loader,
547 jint* class_count_ptr,
548 jclass** classes_ptr) {
Andreas Gampe70f16392017-01-16 14:20:10 -0800549 return ClassUtil::GetClassLoaderClasses(env, initiating_loader, class_count_ptr, classes_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700550 }
551
552 static jvmtiError GetClassSignature(jvmtiEnv* env,
553 jclass klass,
554 char** signature_ptr,
555 char** generic_ptr) {
Andreas Gampee492ae32016-10-28 19:34:57 -0700556 return ClassUtil::GetClassSignature(env, klass, signature_ptr, generic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700557 }
558
559 static jvmtiError GetClassStatus(jvmtiEnv* env, jclass klass, jint* status_ptr) {
Andreas Gampeff9d2092017-01-06 09:12:49 -0800560 return ClassUtil::GetClassStatus(env, klass, status_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700561 }
562
563 static jvmtiError GetSourceFileName(jvmtiEnv* env, jclass klass, char** source_name_ptr) {
564 return ERR(NOT_IMPLEMENTED);
565 }
566
567 static jvmtiError GetClassModifiers(jvmtiEnv* env, jclass klass, jint* modifiers_ptr) {
Andreas Gampe64013e52017-01-06 13:07:19 -0800568 return ClassUtil::GetClassModifiers(env, klass, modifiers_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700569 }
570
571 static jvmtiError GetClassMethods(jvmtiEnv* env,
572 jclass klass,
573 jint* method_count_ptr,
574 jmethodID** methods_ptr) {
Andreas Gampe18fee4d2017-01-06 11:36:35 -0800575 return ClassUtil::GetClassMethods(env, klass, method_count_ptr, methods_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700576 }
577
578 static jvmtiError GetClassFields(jvmtiEnv* env,
579 jclass klass,
580 jint* field_count_ptr,
581 jfieldID** fields_ptr) {
Andreas Gampeac587272017-01-05 15:21:34 -0800582 return ClassUtil::GetClassFields(env, klass, field_count_ptr, fields_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700583 }
584
585 static jvmtiError GetImplementedInterfaces(jvmtiEnv* env,
586 jclass klass,
587 jint* interface_count_ptr,
588 jclass** interfaces_ptr) {
Andreas Gampe8b07e472017-01-06 14:20:39 -0800589 return ClassUtil::GetImplementedInterfaces(env, klass, interface_count_ptr, interfaces_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700590 }
591
592 static jvmtiError GetClassVersionNumbers(jvmtiEnv* env,
593 jclass klass,
594 jint* minor_version_ptr,
595 jint* major_version_ptr) {
596 return ERR(NOT_IMPLEMENTED);
597 }
598
599 static jvmtiError GetConstantPool(jvmtiEnv* env,
600 jclass klass,
601 jint* constant_pool_count_ptr,
602 jint* constant_pool_byte_count_ptr,
603 unsigned char** constant_pool_bytes_ptr) {
604 return ERR(NOT_IMPLEMENTED);
605 }
606
607 static jvmtiError IsInterface(jvmtiEnv* env, jclass klass, jboolean* is_interface_ptr) {
Andreas Gampe4fd66ec2017-01-05 14:42:13 -0800608 return ClassUtil::IsInterface(env, klass, is_interface_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700609 }
610
611 static jvmtiError IsArrayClass(jvmtiEnv* env,
612 jclass klass,
613 jboolean* is_array_class_ptr) {
Andreas Gampe4fd66ec2017-01-05 14:42:13 -0800614 return ClassUtil::IsArrayClass(env, klass, is_array_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700615 }
616
617 static jvmtiError IsModifiableClass(jvmtiEnv* env,
618 jclass klass,
619 jboolean* is_modifiable_class_ptr) {
Alex Lighte4a88632017-01-10 07:41:24 -0800620 return Redefiner::IsModifiableClass(env, klass, is_modifiable_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700621 }
622
623 static jvmtiError GetClassLoader(jvmtiEnv* env, jclass klass, jobject* classloader_ptr) {
Andreas Gampe8f5b6032017-01-06 15:50:55 -0800624 return ClassUtil::GetClassLoader(env, klass, classloader_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700625 }
626
627 static jvmtiError GetSourceDebugExtension(jvmtiEnv* env,
628 jclass klass,
629 char** source_debug_extension_ptr) {
630 return ERR(NOT_IMPLEMENTED);
631 }
632
633 static jvmtiError RetransformClasses(jvmtiEnv* env, jint class_count, const jclass* classes) {
Alex Light6ac57502017-01-19 15:05:06 -0800634 std::string error_msg;
635 jvmtiError res = Transformer::RetransformClasses(ArtJvmTiEnv::AsArtJvmTiEnv(env),
636 art::Runtime::Current(),
637 art::Thread::Current(),
638 class_count,
639 classes,
640 &error_msg);
641 if (res != OK) {
642 LOG(WARNING) << "FAILURE TO RETRANFORM " << error_msg;
643 }
644 return res;
Alex Light49948e92016-08-11 15:35:28 -0700645 }
646
647 static jvmtiError RedefineClasses(jvmtiEnv* env,
648 jint class_count,
649 const jvmtiClassDefinition* class_definitions) {
Alex Light0e692732017-01-10 15:00:05 -0800650 std::string error_msg;
651 jvmtiError res = Redefiner::RedefineClasses(ArtJvmTiEnv::AsArtJvmTiEnv(env),
652 art::Runtime::Current(),
653 art::Thread::Current(),
654 class_count,
655 class_definitions,
656 &error_msg);
657 if (res != OK) {
658 LOG(WARNING) << "FAILURE TO REDEFINE " << error_msg;
659 }
660 return res;
Alex Light49948e92016-08-11 15:35:28 -0700661 }
662
663 static jvmtiError GetObjectSize(jvmtiEnv* env, jobject object, jlong* size_ptr) {
Andreas Gampe50a4e492017-01-06 18:00:20 -0800664 return ObjectUtil::GetObjectSize(env, object, size_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700665 }
666
667 static jvmtiError GetObjectHashCode(jvmtiEnv* env, jobject object, jint* hash_code_ptr) {
Andreas Gampe50a4e492017-01-06 18:00:20 -0800668 return ObjectUtil::GetObjectHashCode(env, object, hash_code_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700669 }
670
671 static jvmtiError GetObjectMonitorUsage(jvmtiEnv* env,
672 jobject object,
673 jvmtiMonitorUsage* info_ptr) {
674 return ERR(NOT_IMPLEMENTED);
675 }
676
677 static jvmtiError GetFieldName(jvmtiEnv* env,
678 jclass klass,
679 jfieldID field,
680 char** name_ptr,
681 char** signature_ptr,
682 char** generic_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800683 return FieldUtil::GetFieldName(env, klass, field, name_ptr, signature_ptr, generic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700684 }
685
686 static jvmtiError GetFieldDeclaringClass(jvmtiEnv* env,
687 jclass klass,
688 jfieldID field,
689 jclass* declaring_class_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800690 return FieldUtil::GetFieldDeclaringClass(env, klass, field, declaring_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700691 }
692
693 static jvmtiError GetFieldModifiers(jvmtiEnv* env,
694 jclass klass,
695 jfieldID field,
696 jint* modifiers_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800697 return FieldUtil::GetFieldModifiers(env, klass, field, modifiers_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700698 }
699
700 static jvmtiError IsFieldSynthetic(jvmtiEnv* env,
701 jclass klass,
702 jfieldID field,
703 jboolean* is_synthetic_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800704 return FieldUtil::IsFieldSynthetic(env, klass, field, is_synthetic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700705 }
706
707 static jvmtiError GetMethodName(jvmtiEnv* env,
708 jmethodID method,
709 char** name_ptr,
710 char** signature_ptr,
711 char** generic_ptr) {
Andreas Gampe3c252f02016-10-27 18:25:17 -0700712 return MethodUtil::GetMethodName(env, method, name_ptr, signature_ptr, generic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700713 }
714
715 static jvmtiError GetMethodDeclaringClass(jvmtiEnv* env,
716 jmethodID method,
717 jclass* declaring_class_ptr) {
Andreas Gampe368a2082016-10-28 17:33:13 -0700718 return MethodUtil::GetMethodDeclaringClass(env, method, declaring_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700719 }
720
721 static jvmtiError GetMethodModifiers(jvmtiEnv* env,
722 jmethodID method,
723 jint* modifiers_ptr) {
Andreas Gampe36bcd4f2016-10-28 18:07:18 -0700724 return MethodUtil::GetMethodModifiers(env, method, modifiers_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700725 }
726
727 static jvmtiError GetMaxLocals(jvmtiEnv* env,
728 jmethodID method,
729 jint* max_ptr) {
Andreas Gampef71832e2017-01-09 11:38:04 -0800730 return MethodUtil::GetMaxLocals(env, method, max_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700731 }
732
733 static jvmtiError GetArgumentsSize(jvmtiEnv* env,
734 jmethodID method,
735 jint* size_ptr) {
Andreas Gampef71832e2017-01-09 11:38:04 -0800736 return MethodUtil::GetArgumentsSize(env, method, size_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700737 }
738
739 static jvmtiError GetLineNumberTable(jvmtiEnv* env,
740 jmethodID method,
741 jint* entry_count_ptr,
742 jvmtiLineNumberEntry** table_ptr) {
Andreas Gampeda3e5612016-12-13 19:00:53 -0800743 return MethodUtil::GetLineNumberTable(env, method, entry_count_ptr, table_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700744 }
745
746 static jvmtiError GetMethodLocation(jvmtiEnv* env,
747 jmethodID method,
748 jlocation* start_location_ptr,
749 jlocation* end_location_ptr) {
Andreas Gampef71832e2017-01-09 11:38:04 -0800750 return MethodUtil::GetMethodLocation(env, method, start_location_ptr, end_location_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700751 }
752
753 static jvmtiError GetLocalVariableTable(jvmtiEnv* env,
754 jmethodID method,
755 jint* entry_count_ptr,
756 jvmtiLocalVariableEntry** table_ptr) {
757 return ERR(NOT_IMPLEMENTED);
758 }
759
760 static jvmtiError GetBytecodes(jvmtiEnv* env,
761 jmethodID method,
762 jint* bytecode_count_ptr,
763 unsigned char** bytecodes_ptr) {
764 return ERR(NOT_IMPLEMENTED);
765 }
766
767 static jvmtiError IsMethodNative(jvmtiEnv* env, jmethodID method, jboolean* is_native_ptr) {
Andreas Gampefdeef522017-01-09 14:40:25 -0800768 return MethodUtil::IsMethodNative(env, method, is_native_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700769 }
770
771 static jvmtiError IsMethodSynthetic(jvmtiEnv* env, jmethodID method, jboolean* is_synthetic_ptr) {
Andreas Gampefdeef522017-01-09 14:40:25 -0800772 return MethodUtil::IsMethodSynthetic(env, method, is_synthetic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700773 }
774
775 static jvmtiError IsMethodObsolete(jvmtiEnv* env, jmethodID method, jboolean* is_obsolete_ptr) {
Andreas Gampefdeef522017-01-09 14:40:25 -0800776 return MethodUtil::IsMethodObsolete(env, method, is_obsolete_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700777 }
778
779 static jvmtiError SetNativeMethodPrefix(jvmtiEnv* env, const char* prefix) {
780 return ERR(NOT_IMPLEMENTED);
781 }
782
783 static jvmtiError SetNativeMethodPrefixes(jvmtiEnv* env, jint prefix_count, char** prefixes) {
784 return ERR(NOT_IMPLEMENTED);
785 }
786
787 static jvmtiError CreateRawMonitor(jvmtiEnv* env, const char* name, jrawMonitorID* monitor_ptr) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800788 return MonitorUtil::CreateRawMonitor(env, name, monitor_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700789 }
790
791 static jvmtiError DestroyRawMonitor(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800792 return MonitorUtil::DestroyRawMonitor(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700793 }
794
795 static jvmtiError RawMonitorEnter(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800796 return MonitorUtil::RawMonitorEnter(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700797 }
798
799 static jvmtiError RawMonitorExit(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800800 return MonitorUtil::RawMonitorExit(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700801 }
802
803 static jvmtiError RawMonitorWait(jvmtiEnv* env, jrawMonitorID monitor, jlong millis) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800804 return MonitorUtil::RawMonitorWait(env, monitor, millis);
Alex Light49948e92016-08-11 15:35:28 -0700805 }
806
807 static jvmtiError RawMonitorNotify(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800808 return MonitorUtil::RawMonitorNotify(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700809 }
810
811 static jvmtiError RawMonitorNotifyAll(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800812 return MonitorUtil::RawMonitorNotifyAll(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700813 }
814
815 static jvmtiError SetJNIFunctionTable(jvmtiEnv* env, const jniNativeInterface* function_table) {
Andreas Gampe6f8e4f02017-01-16 18:18:14 -0800816 return JNIUtil::SetJNIFunctionTable(env, function_table);
Alex Light49948e92016-08-11 15:35:28 -0700817 }
818
819 static jvmtiError GetJNIFunctionTable(jvmtiEnv* env, jniNativeInterface** function_table) {
Andreas Gampe6f8e4f02017-01-16 18:18:14 -0800820 return JNIUtil::GetJNIFunctionTable(env, function_table);
Alex Light49948e92016-08-11 15:35:28 -0700821 }
822
Andreas Gampe77708d92016-10-07 11:48:21 -0700823 // TODO: This will require locking, so that an agent can't remove callbacks when we're dispatching
824 // an event.
Alex Light49948e92016-08-11 15:35:28 -0700825 static jvmtiError SetEventCallbacks(jvmtiEnv* env,
826 const jvmtiEventCallbacks* callbacks,
827 jint size_of_callbacks) {
Alex Lighte6574242016-08-17 09:56:24 -0700828 ENSURE_VALID_ENV(env);
Andreas Gampe77708d92016-10-07 11:48:21 -0700829 if (size_of_callbacks < 0) {
830 return ERR(ILLEGAL_ARGUMENT);
831 }
832
833 if (callbacks == nullptr) {
834 ArtJvmTiEnv::AsArtJvmTiEnv(env)->event_callbacks.reset();
835 return ERR(NONE);
836 }
837
838 std::unique_ptr<jvmtiEventCallbacks> tmp(new jvmtiEventCallbacks());
839 memset(tmp.get(), 0, sizeof(jvmtiEventCallbacks));
840 size_t copy_size = std::min(sizeof(jvmtiEventCallbacks),
841 static_cast<size_t>(size_of_callbacks));
842 copy_size = art::RoundDown(copy_size, sizeof(void*));
843 memcpy(tmp.get(), callbacks, copy_size);
844
845 ArtJvmTiEnv::AsArtJvmTiEnv(env)->event_callbacks = std::move(tmp);
846
847 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700848 }
849
850 static jvmtiError SetEventNotificationMode(jvmtiEnv* env,
851 jvmtiEventMode mode,
852 jvmtiEvent event_type,
853 jthread event_thread,
854 ...) {
Alex Lighte6574242016-08-17 09:56:24 -0700855 ENSURE_VALID_ENV(env);
856 // TODO: Check for capabilities.
Andreas Gampe77708d92016-10-07 11:48:21 -0700857 art::Thread* art_thread = nullptr;
858 if (event_thread != nullptr) {
859 // TODO: Need non-aborting call here, to return JVMTI_ERROR_INVALID_THREAD.
860 art::ScopedObjectAccess soa(art::Thread::Current());
861 art::MutexLock mu(soa.Self(), *art::Locks::thread_list_lock_);
862 art_thread = art::Thread::FromManagedThread(soa, event_thread);
863
864 if (art_thread == nullptr || // The thread hasn't been started or is already dead.
865 art_thread->IsStillStarting()) {
866 // TODO: We may want to let the EventHandler know, so it could clean up masks, potentially.
867 return ERR(THREAD_NOT_ALIVE);
868 }
869 }
870
Alex Light40d87f42017-01-18 10:27:06 -0800871 ArtJvmTiEnv* art_env = ArtJvmTiEnv::AsArtJvmTiEnv(env);
872 return gEventHandler.SetEvent(art_env, art_thread, GetArtJvmtiEvent(art_env, event_type), mode);
Alex Light49948e92016-08-11 15:35:28 -0700873 }
874
875 static jvmtiError GenerateEvents(jvmtiEnv* env, jvmtiEvent event_type) {
876 return ERR(NOT_IMPLEMENTED);
877 }
878
879 static jvmtiError GetExtensionFunctions(jvmtiEnv* env,
880 jint* extension_count_ptr,
881 jvmtiExtensionFunctionInfo** extensions) {
Andreas Gampee4c33842017-01-09 10:50:17 -0800882 // We do not have any extension functions.
883 *extension_count_ptr = 0;
884 *extensions = nullptr;
885
886 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700887 }
888
889 static jvmtiError GetExtensionEvents(jvmtiEnv* env,
890 jint* extension_count_ptr,
891 jvmtiExtensionEventInfo** extensions) {
Andreas Gampee4c33842017-01-09 10:50:17 -0800892 // We do not have any extension events.
893 *extension_count_ptr = 0;
894 *extensions = nullptr;
895
896 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700897 }
898
899 static jvmtiError SetExtensionEventCallback(jvmtiEnv* env,
900 jint extension_event_index,
901 jvmtiExtensionEvent callback) {
Andreas Gampee4c33842017-01-09 10:50:17 -0800902 // We do not have any extension events, so any call is illegal.
903 return ERR(ILLEGAL_ARGUMENT);
Alex Light49948e92016-08-11 15:35:28 -0700904 }
905
906 static jvmtiError GetPotentialCapabilities(jvmtiEnv* env, jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700907 ENSURE_VALID_ENV(env);
908 ENSURE_NON_NULL(capabilities_ptr);
909 *capabilities_ptr = kPotentialCapabilities;
910 return OK;
Alex Light49948e92016-08-11 15:35:28 -0700911 }
912
913 static jvmtiError AddCapabilities(jvmtiEnv* env, const jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700914 ENSURE_VALID_ENV(env);
915 ENSURE_NON_NULL(capabilities_ptr);
916 ArtJvmTiEnv* art_env = static_cast<ArtJvmTiEnv*>(env);
917 jvmtiError ret = OK;
Alex Light73afd322017-01-18 11:17:47 -0800918 jvmtiCapabilities changed;
Alex Lighte6574242016-08-17 09:56:24 -0700919#define ADD_CAPABILITY(e) \
920 do { \
921 if (capabilities_ptr->e == 1) { \
922 if (kPotentialCapabilities.e == 1) { \
Alex Light73afd322017-01-18 11:17:47 -0800923 if (art_env->capabilities.e != 1) { \
924 art_env->capabilities.e = 1; \
925 changed.e = 1; \
926 }\
Alex Lighte6574242016-08-17 09:56:24 -0700927 } else { \
928 ret = ERR(NOT_AVAILABLE); \
929 } \
930 } \
931 } while (false)
932
933 ADD_CAPABILITY(can_tag_objects);
934 ADD_CAPABILITY(can_generate_field_modification_events);
935 ADD_CAPABILITY(can_generate_field_access_events);
936 ADD_CAPABILITY(can_get_bytecodes);
937 ADD_CAPABILITY(can_get_synthetic_attribute);
938 ADD_CAPABILITY(can_get_owned_monitor_info);
939 ADD_CAPABILITY(can_get_current_contended_monitor);
940 ADD_CAPABILITY(can_get_monitor_info);
941 ADD_CAPABILITY(can_pop_frame);
942 ADD_CAPABILITY(can_redefine_classes);
943 ADD_CAPABILITY(can_signal_thread);
944 ADD_CAPABILITY(can_get_source_file_name);
945 ADD_CAPABILITY(can_get_line_numbers);
946 ADD_CAPABILITY(can_get_source_debug_extension);
947 ADD_CAPABILITY(can_access_local_variables);
948 ADD_CAPABILITY(can_maintain_original_method_order);
949 ADD_CAPABILITY(can_generate_single_step_events);
950 ADD_CAPABILITY(can_generate_exception_events);
951 ADD_CAPABILITY(can_generate_frame_pop_events);
952 ADD_CAPABILITY(can_generate_breakpoint_events);
953 ADD_CAPABILITY(can_suspend);
954 ADD_CAPABILITY(can_redefine_any_class);
955 ADD_CAPABILITY(can_get_current_thread_cpu_time);
956 ADD_CAPABILITY(can_get_thread_cpu_time);
957 ADD_CAPABILITY(can_generate_method_entry_events);
958 ADD_CAPABILITY(can_generate_method_exit_events);
959 ADD_CAPABILITY(can_generate_all_class_hook_events);
960 ADD_CAPABILITY(can_generate_compiled_method_load_events);
961 ADD_CAPABILITY(can_generate_monitor_events);
962 ADD_CAPABILITY(can_generate_vm_object_alloc_events);
963 ADD_CAPABILITY(can_generate_native_method_bind_events);
964 ADD_CAPABILITY(can_generate_garbage_collection_events);
965 ADD_CAPABILITY(can_generate_object_free_events);
966 ADD_CAPABILITY(can_force_early_return);
967 ADD_CAPABILITY(can_get_owned_monitor_stack_depth_info);
968 ADD_CAPABILITY(can_get_constant_pool);
969 ADD_CAPABILITY(can_set_native_method_prefix);
970 ADD_CAPABILITY(can_retransform_classes);
971 ADD_CAPABILITY(can_retransform_any_class);
972 ADD_CAPABILITY(can_generate_resource_exhaustion_heap_events);
973 ADD_CAPABILITY(can_generate_resource_exhaustion_threads_events);
974#undef ADD_CAPABILITY
Alex Light73afd322017-01-18 11:17:47 -0800975 gEventHandler.HandleChangedCapabilities(ArtJvmTiEnv::AsArtJvmTiEnv(env),
976 changed,
977 /*added*/true);
Alex Lighte6574242016-08-17 09:56:24 -0700978 return ret;
Alex Light49948e92016-08-11 15:35:28 -0700979 }
980
981 static jvmtiError RelinquishCapabilities(jvmtiEnv* env,
982 const jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700983 ENSURE_VALID_ENV(env);
984 ENSURE_NON_NULL(capabilities_ptr);
985 ArtJvmTiEnv* art_env = reinterpret_cast<ArtJvmTiEnv*>(env);
Alex Light73afd322017-01-18 11:17:47 -0800986 jvmtiCapabilities changed;
Alex Lighte6574242016-08-17 09:56:24 -0700987#define DEL_CAPABILITY(e) \
988 do { \
989 if (capabilities_ptr->e == 1) { \
Alex Light73afd322017-01-18 11:17:47 -0800990 if (art_env->capabilities.e == 1) { \
991 art_env->capabilities.e = 0;\
992 changed.e = 1; \
993 } \
Alex Lighte6574242016-08-17 09:56:24 -0700994 } \
995 } while (false)
996
997 DEL_CAPABILITY(can_tag_objects);
998 DEL_CAPABILITY(can_generate_field_modification_events);
999 DEL_CAPABILITY(can_generate_field_access_events);
1000 DEL_CAPABILITY(can_get_bytecodes);
1001 DEL_CAPABILITY(can_get_synthetic_attribute);
1002 DEL_CAPABILITY(can_get_owned_monitor_info);
1003 DEL_CAPABILITY(can_get_current_contended_monitor);
1004 DEL_CAPABILITY(can_get_monitor_info);
1005 DEL_CAPABILITY(can_pop_frame);
1006 DEL_CAPABILITY(can_redefine_classes);
1007 DEL_CAPABILITY(can_signal_thread);
1008 DEL_CAPABILITY(can_get_source_file_name);
1009 DEL_CAPABILITY(can_get_line_numbers);
1010 DEL_CAPABILITY(can_get_source_debug_extension);
1011 DEL_CAPABILITY(can_access_local_variables);
1012 DEL_CAPABILITY(can_maintain_original_method_order);
1013 DEL_CAPABILITY(can_generate_single_step_events);
1014 DEL_CAPABILITY(can_generate_exception_events);
1015 DEL_CAPABILITY(can_generate_frame_pop_events);
1016 DEL_CAPABILITY(can_generate_breakpoint_events);
1017 DEL_CAPABILITY(can_suspend);
1018 DEL_CAPABILITY(can_redefine_any_class);
1019 DEL_CAPABILITY(can_get_current_thread_cpu_time);
1020 DEL_CAPABILITY(can_get_thread_cpu_time);
1021 DEL_CAPABILITY(can_generate_method_entry_events);
1022 DEL_CAPABILITY(can_generate_method_exit_events);
1023 DEL_CAPABILITY(can_generate_all_class_hook_events);
1024 DEL_CAPABILITY(can_generate_compiled_method_load_events);
1025 DEL_CAPABILITY(can_generate_monitor_events);
1026 DEL_CAPABILITY(can_generate_vm_object_alloc_events);
1027 DEL_CAPABILITY(can_generate_native_method_bind_events);
1028 DEL_CAPABILITY(can_generate_garbage_collection_events);
1029 DEL_CAPABILITY(can_generate_object_free_events);
1030 DEL_CAPABILITY(can_force_early_return);
1031 DEL_CAPABILITY(can_get_owned_monitor_stack_depth_info);
1032 DEL_CAPABILITY(can_get_constant_pool);
1033 DEL_CAPABILITY(can_set_native_method_prefix);
1034 DEL_CAPABILITY(can_retransform_classes);
1035 DEL_CAPABILITY(can_retransform_any_class);
1036 DEL_CAPABILITY(can_generate_resource_exhaustion_heap_events);
1037 DEL_CAPABILITY(can_generate_resource_exhaustion_threads_events);
1038#undef DEL_CAPABILITY
Alex Light73afd322017-01-18 11:17:47 -08001039 gEventHandler.HandleChangedCapabilities(ArtJvmTiEnv::AsArtJvmTiEnv(env),
1040 changed,
1041 /*added*/false);
Alex Lighte6574242016-08-17 09:56:24 -07001042 return OK;
Alex Light49948e92016-08-11 15:35:28 -07001043 }
1044
1045 static jvmtiError GetCapabilities(jvmtiEnv* env, jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001046 ENSURE_VALID_ENV(env);
1047 ENSURE_NON_NULL(capabilities_ptr);
1048 ArtJvmTiEnv* artenv = reinterpret_cast<ArtJvmTiEnv*>(env);
1049 *capabilities_ptr = artenv->capabilities;
1050 return OK;
Alex Light49948e92016-08-11 15:35:28 -07001051 }
1052
1053 static jvmtiError GetCurrentThreadCpuTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) {
1054 return ERR(NOT_IMPLEMENTED);
1055 }
1056
1057 static jvmtiError GetCurrentThreadCpuTime(jvmtiEnv* env, jlong* nanos_ptr) {
1058 return ERR(NOT_IMPLEMENTED);
1059 }
1060
1061 static jvmtiError GetThreadCpuTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) {
1062 return ERR(NOT_IMPLEMENTED);
1063 }
1064
1065 static jvmtiError GetThreadCpuTime(jvmtiEnv* env, jthread thread, jlong* nanos_ptr) {
1066 return ERR(NOT_IMPLEMENTED);
1067 }
1068
1069 static jvmtiError GetTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) {
Andreas Gampe35bcf812017-01-13 16:24:17 -08001070 return TimerUtil::GetTimerInfo(env, info_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001071 }
1072
1073 static jvmtiError GetTime(jvmtiEnv* env, jlong* nanos_ptr) {
Andreas Gampe35bcf812017-01-13 16:24:17 -08001074 return TimerUtil::GetTime(env, nanos_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001075 }
1076
1077 static jvmtiError GetAvailableProcessors(jvmtiEnv* env, jint* processor_count_ptr) {
Andreas Gampe35bcf812017-01-13 16:24:17 -08001078 return TimerUtil::GetAvailableProcessors(env, processor_count_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001079 }
1080
1081 static jvmtiError AddToBootstrapClassLoaderSearch(jvmtiEnv* env, const char* segment) {
Andreas Gampece7732b2017-01-17 15:50:26 -08001082 return SearchUtil::AddToBootstrapClassLoaderSearch(env, segment);
Alex Light49948e92016-08-11 15:35:28 -07001083 }
1084
1085 static jvmtiError AddToSystemClassLoaderSearch(jvmtiEnv* env, const char* segment) {
Andreas Gampece7732b2017-01-17 15:50:26 -08001086 return SearchUtil::AddToSystemClassLoaderSearch(env, segment);
Alex Light49948e92016-08-11 15:35:28 -07001087 }
1088
1089 static jvmtiError GetSystemProperties(jvmtiEnv* env, jint* count_ptr, char*** property_ptr) {
Andreas Gampe1bdaf732017-01-09 19:21:06 -08001090 return PropertiesUtil::GetSystemProperties(env, count_ptr, property_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001091 }
1092
1093 static jvmtiError GetSystemProperty(jvmtiEnv* env, const char* property, char** value_ptr) {
Andreas Gampe1bdaf732017-01-09 19:21:06 -08001094 return PropertiesUtil::GetSystemProperty(env, property, value_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001095 }
1096
1097 static jvmtiError SetSystemProperty(jvmtiEnv* env, const char* property, const char* value) {
Andreas Gampe1bdaf732017-01-09 19:21:06 -08001098 return PropertiesUtil::SetSystemProperty(env, property, value);
Alex Light49948e92016-08-11 15:35:28 -07001099 }
1100
1101 static jvmtiError GetPhase(jvmtiEnv* env, jvmtiPhase* phase_ptr) {
1102 return ERR(NOT_IMPLEMENTED);
1103 }
1104
1105 static jvmtiError DisposeEnvironment(jvmtiEnv* env) {
Alex Lighte6574242016-08-17 09:56:24 -07001106 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001107 delete env;
1108 return OK;
1109 }
1110
1111 static jvmtiError SetEnvironmentLocalStorage(jvmtiEnv* env, const void* data) {
Alex Lighte6574242016-08-17 09:56:24 -07001112 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001113 reinterpret_cast<ArtJvmTiEnv*>(env)->local_data = const_cast<void*>(data);
1114 return OK;
1115 }
1116
1117 static jvmtiError GetEnvironmentLocalStorage(jvmtiEnv* env, void** data_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001118 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001119 *data_ptr = reinterpret_cast<ArtJvmTiEnv*>(env)->local_data;
1120 return OK;
1121 }
1122
1123 static jvmtiError GetVersionNumber(jvmtiEnv* env, jint* version_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001124 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001125 *version_ptr = JVMTI_VERSION;
1126 return OK;
1127 }
1128
1129 static jvmtiError GetErrorName(jvmtiEnv* env, jvmtiError error, char** name_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001130 ENSURE_NON_NULL(name_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001131 switch (error) {
1132#define ERROR_CASE(e) case (JVMTI_ERROR_ ## e) : do { \
Alex Light41960712017-01-06 14:44:23 -08001133 jvmtiError res = CopyString(env, \
1134 "JVMTI_ERROR_"#e, \
1135 reinterpret_cast<unsigned char**>(name_ptr)); \
1136 if (res != OK) { \
1137 *name_ptr = nullptr; \
1138 return res; \
1139 } else { \
1140 return OK; \
1141 } \
Alex Light49948e92016-08-11 15:35:28 -07001142 } while (false)
1143 ERROR_CASE(NONE);
1144 ERROR_CASE(INVALID_THREAD);
1145 ERROR_CASE(INVALID_THREAD_GROUP);
1146 ERROR_CASE(INVALID_PRIORITY);
1147 ERROR_CASE(THREAD_NOT_SUSPENDED);
1148 ERROR_CASE(THREAD_NOT_ALIVE);
1149 ERROR_CASE(INVALID_OBJECT);
1150 ERROR_CASE(INVALID_CLASS);
1151 ERROR_CASE(CLASS_NOT_PREPARED);
1152 ERROR_CASE(INVALID_METHODID);
1153 ERROR_CASE(INVALID_LOCATION);
1154 ERROR_CASE(INVALID_FIELDID);
1155 ERROR_CASE(NO_MORE_FRAMES);
1156 ERROR_CASE(OPAQUE_FRAME);
1157 ERROR_CASE(TYPE_MISMATCH);
1158 ERROR_CASE(INVALID_SLOT);
1159 ERROR_CASE(DUPLICATE);
1160 ERROR_CASE(NOT_FOUND);
1161 ERROR_CASE(INVALID_MONITOR);
1162 ERROR_CASE(NOT_MONITOR_OWNER);
1163 ERROR_CASE(INTERRUPT);
1164 ERROR_CASE(INVALID_CLASS_FORMAT);
1165 ERROR_CASE(CIRCULAR_CLASS_DEFINITION);
1166 ERROR_CASE(FAILS_VERIFICATION);
1167 ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_ADDED);
1168 ERROR_CASE(UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED);
1169 ERROR_CASE(INVALID_TYPESTATE);
1170 ERROR_CASE(UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED);
1171 ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_DELETED);
1172 ERROR_CASE(UNSUPPORTED_VERSION);
1173 ERROR_CASE(NAMES_DONT_MATCH);
1174 ERROR_CASE(UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED);
1175 ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED);
1176 ERROR_CASE(UNMODIFIABLE_CLASS);
1177 ERROR_CASE(NOT_AVAILABLE);
1178 ERROR_CASE(MUST_POSSESS_CAPABILITY);
1179 ERROR_CASE(NULL_POINTER);
1180 ERROR_CASE(ABSENT_INFORMATION);
1181 ERROR_CASE(INVALID_EVENT_TYPE);
1182 ERROR_CASE(ILLEGAL_ARGUMENT);
1183 ERROR_CASE(NATIVE_METHOD);
1184 ERROR_CASE(CLASS_LOADER_UNSUPPORTED);
1185 ERROR_CASE(OUT_OF_MEMORY);
1186 ERROR_CASE(ACCESS_DENIED);
1187 ERROR_CASE(WRONG_PHASE);
1188 ERROR_CASE(INTERNAL);
1189 ERROR_CASE(UNATTACHED_THREAD);
1190 ERROR_CASE(INVALID_ENVIRONMENT);
1191#undef ERROR_CASE
1192 default: {
Alex Light41960712017-01-06 14:44:23 -08001193 jvmtiError res = CopyString(env,
1194 "JVMTI_ERROR_UNKNOWN",
1195 reinterpret_cast<unsigned char**>(name_ptr));
1196 if (res != OK) {
1197 *name_ptr = nullptr;
1198 return res;
1199 } else {
1200 return ERR(ILLEGAL_ARGUMENT);
1201 }
Alex Light49948e92016-08-11 15:35:28 -07001202 }
1203 }
1204 }
1205
1206 static jvmtiError SetVerboseFlag(jvmtiEnv* env, jvmtiVerboseFlag flag, jboolean value) {
Andreas Gampef37e3022017-01-13 17:54:46 -08001207 if (flag == jvmtiVerboseFlag::JVMTI_VERBOSE_OTHER) {
1208 // OTHER is special, as it's 0, so can't do a bit check.
1209 bool val = (value == JNI_TRUE) ? true : false;
1210
1211 art::gLogVerbosity.collector = val;
1212 art::gLogVerbosity.compiler = val;
1213 art::gLogVerbosity.deopt = val;
1214 art::gLogVerbosity.heap = val;
1215 art::gLogVerbosity.jdwp = val;
1216 art::gLogVerbosity.jit = val;
1217 art::gLogVerbosity.monitor = val;
1218 art::gLogVerbosity.oat = val;
1219 art::gLogVerbosity.profiler = val;
1220 art::gLogVerbosity.signals = val;
1221 art::gLogVerbosity.simulator = val;
1222 art::gLogVerbosity.startup = val;
1223 art::gLogVerbosity.third_party_jni = val;
1224 art::gLogVerbosity.threads = val;
1225 art::gLogVerbosity.verifier = val;
1226 art::gLogVerbosity.image = val;
1227
1228 // Note: can't switch systrace_lock_logging. That requires changing entrypoints.
1229
1230 art::gLogVerbosity.agents = val;
1231 } else {
1232 // Spec isn't clear whether "flag" is a mask or supposed to be single. We implement the mask
1233 // semantics.
1234 constexpr std::underlying_type<jvmtiVerboseFlag>::type kMask =
1235 jvmtiVerboseFlag::JVMTI_VERBOSE_GC |
1236 jvmtiVerboseFlag::JVMTI_VERBOSE_CLASS |
1237 jvmtiVerboseFlag::JVMTI_VERBOSE_JNI;
1238 if ((flag & ~kMask) != 0) {
1239 return ERR(ILLEGAL_ARGUMENT);
1240 }
1241
1242 bool val = (value == JNI_TRUE) ? true : false;
1243
1244 if ((flag & jvmtiVerboseFlag::JVMTI_VERBOSE_GC) != 0) {
1245 art::gLogVerbosity.gc = val;
1246 }
1247
1248 if ((flag & jvmtiVerboseFlag::JVMTI_VERBOSE_CLASS) != 0) {
1249 art::gLogVerbosity.class_linker = val;
1250 }
1251
1252 if ((flag & jvmtiVerboseFlag::JVMTI_VERBOSE_JNI) != 0) {
1253 art::gLogVerbosity.jni = val;
1254 }
1255 }
1256
1257 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -07001258 }
1259
1260 static jvmtiError GetJLocationFormat(jvmtiEnv* env, jvmtiJlocationFormat* format_ptr) {
Andreas Gampeacfc9572017-01-17 18:36:56 -08001261 // Report BCI as jlocation format. We report dex bytecode indices.
1262 if (format_ptr == nullptr) {
1263 return ERR(NULL_POINTER);
1264 }
1265 *format_ptr = jvmtiJlocationFormat::JVMTI_JLOCATION_JVMBCI;
1266 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -07001267 }
1268};
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 Light6ac57502017-01-19 15:05:06 -08001310 nullptr, // reserved1
Alex Light49948e92016-08-11 15:35:28 -07001311 JvmtiFunctions::SetEventNotificationMode,
Alex Light0e692732017-01-10 15:00:05 -08001312 nullptr, // reserved3
Alex Light49948e92016-08-11 15:35:28 -07001313 JvmtiFunctions::GetAllThreads,
1314 JvmtiFunctions::SuspendThread,
1315 JvmtiFunctions::ResumeThread,
1316 JvmtiFunctions::StopThread,
1317 JvmtiFunctions::InterruptThread,
1318 JvmtiFunctions::GetThreadInfo,
1319 JvmtiFunctions::GetOwnedMonitorInfo, // 10
1320 JvmtiFunctions::GetCurrentContendedMonitor,
1321 JvmtiFunctions::RunAgentThread,
1322 JvmtiFunctions::GetTopThreadGroups,
1323 JvmtiFunctions::GetThreadGroupInfo,
1324 JvmtiFunctions::GetThreadGroupChildren,
1325 JvmtiFunctions::GetFrameCount,
1326 JvmtiFunctions::GetThreadState,
1327 JvmtiFunctions::GetCurrentThread,
1328 JvmtiFunctions::GetFrameLocation,
1329 JvmtiFunctions::NotifyFramePop, // 20
1330 JvmtiFunctions::GetLocalObject,
1331 JvmtiFunctions::GetLocalInt,
1332 JvmtiFunctions::GetLocalLong,
1333 JvmtiFunctions::GetLocalFloat,
1334 JvmtiFunctions::GetLocalDouble,
1335 JvmtiFunctions::SetLocalObject,
1336 JvmtiFunctions::SetLocalInt,
1337 JvmtiFunctions::SetLocalLong,
1338 JvmtiFunctions::SetLocalFloat,
1339 JvmtiFunctions::SetLocalDouble, // 30
1340 JvmtiFunctions::CreateRawMonitor,
1341 JvmtiFunctions::DestroyRawMonitor,
1342 JvmtiFunctions::RawMonitorEnter,
1343 JvmtiFunctions::RawMonitorExit,
1344 JvmtiFunctions::RawMonitorWait,
1345 JvmtiFunctions::RawMonitorNotify,
1346 JvmtiFunctions::RawMonitorNotifyAll,
1347 JvmtiFunctions::SetBreakpoint,
1348 JvmtiFunctions::ClearBreakpoint,
1349 nullptr, // reserved40
1350 JvmtiFunctions::SetFieldAccessWatch,
1351 JvmtiFunctions::ClearFieldAccessWatch,
1352 JvmtiFunctions::SetFieldModificationWatch,
1353 JvmtiFunctions::ClearFieldModificationWatch,
1354 JvmtiFunctions::IsModifiableClass,
1355 JvmtiFunctions::Allocate,
1356 JvmtiFunctions::Deallocate,
1357 JvmtiFunctions::GetClassSignature,
1358 JvmtiFunctions::GetClassStatus,
1359 JvmtiFunctions::GetSourceFileName, // 50
1360 JvmtiFunctions::GetClassModifiers,
1361 JvmtiFunctions::GetClassMethods,
1362 JvmtiFunctions::GetClassFields,
1363 JvmtiFunctions::GetImplementedInterfaces,
1364 JvmtiFunctions::IsInterface,
1365 JvmtiFunctions::IsArrayClass,
1366 JvmtiFunctions::GetClassLoader,
1367 JvmtiFunctions::GetObjectHashCode,
1368 JvmtiFunctions::GetObjectMonitorUsage,
1369 JvmtiFunctions::GetFieldName, // 60
1370 JvmtiFunctions::GetFieldDeclaringClass,
1371 JvmtiFunctions::GetFieldModifiers,
1372 JvmtiFunctions::IsFieldSynthetic,
1373 JvmtiFunctions::GetMethodName,
1374 JvmtiFunctions::GetMethodDeclaringClass,
1375 JvmtiFunctions::GetMethodModifiers,
1376 nullptr, // reserved67
1377 JvmtiFunctions::GetMaxLocals,
1378 JvmtiFunctions::GetArgumentsSize,
1379 JvmtiFunctions::GetLineNumberTable, // 70
1380 JvmtiFunctions::GetMethodLocation,
1381 JvmtiFunctions::GetLocalVariableTable,
1382 JvmtiFunctions::SetNativeMethodPrefix,
1383 JvmtiFunctions::SetNativeMethodPrefixes,
1384 JvmtiFunctions::GetBytecodes,
1385 JvmtiFunctions::IsMethodNative,
1386 JvmtiFunctions::IsMethodSynthetic,
1387 JvmtiFunctions::GetLoadedClasses,
1388 JvmtiFunctions::GetClassLoaderClasses,
1389 JvmtiFunctions::PopFrame, // 80
1390 JvmtiFunctions::ForceEarlyReturnObject,
1391 JvmtiFunctions::ForceEarlyReturnInt,
1392 JvmtiFunctions::ForceEarlyReturnLong,
1393 JvmtiFunctions::ForceEarlyReturnFloat,
1394 JvmtiFunctions::ForceEarlyReturnDouble,
1395 JvmtiFunctions::ForceEarlyReturnVoid,
1396 JvmtiFunctions::RedefineClasses,
1397 JvmtiFunctions::GetVersionNumber,
1398 JvmtiFunctions::GetCapabilities,
1399 JvmtiFunctions::GetSourceDebugExtension, // 90
1400 JvmtiFunctions::IsMethodObsolete,
1401 JvmtiFunctions::SuspendThreadList,
1402 JvmtiFunctions::ResumeThreadList,
1403 nullptr, // reserved94
1404 nullptr, // reserved95
1405 nullptr, // reserved96
1406 nullptr, // reserved97
1407 nullptr, // reserved98
1408 nullptr, // reserved99
1409 JvmtiFunctions::GetAllStackTraces, // 100
1410 JvmtiFunctions::GetThreadListStackTraces,
1411 JvmtiFunctions::GetThreadLocalStorage,
1412 JvmtiFunctions::SetThreadLocalStorage,
1413 JvmtiFunctions::GetStackTrace,
1414 nullptr, // reserved105
1415 JvmtiFunctions::GetTag,
1416 JvmtiFunctions::SetTag,
1417 JvmtiFunctions::ForceGarbageCollection,
1418 JvmtiFunctions::IterateOverObjectsReachableFromObject,
1419 JvmtiFunctions::IterateOverReachableObjects, // 110
1420 JvmtiFunctions::IterateOverHeap,
1421 JvmtiFunctions::IterateOverInstancesOfClass,
1422 nullptr, // reserved113
1423 JvmtiFunctions::GetObjectsWithTags,
1424 JvmtiFunctions::FollowReferences,
1425 JvmtiFunctions::IterateThroughHeap,
1426 nullptr, // reserved117
1427 nullptr, // reserved118
1428 nullptr, // reserved119
1429 JvmtiFunctions::SetJNIFunctionTable, // 120
1430 JvmtiFunctions::GetJNIFunctionTable,
1431 JvmtiFunctions::SetEventCallbacks,
1432 JvmtiFunctions::GenerateEvents,
1433 JvmtiFunctions::GetExtensionFunctions,
1434 JvmtiFunctions::GetExtensionEvents,
1435 JvmtiFunctions::SetExtensionEventCallback,
1436 JvmtiFunctions::DisposeEnvironment,
1437 JvmtiFunctions::GetErrorName,
1438 JvmtiFunctions::GetJLocationFormat,
1439 JvmtiFunctions::GetSystemProperties, // 130
1440 JvmtiFunctions::GetSystemProperty,
1441 JvmtiFunctions::SetSystemProperty,
1442 JvmtiFunctions::GetPhase,
1443 JvmtiFunctions::GetCurrentThreadCpuTimerInfo,
1444 JvmtiFunctions::GetCurrentThreadCpuTime,
1445 JvmtiFunctions::GetThreadCpuTimerInfo,
1446 JvmtiFunctions::GetThreadCpuTime,
1447 JvmtiFunctions::GetTimerInfo,
1448 JvmtiFunctions::GetTime,
1449 JvmtiFunctions::GetPotentialCapabilities, // 140
1450 nullptr, // reserved141
1451 JvmtiFunctions::AddCapabilities,
1452 JvmtiFunctions::RelinquishCapabilities,
1453 JvmtiFunctions::GetAvailableProcessors,
1454 JvmtiFunctions::GetClassVersionNumbers,
1455 JvmtiFunctions::GetConstantPool,
1456 JvmtiFunctions::GetEnvironmentLocalStorage,
1457 JvmtiFunctions::SetEnvironmentLocalStorage,
1458 JvmtiFunctions::AddToBootstrapClassLoaderSearch,
1459 JvmtiFunctions::SetVerboseFlag, // 150
1460 JvmtiFunctions::AddToSystemClassLoaderSearch,
1461 JvmtiFunctions::RetransformClasses,
1462 JvmtiFunctions::GetOwnedMonitorStackDepthInfo,
1463 JvmtiFunctions::GetObjectSize,
1464 JvmtiFunctions::GetLocalInstance,
1465};
1466
1467}; // namespace openjdkjvmti