blob: 2629c9fc074ec1a068b5276d754d8b20df9be3c1 [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) {
129 return ERR(NOT_IMPLEMENTED);
130 }
131
132 static jvmtiError SuspendThread(jvmtiEnv* env, jthread thread) {
133 return ERR(NOT_IMPLEMENTED);
134 }
135
136 static jvmtiError SuspendThreadList(jvmtiEnv* env,
137 jint request_count,
138 const jthread* request_list,
139 jvmtiError* results) {
140 return ERR(NOT_IMPLEMENTED);
141 }
142
143 static jvmtiError ResumeThread(jvmtiEnv* env, jthread thread) {
144 return ERR(NOT_IMPLEMENTED);
145 }
146
147 static jvmtiError ResumeThreadList(jvmtiEnv* env,
148 jint request_count,
149 const jthread* request_list,
150 jvmtiError* results) {
151 return ERR(NOT_IMPLEMENTED);
152 }
153
154 static jvmtiError StopThread(jvmtiEnv* env, jthread thread, jobject exception) {
155 return ERR(NOT_IMPLEMENTED);
156 }
157
158 static jvmtiError InterruptThread(jvmtiEnv* env, jthread thread) {
159 return ERR(NOT_IMPLEMENTED);
160 }
161
162 static jvmtiError GetThreadInfo(jvmtiEnv* env, jthread thread, jvmtiThreadInfo* info_ptr) {
Andreas Gampeaf13ab92017-01-11 20:57:40 -0800163 return ThreadUtil::GetThreadInfo(env, thread, info_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700164 }
165
166 static jvmtiError GetOwnedMonitorInfo(jvmtiEnv* env,
167 jthread thread,
168 jint* owned_monitor_count_ptr,
169 jobject** owned_monitors_ptr) {
170 return ERR(NOT_IMPLEMENTED);
171 }
172
173 static jvmtiError GetOwnedMonitorStackDepthInfo(jvmtiEnv* env,
174 jthread thread,
175 jint* monitor_info_count_ptr,
176 jvmtiMonitorStackDepthInfo** monitor_info_ptr) {
177 return ERR(NOT_IMPLEMENTED);
178 }
179
180 static jvmtiError GetCurrentContendedMonitor(jvmtiEnv* env,
181 jthread thread,
182 jobject* monitor_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700183 return ERR(NOT_IMPLEMENTED);
Alex Light49948e92016-08-11 15:35:28 -0700184 }
185
186 static jvmtiError RunAgentThread(jvmtiEnv* env,
187 jthread thread,
188 jvmtiStartFunction proc,
189 const void* arg,
190 jint priority) {
191 return ERR(NOT_IMPLEMENTED);
192 }
193
194 static jvmtiError SetThreadLocalStorage(jvmtiEnv* env, jthread thread, const void* data) {
195 return ERR(NOT_IMPLEMENTED);
196 }
197
198 static jvmtiError GetThreadLocalStorage(jvmtiEnv* env, jthread thread, void** data_ptr) {
199 return ERR(NOT_IMPLEMENTED);
200 }
201
202 static jvmtiError GetTopThreadGroups(jvmtiEnv* env,
203 jint* group_count_ptr,
204 jthreadGroup** groups_ptr) {
205 return ERR(NOT_IMPLEMENTED);
206 }
207
208 static jvmtiError GetThreadGroupInfo(jvmtiEnv* env,
209 jthreadGroup group,
210 jvmtiThreadGroupInfo* info_ptr) {
211 return ERR(NOT_IMPLEMENTED);
212 }
213
214 static jvmtiError GetThreadGroupChildren(jvmtiEnv* env,
215 jthreadGroup group,
216 jint* thread_count_ptr,
217 jthread** threads_ptr,
218 jint* group_count_ptr,
219 jthreadGroup** groups_ptr) {
220 return ERR(NOT_IMPLEMENTED);
221 }
222
223 static jvmtiError GetStackTrace(jvmtiEnv* env,
224 jthread thread,
225 jint start_depth,
226 jint max_frame_count,
227 jvmtiFrameInfo* frame_buffer,
228 jint* count_ptr) {
Andreas Gampeb5eb94a2016-10-27 19:23:09 -0700229 return StackUtil::GetStackTrace(env,
230 thread,
231 start_depth,
232 max_frame_count,
233 frame_buffer,
234 count_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700235 }
236
237 static jvmtiError GetAllStackTraces(jvmtiEnv* env,
238 jint max_frame_count,
239 jvmtiStackInfo** stack_info_ptr,
240 jint* thread_count_ptr) {
Andreas Gampea1a27c62017-01-11 16:37:16 -0800241 return StackUtil::GetAllStackTraces(env, max_frame_count, stack_info_ptr, thread_count_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700242 }
243
244 static jvmtiError GetThreadListStackTraces(jvmtiEnv* env,
245 jint thread_count,
246 const jthread* thread_list,
247 jint max_frame_count,
248 jvmtiStackInfo** stack_info_ptr) {
249 return ERR(NOT_IMPLEMENTED);
250 }
251
252 static jvmtiError GetFrameCount(jvmtiEnv* env, jthread thread, jint* count_ptr) {
253 return ERR(NOT_IMPLEMENTED);
254 }
255
256 static jvmtiError PopFrame(jvmtiEnv* env, jthread thread) {
257 return ERR(NOT_IMPLEMENTED);
258 }
259
260 static jvmtiError GetFrameLocation(jvmtiEnv* env,
261 jthread thread,
262 jint depth,
263 jmethodID* method_ptr,
264 jlocation* location_ptr) {
265 return ERR(NOT_IMPLEMENTED);
266 }
267
268 static jvmtiError NotifyFramePop(jvmtiEnv* env, jthread thread, jint depth) {
269 return ERR(NOT_IMPLEMENTED);
270 }
271
272 static jvmtiError ForceEarlyReturnObject(jvmtiEnv* env, jthread thread, jobject value) {
273 return ERR(NOT_IMPLEMENTED);
274 }
275
276 static jvmtiError ForceEarlyReturnInt(jvmtiEnv* env, jthread thread, jint value) {
277 return ERR(NOT_IMPLEMENTED);
278 }
279
280 static jvmtiError ForceEarlyReturnLong(jvmtiEnv* env, jthread thread, jlong value) {
281 return ERR(NOT_IMPLEMENTED);
282 }
283
284 static jvmtiError ForceEarlyReturnFloat(jvmtiEnv* env, jthread thread, jfloat value) {
285 return ERR(NOT_IMPLEMENTED);
286 }
287
288 static jvmtiError ForceEarlyReturnDouble(jvmtiEnv* env, jthread thread, jdouble value) {
289 return ERR(NOT_IMPLEMENTED);
290 }
291
292 static jvmtiError ForceEarlyReturnVoid(jvmtiEnv* env, jthread thread) {
293 return ERR(NOT_IMPLEMENTED);
294 }
295
296 static jvmtiError FollowReferences(jvmtiEnv* env,
297 jint heap_filter,
298 jclass klass,
299 jobject initial_object,
300 const jvmtiHeapCallbacks* callbacks,
301 const void* user_data) {
Andreas Gampe70bfc8a2016-11-03 11:04:15 -0700302 HeapUtil heap_util(&gObjectTagTable);
303 return heap_util.FollowReferences(env,
304 heap_filter,
305 klass,
306 initial_object,
307 callbacks,
308 user_data);
Alex Light49948e92016-08-11 15:35:28 -0700309 }
310
311 static jvmtiError IterateThroughHeap(jvmtiEnv* env,
312 jint heap_filter,
313 jclass klass,
314 const jvmtiHeapCallbacks* callbacks,
315 const void* user_data) {
Alex Lighte6574242016-08-17 09:56:24 -0700316 ENSURE_HAS_CAP(env, can_tag_objects);
Andreas Gampee54d9922016-10-11 19:55:37 -0700317 HeapUtil heap_util(&gObjectTagTable);
318 return heap_util.IterateThroughHeap(env, heap_filter, klass, callbacks, user_data);
Alex Light49948e92016-08-11 15:35:28 -0700319 }
320
321 static jvmtiError GetTag(jvmtiEnv* env, jobject object, jlong* tag_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700322 ENSURE_HAS_CAP(env, can_tag_objects);
Andreas Gampe6dee92e2016-09-12 19:58:13 -0700323
324 JNIEnv* jni_env = GetJniEnv(env);
325 if (jni_env == nullptr) {
326 return ERR(INTERNAL);
327 }
328
329 art::ScopedObjectAccess soa(jni_env);
330 art::ObjPtr<art::mirror::Object> obj = soa.Decode<art::mirror::Object>(object);
331 if (!gObjectTagTable.GetTag(obj.Ptr(), tag_ptr)) {
332 *tag_ptr = 0;
333 }
334
335 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700336 }
337
338 static jvmtiError SetTag(jvmtiEnv* env, jobject object, jlong tag) {
Alex Lighte6574242016-08-17 09:56:24 -0700339 ENSURE_HAS_CAP(env, can_tag_objects);
340
Andreas Gampe6dee92e2016-09-12 19:58:13 -0700341 if (object == nullptr) {
342 return ERR(NULL_POINTER);
343 }
344
345 JNIEnv* jni_env = GetJniEnv(env);
346 if (jni_env == nullptr) {
347 return ERR(INTERNAL);
348 }
349
350 art::ScopedObjectAccess soa(jni_env);
351 art::ObjPtr<art::mirror::Object> obj = soa.Decode<art::mirror::Object>(object);
Andreas Gampee54eee12016-10-20 19:03:58 -0700352 gObjectTagTable.Set(obj.Ptr(), tag);
Andreas Gampe6dee92e2016-09-12 19:58:13 -0700353
354 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700355 }
356
357 static jvmtiError GetObjectsWithTags(jvmtiEnv* env,
358 jint tag_count,
359 const jlong* tags,
360 jint* count_ptr,
361 jobject** object_result_ptr,
362 jlong** tag_result_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700363 ENSURE_HAS_CAP(env, can_tag_objects);
364
Andreas Gampe5e6046b2016-10-25 12:05:53 -0700365 JNIEnv* jni_env = GetJniEnv(env);
366 if (jni_env == nullptr) {
367 return ERR(INTERNAL);
368 }
369
370 art::ScopedObjectAccess soa(jni_env);
371 return gObjectTagTable.GetTaggedObjects(env,
372 tag_count,
373 tags,
374 count_ptr,
375 object_result_ptr,
376 tag_result_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700377 }
378
379 static jvmtiError ForceGarbageCollection(jvmtiEnv* env) {
Andreas Gampe8da6d032016-10-31 19:31:03 -0700380 return HeapUtil::ForceGarbageCollection(env);
Alex Light49948e92016-08-11 15:35:28 -0700381 }
382
383 static jvmtiError IterateOverObjectsReachableFromObject(
384 jvmtiEnv* env,
385 jobject object,
386 jvmtiObjectReferenceCallback object_reference_callback,
387 const void* user_data) {
388 return ERR(NOT_IMPLEMENTED);
389 }
390
391 static jvmtiError IterateOverReachableObjects(jvmtiEnv* env,
392 jvmtiHeapRootCallback heap_root_callback,
393 jvmtiStackReferenceCallback stack_ref_callback,
394 jvmtiObjectReferenceCallback object_ref_callback,
395 const void* user_data) {
396 return ERR(NOT_IMPLEMENTED);
397 }
398
399 static jvmtiError IterateOverHeap(jvmtiEnv* env,
400 jvmtiHeapObjectFilter object_filter,
401 jvmtiHeapObjectCallback heap_object_callback,
402 const void* user_data) {
403 return ERR(NOT_IMPLEMENTED);
404 }
405
406 static jvmtiError IterateOverInstancesOfClass(jvmtiEnv* env,
407 jclass klass,
408 jvmtiHeapObjectFilter object_filter,
409 jvmtiHeapObjectCallback heap_object_callback,
410 const void* user_data) {
411 return ERR(NOT_IMPLEMENTED);
412 }
413
414 static jvmtiError GetLocalObject(jvmtiEnv* env,
415 jthread thread,
416 jint depth,
417 jint slot,
418 jobject* value_ptr) {
419 return ERR(NOT_IMPLEMENTED);
420 }
421
422 static jvmtiError GetLocalInstance(jvmtiEnv* env,
423 jthread thread,
424 jint depth,
425 jobject* value_ptr) {
426 return ERR(NOT_IMPLEMENTED);
427 }
428
429 static jvmtiError GetLocalInt(jvmtiEnv* env,
430 jthread thread,
431 jint depth,
432 jint slot,
433 jint* value_ptr) {
434 return ERR(NOT_IMPLEMENTED);
435 }
436
437 static jvmtiError GetLocalLong(jvmtiEnv* env,
438 jthread thread,
439 jint depth,
440 jint slot,
441 jlong* value_ptr) {
442 return ERR(NOT_IMPLEMENTED);
443 }
444
445 static jvmtiError GetLocalFloat(jvmtiEnv* env,
446 jthread thread,
447 jint depth,
448 jint slot,
449 jfloat* value_ptr) {
450 return ERR(NOT_IMPLEMENTED);
451 }
452
453 static jvmtiError GetLocalDouble(jvmtiEnv* env,
454 jthread thread,
455 jint depth,
456 jint slot,
457 jdouble* value_ptr) {
458 return ERR(NOT_IMPLEMENTED);
459 }
460
461 static jvmtiError SetLocalObject(jvmtiEnv* env,
462 jthread thread,
463 jint depth,
464 jint slot,
465 jobject value) {
466 return ERR(NOT_IMPLEMENTED);
467 }
468
469 static jvmtiError SetLocalInt(jvmtiEnv* env,
470 jthread thread,
471 jint depth,
472 jint slot,
473 jint value) {
474 return ERR(NOT_IMPLEMENTED);
475 }
476
477 static jvmtiError SetLocalLong(jvmtiEnv* env,
478 jthread thread,
479 jint depth,
480 jint slot,
481 jlong value) {
482 return ERR(NOT_IMPLEMENTED);
483 }
484
485 static jvmtiError SetLocalFloat(jvmtiEnv* env,
486 jthread thread,
487 jint depth,
488 jint slot,
489 jfloat value) {
490 return ERR(NOT_IMPLEMENTED);
491 }
492
493 static jvmtiError SetLocalDouble(jvmtiEnv* env,
494 jthread thread,
495 jint depth,
496 jint slot,
497 jdouble value) {
498 return ERR(NOT_IMPLEMENTED);
499 }
500
501 static jvmtiError SetBreakpoint(jvmtiEnv* env, jmethodID method, jlocation location) {
502 return ERR(NOT_IMPLEMENTED);
503 }
504
505 static jvmtiError ClearBreakpoint(jvmtiEnv* env, jmethodID method, jlocation location) {
506 return ERR(NOT_IMPLEMENTED);
507 }
508
509 static jvmtiError SetFieldAccessWatch(jvmtiEnv* env, jclass klass, jfieldID field) {
510 return ERR(NOT_IMPLEMENTED);
511 }
512
513 static jvmtiError ClearFieldAccessWatch(jvmtiEnv* env, jclass klass, jfieldID field) {
514 return ERR(NOT_IMPLEMENTED);
515 }
516
517 static jvmtiError SetFieldModificationWatch(jvmtiEnv* env, jclass klass, jfieldID field) {
518 return ERR(NOT_IMPLEMENTED);
519 }
520
521 static jvmtiError ClearFieldModificationWatch(jvmtiEnv* env, jclass klass, jfieldID field) {
522 return ERR(NOT_IMPLEMENTED);
523 }
524
525 static jvmtiError GetLoadedClasses(jvmtiEnv* env, jint* class_count_ptr, jclass** classes_ptr) {
Andreas Gampeaa8b60c2016-10-12 12:51:25 -0700526 HeapUtil heap_util(&gObjectTagTable);
527 return heap_util.GetLoadedClasses(env, class_count_ptr, classes_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700528 }
529
530 static jvmtiError GetClassLoaderClasses(jvmtiEnv* env,
531 jobject initiating_loader,
532 jint* class_count_ptr,
533 jclass** classes_ptr) {
534 return ERR(NOT_IMPLEMENTED);
535 }
536
537 static jvmtiError GetClassSignature(jvmtiEnv* env,
538 jclass klass,
539 char** signature_ptr,
540 char** generic_ptr) {
Andreas Gampee492ae32016-10-28 19:34:57 -0700541 return ClassUtil::GetClassSignature(env, klass, signature_ptr, generic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700542 }
543
544 static jvmtiError GetClassStatus(jvmtiEnv* env, jclass klass, jint* status_ptr) {
Andreas Gampeff9d2092017-01-06 09:12:49 -0800545 return ClassUtil::GetClassStatus(env, klass, status_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700546 }
547
548 static jvmtiError GetSourceFileName(jvmtiEnv* env, jclass klass, char** source_name_ptr) {
549 return ERR(NOT_IMPLEMENTED);
550 }
551
552 static jvmtiError GetClassModifiers(jvmtiEnv* env, jclass klass, jint* modifiers_ptr) {
Andreas Gampe64013e52017-01-06 13:07:19 -0800553 return ClassUtil::GetClassModifiers(env, klass, modifiers_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700554 }
555
556 static jvmtiError GetClassMethods(jvmtiEnv* env,
557 jclass klass,
558 jint* method_count_ptr,
559 jmethodID** methods_ptr) {
Andreas Gampe18fee4d2017-01-06 11:36:35 -0800560 return ClassUtil::GetClassMethods(env, klass, method_count_ptr, methods_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700561 }
562
563 static jvmtiError GetClassFields(jvmtiEnv* env,
564 jclass klass,
565 jint* field_count_ptr,
566 jfieldID** fields_ptr) {
Andreas Gampeac587272017-01-05 15:21:34 -0800567 return ClassUtil::GetClassFields(env, klass, field_count_ptr, fields_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700568 }
569
570 static jvmtiError GetImplementedInterfaces(jvmtiEnv* env,
571 jclass klass,
572 jint* interface_count_ptr,
573 jclass** interfaces_ptr) {
Andreas Gampe8b07e472017-01-06 14:20:39 -0800574 return ClassUtil::GetImplementedInterfaces(env, klass, interface_count_ptr, interfaces_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700575 }
576
577 static jvmtiError GetClassVersionNumbers(jvmtiEnv* env,
578 jclass klass,
579 jint* minor_version_ptr,
580 jint* major_version_ptr) {
581 return ERR(NOT_IMPLEMENTED);
582 }
583
584 static jvmtiError GetConstantPool(jvmtiEnv* env,
585 jclass klass,
586 jint* constant_pool_count_ptr,
587 jint* constant_pool_byte_count_ptr,
588 unsigned char** constant_pool_bytes_ptr) {
589 return ERR(NOT_IMPLEMENTED);
590 }
591
592 static jvmtiError IsInterface(jvmtiEnv* env, jclass klass, jboolean* is_interface_ptr) {
Andreas Gampe4fd66ec2017-01-05 14:42:13 -0800593 return ClassUtil::IsInterface(env, klass, is_interface_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700594 }
595
596 static jvmtiError IsArrayClass(jvmtiEnv* env,
597 jclass klass,
598 jboolean* is_array_class_ptr) {
Andreas Gampe4fd66ec2017-01-05 14:42:13 -0800599 return ClassUtil::IsArrayClass(env, klass, is_array_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700600 }
601
602 static jvmtiError IsModifiableClass(jvmtiEnv* env,
603 jclass klass,
604 jboolean* is_modifiable_class_ptr) {
Alex Lighte4a88632017-01-10 07:41:24 -0800605 return Redefiner::IsModifiableClass(env, klass, is_modifiable_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700606 }
607
608 static jvmtiError GetClassLoader(jvmtiEnv* env, jclass klass, jobject* classloader_ptr) {
Andreas Gampe8f5b6032017-01-06 15:50:55 -0800609 return ClassUtil::GetClassLoader(env, klass, classloader_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700610 }
611
612 static jvmtiError GetSourceDebugExtension(jvmtiEnv* env,
613 jclass klass,
614 char** source_debug_extension_ptr) {
615 return ERR(NOT_IMPLEMENTED);
616 }
617
618 static jvmtiError RetransformClasses(jvmtiEnv* env, jint class_count, const jclass* classes) {
619 return ERR(NOT_IMPLEMENTED);
620 }
621
622 static jvmtiError RedefineClasses(jvmtiEnv* env,
623 jint class_count,
624 const jvmtiClassDefinition* class_definitions) {
625 return ERR(NOT_IMPLEMENTED);
626 }
627
628 static jvmtiError GetObjectSize(jvmtiEnv* env, jobject object, jlong* size_ptr) {
Andreas Gampe50a4e492017-01-06 18:00:20 -0800629 return ObjectUtil::GetObjectSize(env, object, size_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700630 }
631
632 static jvmtiError GetObjectHashCode(jvmtiEnv* env, jobject object, jint* hash_code_ptr) {
Andreas Gampe50a4e492017-01-06 18:00:20 -0800633 return ObjectUtil::GetObjectHashCode(env, object, hash_code_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700634 }
635
636 static jvmtiError GetObjectMonitorUsage(jvmtiEnv* env,
637 jobject object,
638 jvmtiMonitorUsage* info_ptr) {
639 return ERR(NOT_IMPLEMENTED);
640 }
641
642 static jvmtiError GetFieldName(jvmtiEnv* env,
643 jclass klass,
644 jfieldID field,
645 char** name_ptr,
646 char** signature_ptr,
647 char** generic_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800648 return FieldUtil::GetFieldName(env, klass, field, name_ptr, signature_ptr, generic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700649 }
650
651 static jvmtiError GetFieldDeclaringClass(jvmtiEnv* env,
652 jclass klass,
653 jfieldID field,
654 jclass* declaring_class_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800655 return FieldUtil::GetFieldDeclaringClass(env, klass, field, declaring_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700656 }
657
658 static jvmtiError GetFieldModifiers(jvmtiEnv* env,
659 jclass klass,
660 jfieldID field,
661 jint* modifiers_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800662 return FieldUtil::GetFieldModifiers(env, klass, field, modifiers_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700663 }
664
665 static jvmtiError IsFieldSynthetic(jvmtiEnv* env,
666 jclass klass,
667 jfieldID field,
668 jboolean* is_synthetic_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800669 return FieldUtil::IsFieldSynthetic(env, klass, field, is_synthetic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700670 }
671
672 static jvmtiError GetMethodName(jvmtiEnv* env,
673 jmethodID method,
674 char** name_ptr,
675 char** signature_ptr,
676 char** generic_ptr) {
Andreas Gampe3c252f02016-10-27 18:25:17 -0700677 return MethodUtil::GetMethodName(env, method, name_ptr, signature_ptr, generic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700678 }
679
680 static jvmtiError GetMethodDeclaringClass(jvmtiEnv* env,
681 jmethodID method,
682 jclass* declaring_class_ptr) {
Andreas Gampe368a2082016-10-28 17:33:13 -0700683 return MethodUtil::GetMethodDeclaringClass(env, method, declaring_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700684 }
685
686 static jvmtiError GetMethodModifiers(jvmtiEnv* env,
687 jmethodID method,
688 jint* modifiers_ptr) {
Andreas Gampe36bcd4f2016-10-28 18:07:18 -0700689 return MethodUtil::GetMethodModifiers(env, method, modifiers_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700690 }
691
692 static jvmtiError GetMaxLocals(jvmtiEnv* env,
693 jmethodID method,
694 jint* max_ptr) {
Andreas Gampef71832e2017-01-09 11:38:04 -0800695 return MethodUtil::GetMaxLocals(env, method, max_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700696 }
697
698 static jvmtiError GetArgumentsSize(jvmtiEnv* env,
699 jmethodID method,
700 jint* size_ptr) {
Andreas Gampef71832e2017-01-09 11:38:04 -0800701 return MethodUtil::GetArgumentsSize(env, method, size_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700702 }
703
704 static jvmtiError GetLineNumberTable(jvmtiEnv* env,
705 jmethodID method,
706 jint* entry_count_ptr,
707 jvmtiLineNumberEntry** table_ptr) {
Andreas Gampeda3e5612016-12-13 19:00:53 -0800708 return MethodUtil::GetLineNumberTable(env, method, entry_count_ptr, table_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700709 }
710
711 static jvmtiError GetMethodLocation(jvmtiEnv* env,
712 jmethodID method,
713 jlocation* start_location_ptr,
714 jlocation* end_location_ptr) {
Andreas Gampef71832e2017-01-09 11:38:04 -0800715 return MethodUtil::GetMethodLocation(env, method, start_location_ptr, end_location_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700716 }
717
718 static jvmtiError GetLocalVariableTable(jvmtiEnv* env,
719 jmethodID method,
720 jint* entry_count_ptr,
721 jvmtiLocalVariableEntry** table_ptr) {
722 return ERR(NOT_IMPLEMENTED);
723 }
724
725 static jvmtiError GetBytecodes(jvmtiEnv* env,
726 jmethodID method,
727 jint* bytecode_count_ptr,
728 unsigned char** bytecodes_ptr) {
729 return ERR(NOT_IMPLEMENTED);
730 }
731
732 static jvmtiError IsMethodNative(jvmtiEnv* env, jmethodID method, jboolean* is_native_ptr) {
Andreas Gampefdeef522017-01-09 14:40:25 -0800733 return MethodUtil::IsMethodNative(env, method, is_native_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700734 }
735
736 static jvmtiError IsMethodSynthetic(jvmtiEnv* env, jmethodID method, jboolean* is_synthetic_ptr) {
Andreas Gampefdeef522017-01-09 14:40:25 -0800737 return MethodUtil::IsMethodSynthetic(env, method, is_synthetic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700738 }
739
740 static jvmtiError IsMethodObsolete(jvmtiEnv* env, jmethodID method, jboolean* is_obsolete_ptr) {
Andreas Gampefdeef522017-01-09 14:40:25 -0800741 return MethodUtil::IsMethodObsolete(env, method, is_obsolete_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700742 }
743
744 static jvmtiError SetNativeMethodPrefix(jvmtiEnv* env, const char* prefix) {
745 return ERR(NOT_IMPLEMENTED);
746 }
747
748 static jvmtiError SetNativeMethodPrefixes(jvmtiEnv* env, jint prefix_count, char** prefixes) {
749 return ERR(NOT_IMPLEMENTED);
750 }
751
752 static jvmtiError CreateRawMonitor(jvmtiEnv* env, const char* name, jrawMonitorID* monitor_ptr) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800753 return MonitorUtil::CreateRawMonitor(env, name, monitor_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700754 }
755
756 static jvmtiError DestroyRawMonitor(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800757 return MonitorUtil::DestroyRawMonitor(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700758 }
759
760 static jvmtiError RawMonitorEnter(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800761 return MonitorUtil::RawMonitorEnter(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700762 }
763
764 static jvmtiError RawMonitorExit(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800765 return MonitorUtil::RawMonitorExit(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700766 }
767
768 static jvmtiError RawMonitorWait(jvmtiEnv* env, jrawMonitorID monitor, jlong millis) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800769 return MonitorUtil::RawMonitorWait(env, monitor, millis);
Alex Light49948e92016-08-11 15:35:28 -0700770 }
771
772 static jvmtiError RawMonitorNotify(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800773 return MonitorUtil::RawMonitorNotify(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700774 }
775
776 static jvmtiError RawMonitorNotifyAll(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800777 return MonitorUtil::RawMonitorNotifyAll(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700778 }
779
780 static jvmtiError SetJNIFunctionTable(jvmtiEnv* env, const jniNativeInterface* function_table) {
781 return ERR(NOT_IMPLEMENTED);
782 }
783
784 static jvmtiError GetJNIFunctionTable(jvmtiEnv* env, jniNativeInterface** function_table) {
785 return ERR(NOT_IMPLEMENTED);
786 }
787
Andreas Gampe77708d92016-10-07 11:48:21 -0700788 // TODO: This will require locking, so that an agent can't remove callbacks when we're dispatching
789 // an event.
Alex Light49948e92016-08-11 15:35:28 -0700790 static jvmtiError SetEventCallbacks(jvmtiEnv* env,
791 const jvmtiEventCallbacks* callbacks,
792 jint size_of_callbacks) {
Alex Lighte6574242016-08-17 09:56:24 -0700793 ENSURE_VALID_ENV(env);
Andreas Gampe77708d92016-10-07 11:48:21 -0700794 if (size_of_callbacks < 0) {
795 return ERR(ILLEGAL_ARGUMENT);
796 }
797
798 if (callbacks == nullptr) {
799 ArtJvmTiEnv::AsArtJvmTiEnv(env)->event_callbacks.reset();
800 return ERR(NONE);
801 }
802
803 std::unique_ptr<jvmtiEventCallbacks> tmp(new jvmtiEventCallbacks());
804 memset(tmp.get(), 0, sizeof(jvmtiEventCallbacks));
805 size_t copy_size = std::min(sizeof(jvmtiEventCallbacks),
806 static_cast<size_t>(size_of_callbacks));
807 copy_size = art::RoundDown(copy_size, sizeof(void*));
808 memcpy(tmp.get(), callbacks, copy_size);
809
810 ArtJvmTiEnv::AsArtJvmTiEnv(env)->event_callbacks = std::move(tmp);
811
812 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700813 }
814
815 static jvmtiError SetEventNotificationMode(jvmtiEnv* env,
816 jvmtiEventMode mode,
817 jvmtiEvent event_type,
818 jthread event_thread,
819 ...) {
Alex Lighte6574242016-08-17 09:56:24 -0700820 ENSURE_VALID_ENV(env);
821 // TODO: Check for capabilities.
Andreas Gampe77708d92016-10-07 11:48:21 -0700822 art::Thread* art_thread = nullptr;
823 if (event_thread != nullptr) {
824 // TODO: Need non-aborting call here, to return JVMTI_ERROR_INVALID_THREAD.
825 art::ScopedObjectAccess soa(art::Thread::Current());
826 art::MutexLock mu(soa.Self(), *art::Locks::thread_list_lock_);
827 art_thread = art::Thread::FromManagedThread(soa, event_thread);
828
829 if (art_thread == nullptr || // The thread hasn't been started or is already dead.
830 art_thread->IsStillStarting()) {
831 // TODO: We may want to let the EventHandler know, so it could clean up masks, potentially.
832 return ERR(THREAD_NOT_ALIVE);
833 }
834 }
835
836 return gEventHandler.SetEvent(ArtJvmTiEnv::AsArtJvmTiEnv(env), art_thread, event_type, mode);
Alex Light49948e92016-08-11 15:35:28 -0700837 }
838
839 static jvmtiError GenerateEvents(jvmtiEnv* env, jvmtiEvent event_type) {
840 return ERR(NOT_IMPLEMENTED);
841 }
842
843 static jvmtiError GetExtensionFunctions(jvmtiEnv* env,
844 jint* extension_count_ptr,
845 jvmtiExtensionFunctionInfo** extensions) {
Andreas Gampee4c33842017-01-09 10:50:17 -0800846 // We do not have any extension functions.
847 *extension_count_ptr = 0;
848 *extensions = nullptr;
849
850 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700851 }
852
853 static jvmtiError GetExtensionEvents(jvmtiEnv* env,
854 jint* extension_count_ptr,
855 jvmtiExtensionEventInfo** extensions) {
Andreas Gampee4c33842017-01-09 10:50:17 -0800856 // We do not have any extension events.
857 *extension_count_ptr = 0;
858 *extensions = nullptr;
859
860 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700861 }
862
863 static jvmtiError SetExtensionEventCallback(jvmtiEnv* env,
864 jint extension_event_index,
865 jvmtiExtensionEvent callback) {
Andreas Gampee4c33842017-01-09 10:50:17 -0800866 // We do not have any extension events, so any call is illegal.
867 return ERR(ILLEGAL_ARGUMENT);
Alex Light49948e92016-08-11 15:35:28 -0700868 }
869
870 static jvmtiError GetPotentialCapabilities(jvmtiEnv* env, jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700871 ENSURE_VALID_ENV(env);
872 ENSURE_NON_NULL(capabilities_ptr);
873 *capabilities_ptr = kPotentialCapabilities;
874 return OK;
Alex Light49948e92016-08-11 15:35:28 -0700875 }
876
877 static jvmtiError AddCapabilities(jvmtiEnv* env, const jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700878 ENSURE_VALID_ENV(env);
879 ENSURE_NON_NULL(capabilities_ptr);
880 ArtJvmTiEnv* art_env = static_cast<ArtJvmTiEnv*>(env);
881 jvmtiError ret = OK;
882#define ADD_CAPABILITY(e) \
883 do { \
884 if (capabilities_ptr->e == 1) { \
885 if (kPotentialCapabilities.e == 1) { \
886 art_env->capabilities.e = 1;\
887 } else { \
888 ret = ERR(NOT_AVAILABLE); \
889 } \
890 } \
891 } while (false)
892
893 ADD_CAPABILITY(can_tag_objects);
894 ADD_CAPABILITY(can_generate_field_modification_events);
895 ADD_CAPABILITY(can_generate_field_access_events);
896 ADD_CAPABILITY(can_get_bytecodes);
897 ADD_CAPABILITY(can_get_synthetic_attribute);
898 ADD_CAPABILITY(can_get_owned_monitor_info);
899 ADD_CAPABILITY(can_get_current_contended_monitor);
900 ADD_CAPABILITY(can_get_monitor_info);
901 ADD_CAPABILITY(can_pop_frame);
902 ADD_CAPABILITY(can_redefine_classes);
903 ADD_CAPABILITY(can_signal_thread);
904 ADD_CAPABILITY(can_get_source_file_name);
905 ADD_CAPABILITY(can_get_line_numbers);
906 ADD_CAPABILITY(can_get_source_debug_extension);
907 ADD_CAPABILITY(can_access_local_variables);
908 ADD_CAPABILITY(can_maintain_original_method_order);
909 ADD_CAPABILITY(can_generate_single_step_events);
910 ADD_CAPABILITY(can_generate_exception_events);
911 ADD_CAPABILITY(can_generate_frame_pop_events);
912 ADD_CAPABILITY(can_generate_breakpoint_events);
913 ADD_CAPABILITY(can_suspend);
914 ADD_CAPABILITY(can_redefine_any_class);
915 ADD_CAPABILITY(can_get_current_thread_cpu_time);
916 ADD_CAPABILITY(can_get_thread_cpu_time);
917 ADD_CAPABILITY(can_generate_method_entry_events);
918 ADD_CAPABILITY(can_generate_method_exit_events);
919 ADD_CAPABILITY(can_generate_all_class_hook_events);
920 ADD_CAPABILITY(can_generate_compiled_method_load_events);
921 ADD_CAPABILITY(can_generate_monitor_events);
922 ADD_CAPABILITY(can_generate_vm_object_alloc_events);
923 ADD_CAPABILITY(can_generate_native_method_bind_events);
924 ADD_CAPABILITY(can_generate_garbage_collection_events);
925 ADD_CAPABILITY(can_generate_object_free_events);
926 ADD_CAPABILITY(can_force_early_return);
927 ADD_CAPABILITY(can_get_owned_monitor_stack_depth_info);
928 ADD_CAPABILITY(can_get_constant_pool);
929 ADD_CAPABILITY(can_set_native_method_prefix);
930 ADD_CAPABILITY(can_retransform_classes);
931 ADD_CAPABILITY(can_retransform_any_class);
932 ADD_CAPABILITY(can_generate_resource_exhaustion_heap_events);
933 ADD_CAPABILITY(can_generate_resource_exhaustion_threads_events);
934#undef ADD_CAPABILITY
935 return ret;
Alex Light49948e92016-08-11 15:35:28 -0700936 }
937
938 static jvmtiError RelinquishCapabilities(jvmtiEnv* env,
939 const jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700940 ENSURE_VALID_ENV(env);
941 ENSURE_NON_NULL(capabilities_ptr);
942 ArtJvmTiEnv* art_env = reinterpret_cast<ArtJvmTiEnv*>(env);
943#define DEL_CAPABILITY(e) \
944 do { \
945 if (capabilities_ptr->e == 1) { \
946 art_env->capabilities.e = 0;\
947 } \
948 } while (false)
949
950 DEL_CAPABILITY(can_tag_objects);
951 DEL_CAPABILITY(can_generate_field_modification_events);
952 DEL_CAPABILITY(can_generate_field_access_events);
953 DEL_CAPABILITY(can_get_bytecodes);
954 DEL_CAPABILITY(can_get_synthetic_attribute);
955 DEL_CAPABILITY(can_get_owned_monitor_info);
956 DEL_CAPABILITY(can_get_current_contended_monitor);
957 DEL_CAPABILITY(can_get_monitor_info);
958 DEL_CAPABILITY(can_pop_frame);
959 DEL_CAPABILITY(can_redefine_classes);
960 DEL_CAPABILITY(can_signal_thread);
961 DEL_CAPABILITY(can_get_source_file_name);
962 DEL_CAPABILITY(can_get_line_numbers);
963 DEL_CAPABILITY(can_get_source_debug_extension);
964 DEL_CAPABILITY(can_access_local_variables);
965 DEL_CAPABILITY(can_maintain_original_method_order);
966 DEL_CAPABILITY(can_generate_single_step_events);
967 DEL_CAPABILITY(can_generate_exception_events);
968 DEL_CAPABILITY(can_generate_frame_pop_events);
969 DEL_CAPABILITY(can_generate_breakpoint_events);
970 DEL_CAPABILITY(can_suspend);
971 DEL_CAPABILITY(can_redefine_any_class);
972 DEL_CAPABILITY(can_get_current_thread_cpu_time);
973 DEL_CAPABILITY(can_get_thread_cpu_time);
974 DEL_CAPABILITY(can_generate_method_entry_events);
975 DEL_CAPABILITY(can_generate_method_exit_events);
976 DEL_CAPABILITY(can_generate_all_class_hook_events);
977 DEL_CAPABILITY(can_generate_compiled_method_load_events);
978 DEL_CAPABILITY(can_generate_monitor_events);
979 DEL_CAPABILITY(can_generate_vm_object_alloc_events);
980 DEL_CAPABILITY(can_generate_native_method_bind_events);
981 DEL_CAPABILITY(can_generate_garbage_collection_events);
982 DEL_CAPABILITY(can_generate_object_free_events);
983 DEL_CAPABILITY(can_force_early_return);
984 DEL_CAPABILITY(can_get_owned_monitor_stack_depth_info);
985 DEL_CAPABILITY(can_get_constant_pool);
986 DEL_CAPABILITY(can_set_native_method_prefix);
987 DEL_CAPABILITY(can_retransform_classes);
988 DEL_CAPABILITY(can_retransform_any_class);
989 DEL_CAPABILITY(can_generate_resource_exhaustion_heap_events);
990 DEL_CAPABILITY(can_generate_resource_exhaustion_threads_events);
991#undef DEL_CAPABILITY
992 return OK;
Alex Light49948e92016-08-11 15:35:28 -0700993 }
994
995 static jvmtiError GetCapabilities(jvmtiEnv* env, jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700996 ENSURE_VALID_ENV(env);
997 ENSURE_NON_NULL(capabilities_ptr);
998 ArtJvmTiEnv* artenv = reinterpret_cast<ArtJvmTiEnv*>(env);
999 *capabilities_ptr = artenv->capabilities;
1000 return OK;
Alex Light49948e92016-08-11 15:35:28 -07001001 }
1002
1003 static jvmtiError GetCurrentThreadCpuTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) {
1004 return ERR(NOT_IMPLEMENTED);
1005 }
1006
1007 static jvmtiError GetCurrentThreadCpuTime(jvmtiEnv* env, jlong* nanos_ptr) {
1008 return ERR(NOT_IMPLEMENTED);
1009 }
1010
1011 static jvmtiError GetThreadCpuTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) {
1012 return ERR(NOT_IMPLEMENTED);
1013 }
1014
1015 static jvmtiError GetThreadCpuTime(jvmtiEnv* env, jthread thread, jlong* nanos_ptr) {
1016 return ERR(NOT_IMPLEMENTED);
1017 }
1018
1019 static jvmtiError GetTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) {
1020 return ERR(NOT_IMPLEMENTED);
1021 }
1022
1023 static jvmtiError GetTime(jvmtiEnv* env, jlong* nanos_ptr) {
1024 return ERR(NOT_IMPLEMENTED);
1025 }
1026
1027 static jvmtiError GetAvailableProcessors(jvmtiEnv* env, jint* processor_count_ptr) {
1028 return ERR(NOT_IMPLEMENTED);
1029 }
1030
1031 static jvmtiError AddToBootstrapClassLoaderSearch(jvmtiEnv* env, const char* segment) {
1032 return ERR(NOT_IMPLEMENTED);
1033 }
1034
1035 static jvmtiError AddToSystemClassLoaderSearch(jvmtiEnv* env, const char* segment) {
1036 return ERR(NOT_IMPLEMENTED);
1037 }
1038
1039 static jvmtiError GetSystemProperties(jvmtiEnv* env, jint* count_ptr, char*** property_ptr) {
Andreas Gampe1bdaf732017-01-09 19:21:06 -08001040 return PropertiesUtil::GetSystemProperties(env, count_ptr, property_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001041 }
1042
1043 static jvmtiError GetSystemProperty(jvmtiEnv* env, const char* property, char** value_ptr) {
Andreas Gampe1bdaf732017-01-09 19:21:06 -08001044 return PropertiesUtil::GetSystemProperty(env, property, value_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001045 }
1046
1047 static jvmtiError SetSystemProperty(jvmtiEnv* env, const char* property, const char* value) {
Andreas Gampe1bdaf732017-01-09 19:21:06 -08001048 return PropertiesUtil::SetSystemProperty(env, property, value);
Alex Light49948e92016-08-11 15:35:28 -07001049 }
1050
1051 static jvmtiError GetPhase(jvmtiEnv* env, jvmtiPhase* phase_ptr) {
1052 return ERR(NOT_IMPLEMENTED);
1053 }
1054
1055 static jvmtiError DisposeEnvironment(jvmtiEnv* env) {
Alex Lighte6574242016-08-17 09:56:24 -07001056 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001057 delete env;
1058 return OK;
1059 }
1060
1061 static jvmtiError SetEnvironmentLocalStorage(jvmtiEnv* env, const void* data) {
Alex Lighte6574242016-08-17 09:56:24 -07001062 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001063 reinterpret_cast<ArtJvmTiEnv*>(env)->local_data = const_cast<void*>(data);
1064 return OK;
1065 }
1066
1067 static jvmtiError GetEnvironmentLocalStorage(jvmtiEnv* env, void** data_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001068 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001069 *data_ptr = reinterpret_cast<ArtJvmTiEnv*>(env)->local_data;
1070 return OK;
1071 }
1072
1073 static jvmtiError GetVersionNumber(jvmtiEnv* env, jint* version_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001074 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001075 *version_ptr = JVMTI_VERSION;
1076 return OK;
1077 }
1078
1079 static jvmtiError GetErrorName(jvmtiEnv* env, jvmtiError error, char** name_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001080 ENSURE_NON_NULL(name_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001081 switch (error) {
1082#define ERROR_CASE(e) case (JVMTI_ERROR_ ## e) : do { \
Alex Light41960712017-01-06 14:44:23 -08001083 jvmtiError res = CopyString(env, \
1084 "JVMTI_ERROR_"#e, \
1085 reinterpret_cast<unsigned char**>(name_ptr)); \
1086 if (res != OK) { \
1087 *name_ptr = nullptr; \
1088 return res; \
1089 } else { \
1090 return OK; \
1091 } \
Alex Light49948e92016-08-11 15:35:28 -07001092 } while (false)
1093 ERROR_CASE(NONE);
1094 ERROR_CASE(INVALID_THREAD);
1095 ERROR_CASE(INVALID_THREAD_GROUP);
1096 ERROR_CASE(INVALID_PRIORITY);
1097 ERROR_CASE(THREAD_NOT_SUSPENDED);
1098 ERROR_CASE(THREAD_NOT_ALIVE);
1099 ERROR_CASE(INVALID_OBJECT);
1100 ERROR_CASE(INVALID_CLASS);
1101 ERROR_CASE(CLASS_NOT_PREPARED);
1102 ERROR_CASE(INVALID_METHODID);
1103 ERROR_CASE(INVALID_LOCATION);
1104 ERROR_CASE(INVALID_FIELDID);
1105 ERROR_CASE(NO_MORE_FRAMES);
1106 ERROR_CASE(OPAQUE_FRAME);
1107 ERROR_CASE(TYPE_MISMATCH);
1108 ERROR_CASE(INVALID_SLOT);
1109 ERROR_CASE(DUPLICATE);
1110 ERROR_CASE(NOT_FOUND);
1111 ERROR_CASE(INVALID_MONITOR);
1112 ERROR_CASE(NOT_MONITOR_OWNER);
1113 ERROR_CASE(INTERRUPT);
1114 ERROR_CASE(INVALID_CLASS_FORMAT);
1115 ERROR_CASE(CIRCULAR_CLASS_DEFINITION);
1116 ERROR_CASE(FAILS_VERIFICATION);
1117 ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_ADDED);
1118 ERROR_CASE(UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED);
1119 ERROR_CASE(INVALID_TYPESTATE);
1120 ERROR_CASE(UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED);
1121 ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_DELETED);
1122 ERROR_CASE(UNSUPPORTED_VERSION);
1123 ERROR_CASE(NAMES_DONT_MATCH);
1124 ERROR_CASE(UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED);
1125 ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED);
1126 ERROR_CASE(UNMODIFIABLE_CLASS);
1127 ERROR_CASE(NOT_AVAILABLE);
1128 ERROR_CASE(MUST_POSSESS_CAPABILITY);
1129 ERROR_CASE(NULL_POINTER);
1130 ERROR_CASE(ABSENT_INFORMATION);
1131 ERROR_CASE(INVALID_EVENT_TYPE);
1132 ERROR_CASE(ILLEGAL_ARGUMENT);
1133 ERROR_CASE(NATIVE_METHOD);
1134 ERROR_CASE(CLASS_LOADER_UNSUPPORTED);
1135 ERROR_CASE(OUT_OF_MEMORY);
1136 ERROR_CASE(ACCESS_DENIED);
1137 ERROR_CASE(WRONG_PHASE);
1138 ERROR_CASE(INTERNAL);
1139 ERROR_CASE(UNATTACHED_THREAD);
1140 ERROR_CASE(INVALID_ENVIRONMENT);
1141#undef ERROR_CASE
1142 default: {
Alex Light41960712017-01-06 14:44:23 -08001143 jvmtiError res = CopyString(env,
1144 "JVMTI_ERROR_UNKNOWN",
1145 reinterpret_cast<unsigned char**>(name_ptr));
1146 if (res != OK) {
1147 *name_ptr = nullptr;
1148 return res;
1149 } else {
1150 return ERR(ILLEGAL_ARGUMENT);
1151 }
Alex Light49948e92016-08-11 15:35:28 -07001152 }
1153 }
1154 }
1155
1156 static jvmtiError SetVerboseFlag(jvmtiEnv* env, jvmtiVerboseFlag flag, jboolean value) {
1157 return ERR(NOT_IMPLEMENTED);
1158 }
1159
1160 static jvmtiError GetJLocationFormat(jvmtiEnv* env, jvmtiJlocationFormat* format_ptr) {
1161 return ERR(NOT_IMPLEMENTED);
1162 }
Alex Light9c20a142016-08-23 15:05:12 -07001163
1164 // TODO Remove this once events are working.
1165 static jvmtiError RetransformClassWithHook(jvmtiEnv* env,
1166 jclass klass,
1167 jvmtiEventClassFileLoadHook hook) {
1168 std::vector<jclass> classes;
1169 classes.push_back(klass);
1170 return RetransformClassesWithHook(reinterpret_cast<ArtJvmTiEnv*>(env), classes, hook);
1171 }
1172
Alex Light1e07ca62016-12-02 11:40:56 -08001173 static jvmtiError RedefineClassDirect(ArtJvmTiEnv* env,
1174 jclass klass,
1175 jint dex_size,
1176 unsigned char* dex_file) {
1177 if (!IsValidEnv(env)) {
1178 return ERR(INVALID_ENVIRONMENT);
1179 }
1180 jvmtiError ret = OK;
1181 std::string location;
1182 if ((ret = GetClassLocation(env, klass, &location)) != OK) {
1183 // TODO Do something more here? Maybe give log statements?
1184 return ret;
1185 }
1186 std::string error;
1187 ret = Redefiner::RedefineClass(env,
1188 art::Runtime::Current(),
1189 art::Thread::Current(),
1190 klass,
1191 location,
1192 dex_size,
1193 reinterpret_cast<uint8_t*>(dex_file),
1194 &error);
1195 if (ret != OK) {
Alex Light460d1b42017-01-10 15:37:17 +00001196 LOG(WARNING) << "FAILURE TO REDEFINE " << error;
Alex Light1e07ca62016-12-02 11:40:56 -08001197 }
1198 return ret;
1199 }
1200
Alex Light9c20a142016-08-23 15:05:12 -07001201 // TODO This will be called by the event handler for the art::ti Event Load Event
1202 static jvmtiError RetransformClassesWithHook(ArtJvmTiEnv* env,
1203 const std::vector<jclass>& classes,
1204 jvmtiEventClassFileLoadHook hook) {
1205 if (!IsValidEnv(env)) {
1206 return ERR(INVALID_ENVIRONMENT);
1207 }
Alex Lighta01de592016-11-15 10:43:06 -08001208 jvmtiError res = OK;
1209 std::string error;
Alex Light9c20a142016-08-23 15:05:12 -07001210 for (jclass klass : classes) {
1211 JNIEnv* jni_env = nullptr;
1212 jobject loader = nullptr;
1213 std::string name;
1214 jobject protection_domain = nullptr;
1215 jint data_len = 0;
1216 unsigned char* dex_data = nullptr;
1217 jvmtiError ret = OK;
1218 std::string location;
1219 if ((ret = GetTransformationData(env,
1220 klass,
1221 /*out*/&location,
1222 /*out*/&jni_env,
1223 /*out*/&loader,
1224 /*out*/&name,
1225 /*out*/&protection_domain,
1226 /*out*/&data_len,
1227 /*out*/&dex_data)) != OK) {
1228 // TODO Do something more here? Maybe give log statements?
1229 return ret;
1230 }
1231 jint new_data_len = 0;
1232 unsigned char* new_dex_data = nullptr;
1233 hook(env,
1234 jni_env,
1235 klass,
1236 loader,
1237 name.c_str(),
1238 protection_domain,
1239 data_len,
1240 dex_data,
1241 /*out*/&new_data_len,
1242 /*out*/&new_dex_data);
1243 // Check if anything actually changed.
1244 if ((new_data_len != 0 || new_dex_data != nullptr) && new_dex_data != dex_data) {
Alex Lighta01de592016-11-15 10:43:06 -08001245 res = Redefiner::RedefineClass(env,
1246 art::Runtime::Current(),
1247 art::Thread::Current(),
1248 klass,
1249 location,
1250 new_data_len,
1251 new_dex_data,
1252 &error);
Alex Light9c20a142016-08-23 15:05:12 -07001253 env->Deallocate(new_dex_data);
1254 }
1255 // Deallocate the old dex data.
1256 env->Deallocate(dex_data);
Alex Lighta01de592016-11-15 10:43:06 -08001257 if (res != OK) {
1258 LOG(ERROR) << "FAILURE TO REDEFINE " << error;
1259 return res;
1260 }
Alex Light9c20a142016-08-23 15:05:12 -07001261 }
1262 return OK;
1263 }
Alex Light49948e92016-08-11 15:35:28 -07001264};
1265
1266static bool IsJvmtiVersion(jint version) {
1267 return version == JVMTI_VERSION_1 ||
1268 version == JVMTI_VERSION_1_0 ||
1269 version == JVMTI_VERSION_1_1 ||
1270 version == JVMTI_VERSION_1_2 ||
1271 version == JVMTI_VERSION;
1272}
1273
1274// Creates a jvmtiEnv and returns it with the art::ti::Env that is associated with it. new_art_ti
1275// is a pointer to the uninitialized memory for an art::ti::Env.
1276static void CreateArtJvmTiEnv(art::JavaVMExt* vm, /*out*/void** new_jvmtiEnv) {
1277 struct ArtJvmTiEnv* env = new ArtJvmTiEnv(vm);
1278 *new_jvmtiEnv = env;
Andreas Gampe77708d92016-10-07 11:48:21 -07001279
1280 gEventHandler.RegisterArtJvmTiEnv(env);
Alex Light49948e92016-08-11 15:35:28 -07001281}
1282
1283// A hook that the runtime uses to allow plugins to handle GetEnv calls. It returns true and
1284// places the return value in 'env' if this library can handle the GetEnv request. Otherwise
1285// returns false and does not modify the 'env' pointer.
1286static jint GetEnvHandler(art::JavaVMExt* vm, /*out*/void** env, jint version) {
1287 if (IsJvmtiVersion(version)) {
1288 CreateArtJvmTiEnv(vm, env);
1289 return JNI_OK;
1290 } else {
1291 printf("version 0x%x is not valid!", version);
1292 return JNI_EVERSION;
1293 }
1294}
1295
1296// The plugin initialization function. This adds the jvmti environment.
1297extern "C" bool ArtPlugin_Initialize() {
Andreas Gampee08a2be2016-10-06 13:13:30 -07001298 art::Runtime* runtime = art::Runtime::Current();
1299 runtime->GetJavaVM()->AddEnvironmentHook(GetEnvHandler);
1300 runtime->AddSystemWeakHolder(&gObjectTagTable);
Alex Light49948e92016-08-11 15:35:28 -07001301 return true;
1302}
1303
1304// The actual struct holding all of the entrypoints into the jvmti interface.
1305const jvmtiInterface_1 gJvmtiInterface = {
Alex Light9c20a142016-08-23 15:05:12 -07001306 // SPECIAL FUNCTION: RetransformClassWithHook Is normally reserved1
1307 // TODO Remove once we have events working.
1308 reinterpret_cast<void*>(JvmtiFunctions::RetransformClassWithHook),
1309 // nullptr, // reserved1
Alex Light49948e92016-08-11 15:35:28 -07001310 JvmtiFunctions::SetEventNotificationMode,
Alex Light1e07ca62016-12-02 11:40:56 -08001311 // SPECIAL FUNCTION: RedefineClassDirect Is normally reserved3
1312 // TODO Remove once we have events working.
1313 reinterpret_cast<void*>(JvmtiFunctions::RedefineClassDirect),
1314 // nullptr, // reserved3
Alex Light49948e92016-08-11 15:35:28 -07001315 JvmtiFunctions::GetAllThreads,
1316 JvmtiFunctions::SuspendThread,
1317 JvmtiFunctions::ResumeThread,
1318 JvmtiFunctions::StopThread,
1319 JvmtiFunctions::InterruptThread,
1320 JvmtiFunctions::GetThreadInfo,
1321 JvmtiFunctions::GetOwnedMonitorInfo, // 10
1322 JvmtiFunctions::GetCurrentContendedMonitor,
1323 JvmtiFunctions::RunAgentThread,
1324 JvmtiFunctions::GetTopThreadGroups,
1325 JvmtiFunctions::GetThreadGroupInfo,
1326 JvmtiFunctions::GetThreadGroupChildren,
1327 JvmtiFunctions::GetFrameCount,
1328 JvmtiFunctions::GetThreadState,
1329 JvmtiFunctions::GetCurrentThread,
1330 JvmtiFunctions::GetFrameLocation,
1331 JvmtiFunctions::NotifyFramePop, // 20
1332 JvmtiFunctions::GetLocalObject,
1333 JvmtiFunctions::GetLocalInt,
1334 JvmtiFunctions::GetLocalLong,
1335 JvmtiFunctions::GetLocalFloat,
1336 JvmtiFunctions::GetLocalDouble,
1337 JvmtiFunctions::SetLocalObject,
1338 JvmtiFunctions::SetLocalInt,
1339 JvmtiFunctions::SetLocalLong,
1340 JvmtiFunctions::SetLocalFloat,
1341 JvmtiFunctions::SetLocalDouble, // 30
1342 JvmtiFunctions::CreateRawMonitor,
1343 JvmtiFunctions::DestroyRawMonitor,
1344 JvmtiFunctions::RawMonitorEnter,
1345 JvmtiFunctions::RawMonitorExit,
1346 JvmtiFunctions::RawMonitorWait,
1347 JvmtiFunctions::RawMonitorNotify,
1348 JvmtiFunctions::RawMonitorNotifyAll,
1349 JvmtiFunctions::SetBreakpoint,
1350 JvmtiFunctions::ClearBreakpoint,
1351 nullptr, // reserved40
1352 JvmtiFunctions::SetFieldAccessWatch,
1353 JvmtiFunctions::ClearFieldAccessWatch,
1354 JvmtiFunctions::SetFieldModificationWatch,
1355 JvmtiFunctions::ClearFieldModificationWatch,
1356 JvmtiFunctions::IsModifiableClass,
1357 JvmtiFunctions::Allocate,
1358 JvmtiFunctions::Deallocate,
1359 JvmtiFunctions::GetClassSignature,
1360 JvmtiFunctions::GetClassStatus,
1361 JvmtiFunctions::GetSourceFileName, // 50
1362 JvmtiFunctions::GetClassModifiers,
1363 JvmtiFunctions::GetClassMethods,
1364 JvmtiFunctions::GetClassFields,
1365 JvmtiFunctions::GetImplementedInterfaces,
1366 JvmtiFunctions::IsInterface,
1367 JvmtiFunctions::IsArrayClass,
1368 JvmtiFunctions::GetClassLoader,
1369 JvmtiFunctions::GetObjectHashCode,
1370 JvmtiFunctions::GetObjectMonitorUsage,
1371 JvmtiFunctions::GetFieldName, // 60
1372 JvmtiFunctions::GetFieldDeclaringClass,
1373 JvmtiFunctions::GetFieldModifiers,
1374 JvmtiFunctions::IsFieldSynthetic,
1375 JvmtiFunctions::GetMethodName,
1376 JvmtiFunctions::GetMethodDeclaringClass,
1377 JvmtiFunctions::GetMethodModifiers,
1378 nullptr, // reserved67
1379 JvmtiFunctions::GetMaxLocals,
1380 JvmtiFunctions::GetArgumentsSize,
1381 JvmtiFunctions::GetLineNumberTable, // 70
1382 JvmtiFunctions::GetMethodLocation,
1383 JvmtiFunctions::GetLocalVariableTable,
1384 JvmtiFunctions::SetNativeMethodPrefix,
1385 JvmtiFunctions::SetNativeMethodPrefixes,
1386 JvmtiFunctions::GetBytecodes,
1387 JvmtiFunctions::IsMethodNative,
1388 JvmtiFunctions::IsMethodSynthetic,
1389 JvmtiFunctions::GetLoadedClasses,
1390 JvmtiFunctions::GetClassLoaderClasses,
1391 JvmtiFunctions::PopFrame, // 80
1392 JvmtiFunctions::ForceEarlyReturnObject,
1393 JvmtiFunctions::ForceEarlyReturnInt,
1394 JvmtiFunctions::ForceEarlyReturnLong,
1395 JvmtiFunctions::ForceEarlyReturnFloat,
1396 JvmtiFunctions::ForceEarlyReturnDouble,
1397 JvmtiFunctions::ForceEarlyReturnVoid,
1398 JvmtiFunctions::RedefineClasses,
1399 JvmtiFunctions::GetVersionNumber,
1400 JvmtiFunctions::GetCapabilities,
1401 JvmtiFunctions::GetSourceDebugExtension, // 90
1402 JvmtiFunctions::IsMethodObsolete,
1403 JvmtiFunctions::SuspendThreadList,
1404 JvmtiFunctions::ResumeThreadList,
1405 nullptr, // reserved94
1406 nullptr, // reserved95
1407 nullptr, // reserved96
1408 nullptr, // reserved97
1409 nullptr, // reserved98
1410 nullptr, // reserved99
1411 JvmtiFunctions::GetAllStackTraces, // 100
1412 JvmtiFunctions::GetThreadListStackTraces,
1413 JvmtiFunctions::GetThreadLocalStorage,
1414 JvmtiFunctions::SetThreadLocalStorage,
1415 JvmtiFunctions::GetStackTrace,
1416 nullptr, // reserved105
1417 JvmtiFunctions::GetTag,
1418 JvmtiFunctions::SetTag,
1419 JvmtiFunctions::ForceGarbageCollection,
1420 JvmtiFunctions::IterateOverObjectsReachableFromObject,
1421 JvmtiFunctions::IterateOverReachableObjects, // 110
1422 JvmtiFunctions::IterateOverHeap,
1423 JvmtiFunctions::IterateOverInstancesOfClass,
1424 nullptr, // reserved113
1425 JvmtiFunctions::GetObjectsWithTags,
1426 JvmtiFunctions::FollowReferences,
1427 JvmtiFunctions::IterateThroughHeap,
1428 nullptr, // reserved117
1429 nullptr, // reserved118
1430 nullptr, // reserved119
1431 JvmtiFunctions::SetJNIFunctionTable, // 120
1432 JvmtiFunctions::GetJNIFunctionTable,
1433 JvmtiFunctions::SetEventCallbacks,
1434 JvmtiFunctions::GenerateEvents,
1435 JvmtiFunctions::GetExtensionFunctions,
1436 JvmtiFunctions::GetExtensionEvents,
1437 JvmtiFunctions::SetExtensionEventCallback,
1438 JvmtiFunctions::DisposeEnvironment,
1439 JvmtiFunctions::GetErrorName,
1440 JvmtiFunctions::GetJLocationFormat,
1441 JvmtiFunctions::GetSystemProperties, // 130
1442 JvmtiFunctions::GetSystemProperty,
1443 JvmtiFunctions::SetSystemProperty,
1444 JvmtiFunctions::GetPhase,
1445 JvmtiFunctions::GetCurrentThreadCpuTimerInfo,
1446 JvmtiFunctions::GetCurrentThreadCpuTime,
1447 JvmtiFunctions::GetThreadCpuTimerInfo,
1448 JvmtiFunctions::GetThreadCpuTime,
1449 JvmtiFunctions::GetTimerInfo,
1450 JvmtiFunctions::GetTime,
1451 JvmtiFunctions::GetPotentialCapabilities, // 140
1452 nullptr, // reserved141
1453 JvmtiFunctions::AddCapabilities,
1454 JvmtiFunctions::RelinquishCapabilities,
1455 JvmtiFunctions::GetAvailableProcessors,
1456 JvmtiFunctions::GetClassVersionNumbers,
1457 JvmtiFunctions::GetConstantPool,
1458 JvmtiFunctions::GetEnvironmentLocalStorage,
1459 JvmtiFunctions::SetEnvironmentLocalStorage,
1460 JvmtiFunctions::AddToBootstrapClassLoaderSearch,
1461 JvmtiFunctions::SetVerboseFlag, // 150
1462 JvmtiFunctions::AddToSystemClassLoaderSearch,
1463 JvmtiFunctions::RetransformClasses,
1464 JvmtiFunctions::GetOwnedMonitorStackDepthInfo,
1465 JvmtiFunctions::GetObjectSize,
1466 JvmtiFunctions::GetLocalInstance,
1467};
1468
1469}; // namespace openjdkjvmti