blob: cf9e2e8a1950e8f76af2bdd8233806655cdc119c [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"
Alex Light9c20a142016-08-23 15:05:12 -070058#include "transform.h"
Alex Light49948e92016-08-11 15:35:28 -070059
60// TODO Remove this at some point by annotating all the methods. It was put in to make the skeleton
61// easier to create.
62#pragma GCC diagnostic ignored "-Wunused-parameter"
63
64namespace openjdkjvmti {
65
Andreas Gampe77708d92016-10-07 11:48:21 -070066EventHandler gEventHandler;
Andreas Gampecc13b222016-10-10 19:09:09 -070067ObjectTagTable gObjectTagTable(&gEventHandler);
Andreas Gampe6dee92e2016-09-12 19:58:13 -070068
Alex Lighte6574242016-08-17 09:56:24 -070069#define ENSURE_NON_NULL(n) \
70 do { \
71 if ((n) == nullptr) { \
72 return ERR(NULL_POINTER); \
73 } \
74 } while (false)
75
Alex Light49948e92016-08-11 15:35:28 -070076class JvmtiFunctions {
77 private:
78 static bool IsValidEnv(jvmtiEnv* env) {
79 return env != nullptr;
80 }
81
Alex Lighte6574242016-08-17 09:56:24 -070082#define ENSURE_VALID_ENV(env) \
83 do { \
84 if (!IsValidEnv(env)) { \
85 return ERR(INVALID_ENVIRONMENT); \
86 } \
87 } while (false)
88
89#define ENSURE_HAS_CAP(env, cap) \
90 do { \
91 ENSURE_VALID_ENV(env); \
92 if (ArtJvmTiEnv::AsArtJvmTiEnv(env)->capabilities.cap != 1) { \
93 return ERR(MUST_POSSESS_CAPABILITY); \
94 } \
95 } while (false)
96
Alex Light49948e92016-08-11 15:35:28 -070097 public:
98 static jvmtiError Allocate(jvmtiEnv* env, jlong size, unsigned char** mem_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -070099 ENSURE_VALID_ENV(env);
100 ENSURE_NON_NULL(mem_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700101 if (size < 0) {
102 return ERR(ILLEGAL_ARGUMENT);
103 } else if (size == 0) {
104 *mem_ptr = nullptr;
105 return OK;
106 }
107 *mem_ptr = static_cast<unsigned char*>(malloc(size));
108 return (*mem_ptr != nullptr) ? OK : ERR(OUT_OF_MEMORY);
109 }
110
111 static jvmtiError Deallocate(jvmtiEnv* env, unsigned char* mem) {
Alex Lighte6574242016-08-17 09:56:24 -0700112 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -0700113 if (mem != nullptr) {
114 free(mem);
115 }
116 return OK;
117 }
118
119 static jvmtiError GetThreadState(jvmtiEnv* env, jthread thread, jint* thread_state_ptr) {
120 return ERR(NOT_IMPLEMENTED);
121 }
122
123 static jvmtiError GetCurrentThread(jvmtiEnv* env, jthread* thread_ptr) {
124 return ERR(NOT_IMPLEMENTED);
125 }
126
127 static jvmtiError GetAllThreads(jvmtiEnv* env, jint* threads_count_ptr, jthread** threads_ptr) {
128 return ERR(NOT_IMPLEMENTED);
129 }
130
131 static jvmtiError SuspendThread(jvmtiEnv* env, jthread thread) {
132 return ERR(NOT_IMPLEMENTED);
133 }
134
135 static jvmtiError SuspendThreadList(jvmtiEnv* env,
136 jint request_count,
137 const jthread* request_list,
138 jvmtiError* results) {
139 return ERR(NOT_IMPLEMENTED);
140 }
141
142 static jvmtiError ResumeThread(jvmtiEnv* env, jthread thread) {
143 return ERR(NOT_IMPLEMENTED);
144 }
145
146 static jvmtiError ResumeThreadList(jvmtiEnv* env,
147 jint request_count,
148 const jthread* request_list,
149 jvmtiError* results) {
150 return ERR(NOT_IMPLEMENTED);
151 }
152
153 static jvmtiError StopThread(jvmtiEnv* env, jthread thread, jobject exception) {
154 return ERR(NOT_IMPLEMENTED);
155 }
156
157 static jvmtiError InterruptThread(jvmtiEnv* env, jthread thread) {
158 return ERR(NOT_IMPLEMENTED);
159 }
160
161 static jvmtiError GetThreadInfo(jvmtiEnv* env, jthread thread, jvmtiThreadInfo* info_ptr) {
162 return ERR(NOT_IMPLEMENTED);
163 }
164
165 static jvmtiError GetOwnedMonitorInfo(jvmtiEnv* env,
166 jthread thread,
167 jint* owned_monitor_count_ptr,
168 jobject** owned_monitors_ptr) {
169 return ERR(NOT_IMPLEMENTED);
170 }
171
172 static jvmtiError GetOwnedMonitorStackDepthInfo(jvmtiEnv* env,
173 jthread thread,
174 jint* monitor_info_count_ptr,
175 jvmtiMonitorStackDepthInfo** monitor_info_ptr) {
176 return ERR(NOT_IMPLEMENTED);
177 }
178
179 static jvmtiError GetCurrentContendedMonitor(jvmtiEnv* env,
180 jthread thread,
181 jobject* monitor_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700182 return ERR(NOT_IMPLEMENTED);
Alex Light49948e92016-08-11 15:35:28 -0700183 }
184
185 static jvmtiError RunAgentThread(jvmtiEnv* env,
186 jthread thread,
187 jvmtiStartFunction proc,
188 const void* arg,
189 jint priority) {
190 return ERR(NOT_IMPLEMENTED);
191 }
192
193 static jvmtiError SetThreadLocalStorage(jvmtiEnv* env, jthread thread, const void* data) {
194 return ERR(NOT_IMPLEMENTED);
195 }
196
197 static jvmtiError GetThreadLocalStorage(jvmtiEnv* env, jthread thread, void** data_ptr) {
198 return ERR(NOT_IMPLEMENTED);
199 }
200
201 static jvmtiError GetTopThreadGroups(jvmtiEnv* env,
202 jint* group_count_ptr,
203 jthreadGroup** groups_ptr) {
204 return ERR(NOT_IMPLEMENTED);
205 }
206
207 static jvmtiError GetThreadGroupInfo(jvmtiEnv* env,
208 jthreadGroup group,
209 jvmtiThreadGroupInfo* info_ptr) {
210 return ERR(NOT_IMPLEMENTED);
211 }
212
213 static jvmtiError GetThreadGroupChildren(jvmtiEnv* env,
214 jthreadGroup group,
215 jint* thread_count_ptr,
216 jthread** threads_ptr,
217 jint* group_count_ptr,
218 jthreadGroup** groups_ptr) {
219 return ERR(NOT_IMPLEMENTED);
220 }
221
222 static jvmtiError GetStackTrace(jvmtiEnv* env,
223 jthread thread,
224 jint start_depth,
225 jint max_frame_count,
226 jvmtiFrameInfo* frame_buffer,
227 jint* count_ptr) {
Andreas Gampeb5eb94a2016-10-27 19:23:09 -0700228 return StackUtil::GetStackTrace(env,
229 thread,
230 start_depth,
231 max_frame_count,
232 frame_buffer,
233 count_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700234 }
235
236 static jvmtiError GetAllStackTraces(jvmtiEnv* env,
237 jint max_frame_count,
238 jvmtiStackInfo** stack_info_ptr,
239 jint* thread_count_ptr) {
Andreas Gampea1a27c62017-01-11 16:37:16 -0800240 return StackUtil::GetAllStackTraces(env, max_frame_count, stack_info_ptr, thread_count_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700241 }
242
243 static jvmtiError GetThreadListStackTraces(jvmtiEnv* env,
244 jint thread_count,
245 const jthread* thread_list,
246 jint max_frame_count,
247 jvmtiStackInfo** stack_info_ptr) {
248 return ERR(NOT_IMPLEMENTED);
249 }
250
251 static jvmtiError GetFrameCount(jvmtiEnv* env, jthread thread, jint* count_ptr) {
252 return ERR(NOT_IMPLEMENTED);
253 }
254
255 static jvmtiError PopFrame(jvmtiEnv* env, jthread thread) {
256 return ERR(NOT_IMPLEMENTED);
257 }
258
259 static jvmtiError GetFrameLocation(jvmtiEnv* env,
260 jthread thread,
261 jint depth,
262 jmethodID* method_ptr,
263 jlocation* location_ptr) {
264 return ERR(NOT_IMPLEMENTED);
265 }
266
267 static jvmtiError NotifyFramePop(jvmtiEnv* env, jthread thread, jint depth) {
268 return ERR(NOT_IMPLEMENTED);
269 }
270
271 static jvmtiError ForceEarlyReturnObject(jvmtiEnv* env, jthread thread, jobject value) {
272 return ERR(NOT_IMPLEMENTED);
273 }
274
275 static jvmtiError ForceEarlyReturnInt(jvmtiEnv* env, jthread thread, jint value) {
276 return ERR(NOT_IMPLEMENTED);
277 }
278
279 static jvmtiError ForceEarlyReturnLong(jvmtiEnv* env, jthread thread, jlong value) {
280 return ERR(NOT_IMPLEMENTED);
281 }
282
283 static jvmtiError ForceEarlyReturnFloat(jvmtiEnv* env, jthread thread, jfloat value) {
284 return ERR(NOT_IMPLEMENTED);
285 }
286
287 static jvmtiError ForceEarlyReturnDouble(jvmtiEnv* env, jthread thread, jdouble value) {
288 return ERR(NOT_IMPLEMENTED);
289 }
290
291 static jvmtiError ForceEarlyReturnVoid(jvmtiEnv* env, jthread thread) {
292 return ERR(NOT_IMPLEMENTED);
293 }
294
295 static jvmtiError FollowReferences(jvmtiEnv* env,
296 jint heap_filter,
297 jclass klass,
298 jobject initial_object,
299 const jvmtiHeapCallbacks* callbacks,
300 const void* user_data) {
Andreas Gampe70bfc8a2016-11-03 11:04:15 -0700301 HeapUtil heap_util(&gObjectTagTable);
302 return heap_util.FollowReferences(env,
303 heap_filter,
304 klass,
305 initial_object,
306 callbacks,
307 user_data);
Alex Light49948e92016-08-11 15:35:28 -0700308 }
309
310 static jvmtiError IterateThroughHeap(jvmtiEnv* env,
311 jint heap_filter,
312 jclass klass,
313 const jvmtiHeapCallbacks* callbacks,
314 const void* user_data) {
Alex Lighte6574242016-08-17 09:56:24 -0700315 ENSURE_HAS_CAP(env, can_tag_objects);
Andreas Gampee54d9922016-10-11 19:55:37 -0700316 HeapUtil heap_util(&gObjectTagTable);
317 return heap_util.IterateThroughHeap(env, heap_filter, klass, callbacks, user_data);
Alex Light49948e92016-08-11 15:35:28 -0700318 }
319
320 static jvmtiError GetTag(jvmtiEnv* env, jobject object, jlong* tag_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700321 ENSURE_HAS_CAP(env, can_tag_objects);
Andreas Gampe6dee92e2016-09-12 19:58:13 -0700322
323 JNIEnv* jni_env = GetJniEnv(env);
324 if (jni_env == nullptr) {
325 return ERR(INTERNAL);
326 }
327
328 art::ScopedObjectAccess soa(jni_env);
329 art::ObjPtr<art::mirror::Object> obj = soa.Decode<art::mirror::Object>(object);
330 if (!gObjectTagTable.GetTag(obj.Ptr(), tag_ptr)) {
331 *tag_ptr = 0;
332 }
333
334 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700335 }
336
337 static jvmtiError SetTag(jvmtiEnv* env, jobject object, jlong tag) {
Alex Lighte6574242016-08-17 09:56:24 -0700338 ENSURE_HAS_CAP(env, can_tag_objects);
339
Andreas Gampe6dee92e2016-09-12 19:58:13 -0700340 if (object == nullptr) {
341 return ERR(NULL_POINTER);
342 }
343
344 JNIEnv* jni_env = GetJniEnv(env);
345 if (jni_env == nullptr) {
346 return ERR(INTERNAL);
347 }
348
349 art::ScopedObjectAccess soa(jni_env);
350 art::ObjPtr<art::mirror::Object> obj = soa.Decode<art::mirror::Object>(object);
Andreas Gampee54eee12016-10-20 19:03:58 -0700351 gObjectTagTable.Set(obj.Ptr(), tag);
Andreas Gampe6dee92e2016-09-12 19:58:13 -0700352
353 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700354 }
355
356 static jvmtiError GetObjectsWithTags(jvmtiEnv* env,
357 jint tag_count,
358 const jlong* tags,
359 jint* count_ptr,
360 jobject** object_result_ptr,
361 jlong** tag_result_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700362 ENSURE_HAS_CAP(env, can_tag_objects);
363
Andreas Gampe5e6046b2016-10-25 12:05:53 -0700364 JNIEnv* jni_env = GetJniEnv(env);
365 if (jni_env == nullptr) {
366 return ERR(INTERNAL);
367 }
368
369 art::ScopedObjectAccess soa(jni_env);
370 return gObjectTagTable.GetTaggedObjects(env,
371 tag_count,
372 tags,
373 count_ptr,
374 object_result_ptr,
375 tag_result_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700376 }
377
378 static jvmtiError ForceGarbageCollection(jvmtiEnv* env) {
Andreas Gampe8da6d032016-10-31 19:31:03 -0700379 return HeapUtil::ForceGarbageCollection(env);
Alex Light49948e92016-08-11 15:35:28 -0700380 }
381
382 static jvmtiError IterateOverObjectsReachableFromObject(
383 jvmtiEnv* env,
384 jobject object,
385 jvmtiObjectReferenceCallback object_reference_callback,
386 const void* user_data) {
387 return ERR(NOT_IMPLEMENTED);
388 }
389
390 static jvmtiError IterateOverReachableObjects(jvmtiEnv* env,
391 jvmtiHeapRootCallback heap_root_callback,
392 jvmtiStackReferenceCallback stack_ref_callback,
393 jvmtiObjectReferenceCallback object_ref_callback,
394 const void* user_data) {
395 return ERR(NOT_IMPLEMENTED);
396 }
397
398 static jvmtiError IterateOverHeap(jvmtiEnv* env,
399 jvmtiHeapObjectFilter object_filter,
400 jvmtiHeapObjectCallback heap_object_callback,
401 const void* user_data) {
402 return ERR(NOT_IMPLEMENTED);
403 }
404
405 static jvmtiError IterateOverInstancesOfClass(jvmtiEnv* env,
406 jclass klass,
407 jvmtiHeapObjectFilter object_filter,
408 jvmtiHeapObjectCallback heap_object_callback,
409 const void* user_data) {
410 return ERR(NOT_IMPLEMENTED);
411 }
412
413 static jvmtiError GetLocalObject(jvmtiEnv* env,
414 jthread thread,
415 jint depth,
416 jint slot,
417 jobject* value_ptr) {
418 return ERR(NOT_IMPLEMENTED);
419 }
420
421 static jvmtiError GetLocalInstance(jvmtiEnv* env,
422 jthread thread,
423 jint depth,
424 jobject* value_ptr) {
425 return ERR(NOT_IMPLEMENTED);
426 }
427
428 static jvmtiError GetLocalInt(jvmtiEnv* env,
429 jthread thread,
430 jint depth,
431 jint slot,
432 jint* value_ptr) {
433 return ERR(NOT_IMPLEMENTED);
434 }
435
436 static jvmtiError GetLocalLong(jvmtiEnv* env,
437 jthread thread,
438 jint depth,
439 jint slot,
440 jlong* value_ptr) {
441 return ERR(NOT_IMPLEMENTED);
442 }
443
444 static jvmtiError GetLocalFloat(jvmtiEnv* env,
445 jthread thread,
446 jint depth,
447 jint slot,
448 jfloat* value_ptr) {
449 return ERR(NOT_IMPLEMENTED);
450 }
451
452 static jvmtiError GetLocalDouble(jvmtiEnv* env,
453 jthread thread,
454 jint depth,
455 jint slot,
456 jdouble* value_ptr) {
457 return ERR(NOT_IMPLEMENTED);
458 }
459
460 static jvmtiError SetLocalObject(jvmtiEnv* env,
461 jthread thread,
462 jint depth,
463 jint slot,
464 jobject value) {
465 return ERR(NOT_IMPLEMENTED);
466 }
467
468 static jvmtiError SetLocalInt(jvmtiEnv* env,
469 jthread thread,
470 jint depth,
471 jint slot,
472 jint value) {
473 return ERR(NOT_IMPLEMENTED);
474 }
475
476 static jvmtiError SetLocalLong(jvmtiEnv* env,
477 jthread thread,
478 jint depth,
479 jint slot,
480 jlong value) {
481 return ERR(NOT_IMPLEMENTED);
482 }
483
484 static jvmtiError SetLocalFloat(jvmtiEnv* env,
485 jthread thread,
486 jint depth,
487 jint slot,
488 jfloat value) {
489 return ERR(NOT_IMPLEMENTED);
490 }
491
492 static jvmtiError SetLocalDouble(jvmtiEnv* env,
493 jthread thread,
494 jint depth,
495 jint slot,
496 jdouble value) {
497 return ERR(NOT_IMPLEMENTED);
498 }
499
500 static jvmtiError SetBreakpoint(jvmtiEnv* env, jmethodID method, jlocation location) {
501 return ERR(NOT_IMPLEMENTED);
502 }
503
504 static jvmtiError ClearBreakpoint(jvmtiEnv* env, jmethodID method, jlocation location) {
505 return ERR(NOT_IMPLEMENTED);
506 }
507
508 static jvmtiError SetFieldAccessWatch(jvmtiEnv* env, jclass klass, jfieldID field) {
509 return ERR(NOT_IMPLEMENTED);
510 }
511
512 static jvmtiError ClearFieldAccessWatch(jvmtiEnv* env, jclass klass, jfieldID field) {
513 return ERR(NOT_IMPLEMENTED);
514 }
515
516 static jvmtiError SetFieldModificationWatch(jvmtiEnv* env, jclass klass, jfieldID field) {
517 return ERR(NOT_IMPLEMENTED);
518 }
519
520 static jvmtiError ClearFieldModificationWatch(jvmtiEnv* env, jclass klass, jfieldID field) {
521 return ERR(NOT_IMPLEMENTED);
522 }
523
524 static jvmtiError GetLoadedClasses(jvmtiEnv* env, jint* class_count_ptr, jclass** classes_ptr) {
Andreas Gampeaa8b60c2016-10-12 12:51:25 -0700525 HeapUtil heap_util(&gObjectTagTable);
526 return heap_util.GetLoadedClasses(env, class_count_ptr, classes_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700527 }
528
529 static jvmtiError GetClassLoaderClasses(jvmtiEnv* env,
530 jobject initiating_loader,
531 jint* class_count_ptr,
532 jclass** classes_ptr) {
533 return ERR(NOT_IMPLEMENTED);
534 }
535
536 static jvmtiError GetClassSignature(jvmtiEnv* env,
537 jclass klass,
538 char** signature_ptr,
539 char** generic_ptr) {
Andreas Gampee492ae32016-10-28 19:34:57 -0700540 return ClassUtil::GetClassSignature(env, klass, signature_ptr, generic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700541 }
542
543 static jvmtiError GetClassStatus(jvmtiEnv* env, jclass klass, jint* status_ptr) {
Andreas Gampeff9d2092017-01-06 09:12:49 -0800544 return ClassUtil::GetClassStatus(env, klass, status_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700545 }
546
547 static jvmtiError GetSourceFileName(jvmtiEnv* env, jclass klass, char** source_name_ptr) {
548 return ERR(NOT_IMPLEMENTED);
549 }
550
551 static jvmtiError GetClassModifiers(jvmtiEnv* env, jclass klass, jint* modifiers_ptr) {
Andreas Gampe64013e52017-01-06 13:07:19 -0800552 return ClassUtil::GetClassModifiers(env, klass, modifiers_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700553 }
554
555 static jvmtiError GetClassMethods(jvmtiEnv* env,
556 jclass klass,
557 jint* method_count_ptr,
558 jmethodID** methods_ptr) {
Andreas Gampe18fee4d2017-01-06 11:36:35 -0800559 return ClassUtil::GetClassMethods(env, klass, method_count_ptr, methods_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700560 }
561
562 static jvmtiError GetClassFields(jvmtiEnv* env,
563 jclass klass,
564 jint* field_count_ptr,
565 jfieldID** fields_ptr) {
Andreas Gampeac587272017-01-05 15:21:34 -0800566 return ClassUtil::GetClassFields(env, klass, field_count_ptr, fields_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700567 }
568
569 static jvmtiError GetImplementedInterfaces(jvmtiEnv* env,
570 jclass klass,
571 jint* interface_count_ptr,
572 jclass** interfaces_ptr) {
Andreas Gampe8b07e472017-01-06 14:20:39 -0800573 return ClassUtil::GetImplementedInterfaces(env, klass, interface_count_ptr, interfaces_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700574 }
575
576 static jvmtiError GetClassVersionNumbers(jvmtiEnv* env,
577 jclass klass,
578 jint* minor_version_ptr,
579 jint* major_version_ptr) {
580 return ERR(NOT_IMPLEMENTED);
581 }
582
583 static jvmtiError GetConstantPool(jvmtiEnv* env,
584 jclass klass,
585 jint* constant_pool_count_ptr,
586 jint* constant_pool_byte_count_ptr,
587 unsigned char** constant_pool_bytes_ptr) {
588 return ERR(NOT_IMPLEMENTED);
589 }
590
591 static jvmtiError IsInterface(jvmtiEnv* env, jclass klass, jboolean* is_interface_ptr) {
Andreas Gampe4fd66ec2017-01-05 14:42:13 -0800592 return ClassUtil::IsInterface(env, klass, is_interface_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700593 }
594
595 static jvmtiError IsArrayClass(jvmtiEnv* env,
596 jclass klass,
597 jboolean* is_array_class_ptr) {
Andreas Gampe4fd66ec2017-01-05 14:42:13 -0800598 return ClassUtil::IsArrayClass(env, klass, is_array_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700599 }
600
601 static jvmtiError IsModifiableClass(jvmtiEnv* env,
602 jclass klass,
603 jboolean* is_modifiable_class_ptr) {
Alex Lighte4a88632017-01-10 07:41:24 -0800604 return Redefiner::IsModifiableClass(env, klass, is_modifiable_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700605 }
606
607 static jvmtiError GetClassLoader(jvmtiEnv* env, jclass klass, jobject* classloader_ptr) {
Andreas Gampe8f5b6032017-01-06 15:50:55 -0800608 return ClassUtil::GetClassLoader(env, klass, classloader_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700609 }
610
611 static jvmtiError GetSourceDebugExtension(jvmtiEnv* env,
612 jclass klass,
613 char** source_debug_extension_ptr) {
614 return ERR(NOT_IMPLEMENTED);
615 }
616
617 static jvmtiError RetransformClasses(jvmtiEnv* env, jint class_count, const jclass* classes) {
618 return ERR(NOT_IMPLEMENTED);
619 }
620
621 static jvmtiError RedefineClasses(jvmtiEnv* env,
622 jint class_count,
623 const jvmtiClassDefinition* class_definitions) {
624 return ERR(NOT_IMPLEMENTED);
625 }
626
627 static jvmtiError GetObjectSize(jvmtiEnv* env, jobject object, jlong* size_ptr) {
Andreas Gampe50a4e492017-01-06 18:00:20 -0800628 return ObjectUtil::GetObjectSize(env, object, size_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700629 }
630
631 static jvmtiError GetObjectHashCode(jvmtiEnv* env, jobject object, jint* hash_code_ptr) {
Andreas Gampe50a4e492017-01-06 18:00:20 -0800632 return ObjectUtil::GetObjectHashCode(env, object, hash_code_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700633 }
634
635 static jvmtiError GetObjectMonitorUsage(jvmtiEnv* env,
636 jobject object,
637 jvmtiMonitorUsage* info_ptr) {
638 return ERR(NOT_IMPLEMENTED);
639 }
640
641 static jvmtiError GetFieldName(jvmtiEnv* env,
642 jclass klass,
643 jfieldID field,
644 char** name_ptr,
645 char** signature_ptr,
646 char** generic_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800647 return FieldUtil::GetFieldName(env, klass, field, name_ptr, signature_ptr, generic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700648 }
649
650 static jvmtiError GetFieldDeclaringClass(jvmtiEnv* env,
651 jclass klass,
652 jfieldID field,
653 jclass* declaring_class_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800654 return FieldUtil::GetFieldDeclaringClass(env, klass, field, declaring_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700655 }
656
657 static jvmtiError GetFieldModifiers(jvmtiEnv* env,
658 jclass klass,
659 jfieldID field,
660 jint* modifiers_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800661 return FieldUtil::GetFieldModifiers(env, klass, field, modifiers_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700662 }
663
664 static jvmtiError IsFieldSynthetic(jvmtiEnv* env,
665 jclass klass,
666 jfieldID field,
667 jboolean* is_synthetic_ptr) {
Andreas Gampeab2f0d02017-01-05 17:23:45 -0800668 return FieldUtil::IsFieldSynthetic(env, klass, field, is_synthetic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700669 }
670
671 static jvmtiError GetMethodName(jvmtiEnv* env,
672 jmethodID method,
673 char** name_ptr,
674 char** signature_ptr,
675 char** generic_ptr) {
Andreas Gampe3c252f02016-10-27 18:25:17 -0700676 return MethodUtil::GetMethodName(env, method, name_ptr, signature_ptr, generic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700677 }
678
679 static jvmtiError GetMethodDeclaringClass(jvmtiEnv* env,
680 jmethodID method,
681 jclass* declaring_class_ptr) {
Andreas Gampe368a2082016-10-28 17:33:13 -0700682 return MethodUtil::GetMethodDeclaringClass(env, method, declaring_class_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700683 }
684
685 static jvmtiError GetMethodModifiers(jvmtiEnv* env,
686 jmethodID method,
687 jint* modifiers_ptr) {
Andreas Gampe36bcd4f2016-10-28 18:07:18 -0700688 return MethodUtil::GetMethodModifiers(env, method, modifiers_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700689 }
690
691 static jvmtiError GetMaxLocals(jvmtiEnv* env,
692 jmethodID method,
693 jint* max_ptr) {
Andreas Gampef71832e2017-01-09 11:38:04 -0800694 return MethodUtil::GetMaxLocals(env, method, max_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700695 }
696
697 static jvmtiError GetArgumentsSize(jvmtiEnv* env,
698 jmethodID method,
699 jint* size_ptr) {
Andreas Gampef71832e2017-01-09 11:38:04 -0800700 return MethodUtil::GetArgumentsSize(env, method, size_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700701 }
702
703 static jvmtiError GetLineNumberTable(jvmtiEnv* env,
704 jmethodID method,
705 jint* entry_count_ptr,
706 jvmtiLineNumberEntry** table_ptr) {
Andreas Gampeda3e5612016-12-13 19:00:53 -0800707 return MethodUtil::GetLineNumberTable(env, method, entry_count_ptr, table_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700708 }
709
710 static jvmtiError GetMethodLocation(jvmtiEnv* env,
711 jmethodID method,
712 jlocation* start_location_ptr,
713 jlocation* end_location_ptr) {
Andreas Gampef71832e2017-01-09 11:38:04 -0800714 return MethodUtil::GetMethodLocation(env, method, start_location_ptr, end_location_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700715 }
716
717 static jvmtiError GetLocalVariableTable(jvmtiEnv* env,
718 jmethodID method,
719 jint* entry_count_ptr,
720 jvmtiLocalVariableEntry** table_ptr) {
721 return ERR(NOT_IMPLEMENTED);
722 }
723
724 static jvmtiError GetBytecodes(jvmtiEnv* env,
725 jmethodID method,
726 jint* bytecode_count_ptr,
727 unsigned char** bytecodes_ptr) {
728 return ERR(NOT_IMPLEMENTED);
729 }
730
731 static jvmtiError IsMethodNative(jvmtiEnv* env, jmethodID method, jboolean* is_native_ptr) {
Andreas Gampefdeef522017-01-09 14:40:25 -0800732 return MethodUtil::IsMethodNative(env, method, is_native_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700733 }
734
735 static jvmtiError IsMethodSynthetic(jvmtiEnv* env, jmethodID method, jboolean* is_synthetic_ptr) {
Andreas Gampefdeef522017-01-09 14:40:25 -0800736 return MethodUtil::IsMethodSynthetic(env, method, is_synthetic_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700737 }
738
739 static jvmtiError IsMethodObsolete(jvmtiEnv* env, jmethodID method, jboolean* is_obsolete_ptr) {
Andreas Gampefdeef522017-01-09 14:40:25 -0800740 return MethodUtil::IsMethodObsolete(env, method, is_obsolete_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700741 }
742
743 static jvmtiError SetNativeMethodPrefix(jvmtiEnv* env, const char* prefix) {
744 return ERR(NOT_IMPLEMENTED);
745 }
746
747 static jvmtiError SetNativeMethodPrefixes(jvmtiEnv* env, jint prefix_count, char** prefixes) {
748 return ERR(NOT_IMPLEMENTED);
749 }
750
751 static jvmtiError CreateRawMonitor(jvmtiEnv* env, const char* name, jrawMonitorID* monitor_ptr) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800752 return MonitorUtil::CreateRawMonitor(env, name, monitor_ptr);
Alex Light49948e92016-08-11 15:35:28 -0700753 }
754
755 static jvmtiError DestroyRawMonitor(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800756 return MonitorUtil::DestroyRawMonitor(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700757 }
758
759 static jvmtiError RawMonitorEnter(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800760 return MonitorUtil::RawMonitorEnter(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700761 }
762
763 static jvmtiError RawMonitorExit(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800764 return MonitorUtil::RawMonitorExit(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700765 }
766
767 static jvmtiError RawMonitorWait(jvmtiEnv* env, jrawMonitorID monitor, jlong millis) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800768 return MonitorUtil::RawMonitorWait(env, monitor, millis);
Alex Light49948e92016-08-11 15:35:28 -0700769 }
770
771 static jvmtiError RawMonitorNotify(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800772 return MonitorUtil::RawMonitorNotify(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700773 }
774
775 static jvmtiError RawMonitorNotifyAll(jvmtiEnv* env, jrawMonitorID monitor) {
Andreas Gampe319dbe82017-01-09 16:42:21 -0800776 return MonitorUtil::RawMonitorNotifyAll(env, monitor);
Alex Light49948e92016-08-11 15:35:28 -0700777 }
778
779 static jvmtiError SetJNIFunctionTable(jvmtiEnv* env, const jniNativeInterface* function_table) {
780 return ERR(NOT_IMPLEMENTED);
781 }
782
783 static jvmtiError GetJNIFunctionTable(jvmtiEnv* env, jniNativeInterface** function_table) {
784 return ERR(NOT_IMPLEMENTED);
785 }
786
Andreas Gampe77708d92016-10-07 11:48:21 -0700787 // TODO: This will require locking, so that an agent can't remove callbacks when we're dispatching
788 // an event.
Alex Light49948e92016-08-11 15:35:28 -0700789 static jvmtiError SetEventCallbacks(jvmtiEnv* env,
790 const jvmtiEventCallbacks* callbacks,
791 jint size_of_callbacks) {
Alex Lighte6574242016-08-17 09:56:24 -0700792 ENSURE_VALID_ENV(env);
Andreas Gampe77708d92016-10-07 11:48:21 -0700793 if (size_of_callbacks < 0) {
794 return ERR(ILLEGAL_ARGUMENT);
795 }
796
797 if (callbacks == nullptr) {
798 ArtJvmTiEnv::AsArtJvmTiEnv(env)->event_callbacks.reset();
799 return ERR(NONE);
800 }
801
802 std::unique_ptr<jvmtiEventCallbacks> tmp(new jvmtiEventCallbacks());
803 memset(tmp.get(), 0, sizeof(jvmtiEventCallbacks));
804 size_t copy_size = std::min(sizeof(jvmtiEventCallbacks),
805 static_cast<size_t>(size_of_callbacks));
806 copy_size = art::RoundDown(copy_size, sizeof(void*));
807 memcpy(tmp.get(), callbacks, copy_size);
808
809 ArtJvmTiEnv::AsArtJvmTiEnv(env)->event_callbacks = std::move(tmp);
810
811 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700812 }
813
814 static jvmtiError SetEventNotificationMode(jvmtiEnv* env,
815 jvmtiEventMode mode,
816 jvmtiEvent event_type,
817 jthread event_thread,
818 ...) {
Alex Lighte6574242016-08-17 09:56:24 -0700819 ENSURE_VALID_ENV(env);
820 // TODO: Check for capabilities.
Andreas Gampe77708d92016-10-07 11:48:21 -0700821 art::Thread* art_thread = nullptr;
822 if (event_thread != nullptr) {
823 // TODO: Need non-aborting call here, to return JVMTI_ERROR_INVALID_THREAD.
824 art::ScopedObjectAccess soa(art::Thread::Current());
825 art::MutexLock mu(soa.Self(), *art::Locks::thread_list_lock_);
826 art_thread = art::Thread::FromManagedThread(soa, event_thread);
827
828 if (art_thread == nullptr || // The thread hasn't been started or is already dead.
829 art_thread->IsStillStarting()) {
830 // TODO: We may want to let the EventHandler know, so it could clean up masks, potentially.
831 return ERR(THREAD_NOT_ALIVE);
832 }
833 }
834
835 return gEventHandler.SetEvent(ArtJvmTiEnv::AsArtJvmTiEnv(env), art_thread, event_type, mode);
Alex Light49948e92016-08-11 15:35:28 -0700836 }
837
838 static jvmtiError GenerateEvents(jvmtiEnv* env, jvmtiEvent event_type) {
839 return ERR(NOT_IMPLEMENTED);
840 }
841
842 static jvmtiError GetExtensionFunctions(jvmtiEnv* env,
843 jint* extension_count_ptr,
844 jvmtiExtensionFunctionInfo** extensions) {
Andreas Gampee4c33842017-01-09 10:50:17 -0800845 // We do not have any extension functions.
846 *extension_count_ptr = 0;
847 *extensions = nullptr;
848
849 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700850 }
851
852 static jvmtiError GetExtensionEvents(jvmtiEnv* env,
853 jint* extension_count_ptr,
854 jvmtiExtensionEventInfo** extensions) {
Andreas Gampee4c33842017-01-09 10:50:17 -0800855 // We do not have any extension events.
856 *extension_count_ptr = 0;
857 *extensions = nullptr;
858
859 return ERR(NONE);
Alex Light49948e92016-08-11 15:35:28 -0700860 }
861
862 static jvmtiError SetExtensionEventCallback(jvmtiEnv* env,
863 jint extension_event_index,
864 jvmtiExtensionEvent callback) {
Andreas Gampee4c33842017-01-09 10:50:17 -0800865 // We do not have any extension events, so any call is illegal.
866 return ERR(ILLEGAL_ARGUMENT);
Alex Light49948e92016-08-11 15:35:28 -0700867 }
868
869 static jvmtiError GetPotentialCapabilities(jvmtiEnv* env, jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700870 ENSURE_VALID_ENV(env);
871 ENSURE_NON_NULL(capabilities_ptr);
872 *capabilities_ptr = kPotentialCapabilities;
873 return OK;
Alex Light49948e92016-08-11 15:35:28 -0700874 }
875
876 static jvmtiError AddCapabilities(jvmtiEnv* env, const jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700877 ENSURE_VALID_ENV(env);
878 ENSURE_NON_NULL(capabilities_ptr);
879 ArtJvmTiEnv* art_env = static_cast<ArtJvmTiEnv*>(env);
880 jvmtiError ret = OK;
881#define ADD_CAPABILITY(e) \
882 do { \
883 if (capabilities_ptr->e == 1) { \
884 if (kPotentialCapabilities.e == 1) { \
885 art_env->capabilities.e = 1;\
886 } else { \
887 ret = ERR(NOT_AVAILABLE); \
888 } \
889 } \
890 } while (false)
891
892 ADD_CAPABILITY(can_tag_objects);
893 ADD_CAPABILITY(can_generate_field_modification_events);
894 ADD_CAPABILITY(can_generate_field_access_events);
895 ADD_CAPABILITY(can_get_bytecodes);
896 ADD_CAPABILITY(can_get_synthetic_attribute);
897 ADD_CAPABILITY(can_get_owned_monitor_info);
898 ADD_CAPABILITY(can_get_current_contended_monitor);
899 ADD_CAPABILITY(can_get_monitor_info);
900 ADD_CAPABILITY(can_pop_frame);
901 ADD_CAPABILITY(can_redefine_classes);
902 ADD_CAPABILITY(can_signal_thread);
903 ADD_CAPABILITY(can_get_source_file_name);
904 ADD_CAPABILITY(can_get_line_numbers);
905 ADD_CAPABILITY(can_get_source_debug_extension);
906 ADD_CAPABILITY(can_access_local_variables);
907 ADD_CAPABILITY(can_maintain_original_method_order);
908 ADD_CAPABILITY(can_generate_single_step_events);
909 ADD_CAPABILITY(can_generate_exception_events);
910 ADD_CAPABILITY(can_generate_frame_pop_events);
911 ADD_CAPABILITY(can_generate_breakpoint_events);
912 ADD_CAPABILITY(can_suspend);
913 ADD_CAPABILITY(can_redefine_any_class);
914 ADD_CAPABILITY(can_get_current_thread_cpu_time);
915 ADD_CAPABILITY(can_get_thread_cpu_time);
916 ADD_CAPABILITY(can_generate_method_entry_events);
917 ADD_CAPABILITY(can_generate_method_exit_events);
918 ADD_CAPABILITY(can_generate_all_class_hook_events);
919 ADD_CAPABILITY(can_generate_compiled_method_load_events);
920 ADD_CAPABILITY(can_generate_monitor_events);
921 ADD_CAPABILITY(can_generate_vm_object_alloc_events);
922 ADD_CAPABILITY(can_generate_native_method_bind_events);
923 ADD_CAPABILITY(can_generate_garbage_collection_events);
924 ADD_CAPABILITY(can_generate_object_free_events);
925 ADD_CAPABILITY(can_force_early_return);
926 ADD_CAPABILITY(can_get_owned_monitor_stack_depth_info);
927 ADD_CAPABILITY(can_get_constant_pool);
928 ADD_CAPABILITY(can_set_native_method_prefix);
929 ADD_CAPABILITY(can_retransform_classes);
930 ADD_CAPABILITY(can_retransform_any_class);
931 ADD_CAPABILITY(can_generate_resource_exhaustion_heap_events);
932 ADD_CAPABILITY(can_generate_resource_exhaustion_threads_events);
933#undef ADD_CAPABILITY
934 return ret;
Alex Light49948e92016-08-11 15:35:28 -0700935 }
936
937 static jvmtiError RelinquishCapabilities(jvmtiEnv* env,
938 const jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700939 ENSURE_VALID_ENV(env);
940 ENSURE_NON_NULL(capabilities_ptr);
941 ArtJvmTiEnv* art_env = reinterpret_cast<ArtJvmTiEnv*>(env);
942#define DEL_CAPABILITY(e) \
943 do { \
944 if (capabilities_ptr->e == 1) { \
945 art_env->capabilities.e = 0;\
946 } \
947 } while (false)
948
949 DEL_CAPABILITY(can_tag_objects);
950 DEL_CAPABILITY(can_generate_field_modification_events);
951 DEL_CAPABILITY(can_generate_field_access_events);
952 DEL_CAPABILITY(can_get_bytecodes);
953 DEL_CAPABILITY(can_get_synthetic_attribute);
954 DEL_CAPABILITY(can_get_owned_monitor_info);
955 DEL_CAPABILITY(can_get_current_contended_monitor);
956 DEL_CAPABILITY(can_get_monitor_info);
957 DEL_CAPABILITY(can_pop_frame);
958 DEL_CAPABILITY(can_redefine_classes);
959 DEL_CAPABILITY(can_signal_thread);
960 DEL_CAPABILITY(can_get_source_file_name);
961 DEL_CAPABILITY(can_get_line_numbers);
962 DEL_CAPABILITY(can_get_source_debug_extension);
963 DEL_CAPABILITY(can_access_local_variables);
964 DEL_CAPABILITY(can_maintain_original_method_order);
965 DEL_CAPABILITY(can_generate_single_step_events);
966 DEL_CAPABILITY(can_generate_exception_events);
967 DEL_CAPABILITY(can_generate_frame_pop_events);
968 DEL_CAPABILITY(can_generate_breakpoint_events);
969 DEL_CAPABILITY(can_suspend);
970 DEL_CAPABILITY(can_redefine_any_class);
971 DEL_CAPABILITY(can_get_current_thread_cpu_time);
972 DEL_CAPABILITY(can_get_thread_cpu_time);
973 DEL_CAPABILITY(can_generate_method_entry_events);
974 DEL_CAPABILITY(can_generate_method_exit_events);
975 DEL_CAPABILITY(can_generate_all_class_hook_events);
976 DEL_CAPABILITY(can_generate_compiled_method_load_events);
977 DEL_CAPABILITY(can_generate_monitor_events);
978 DEL_CAPABILITY(can_generate_vm_object_alloc_events);
979 DEL_CAPABILITY(can_generate_native_method_bind_events);
980 DEL_CAPABILITY(can_generate_garbage_collection_events);
981 DEL_CAPABILITY(can_generate_object_free_events);
982 DEL_CAPABILITY(can_force_early_return);
983 DEL_CAPABILITY(can_get_owned_monitor_stack_depth_info);
984 DEL_CAPABILITY(can_get_constant_pool);
985 DEL_CAPABILITY(can_set_native_method_prefix);
986 DEL_CAPABILITY(can_retransform_classes);
987 DEL_CAPABILITY(can_retransform_any_class);
988 DEL_CAPABILITY(can_generate_resource_exhaustion_heap_events);
989 DEL_CAPABILITY(can_generate_resource_exhaustion_threads_events);
990#undef DEL_CAPABILITY
991 return OK;
Alex Light49948e92016-08-11 15:35:28 -0700992 }
993
994 static jvmtiError GetCapabilities(jvmtiEnv* env, jvmtiCapabilities* capabilities_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -0700995 ENSURE_VALID_ENV(env);
996 ENSURE_NON_NULL(capabilities_ptr);
997 ArtJvmTiEnv* artenv = reinterpret_cast<ArtJvmTiEnv*>(env);
998 *capabilities_ptr = artenv->capabilities;
999 return OK;
Alex Light49948e92016-08-11 15:35:28 -07001000 }
1001
1002 static jvmtiError GetCurrentThreadCpuTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) {
1003 return ERR(NOT_IMPLEMENTED);
1004 }
1005
1006 static jvmtiError GetCurrentThreadCpuTime(jvmtiEnv* env, jlong* nanos_ptr) {
1007 return ERR(NOT_IMPLEMENTED);
1008 }
1009
1010 static jvmtiError GetThreadCpuTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) {
1011 return ERR(NOT_IMPLEMENTED);
1012 }
1013
1014 static jvmtiError GetThreadCpuTime(jvmtiEnv* env, jthread thread, jlong* nanos_ptr) {
1015 return ERR(NOT_IMPLEMENTED);
1016 }
1017
1018 static jvmtiError GetTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) {
1019 return ERR(NOT_IMPLEMENTED);
1020 }
1021
1022 static jvmtiError GetTime(jvmtiEnv* env, jlong* nanos_ptr) {
1023 return ERR(NOT_IMPLEMENTED);
1024 }
1025
1026 static jvmtiError GetAvailableProcessors(jvmtiEnv* env, jint* processor_count_ptr) {
1027 return ERR(NOT_IMPLEMENTED);
1028 }
1029
1030 static jvmtiError AddToBootstrapClassLoaderSearch(jvmtiEnv* env, const char* segment) {
1031 return ERR(NOT_IMPLEMENTED);
1032 }
1033
1034 static jvmtiError AddToSystemClassLoaderSearch(jvmtiEnv* env, const char* segment) {
1035 return ERR(NOT_IMPLEMENTED);
1036 }
1037
1038 static jvmtiError GetSystemProperties(jvmtiEnv* env, jint* count_ptr, char*** property_ptr) {
Andreas Gampe1bdaf732017-01-09 19:21:06 -08001039 return PropertiesUtil::GetSystemProperties(env, count_ptr, property_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001040 }
1041
1042 static jvmtiError GetSystemProperty(jvmtiEnv* env, const char* property, char** value_ptr) {
Andreas Gampe1bdaf732017-01-09 19:21:06 -08001043 return PropertiesUtil::GetSystemProperty(env, property, value_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001044 }
1045
1046 static jvmtiError SetSystemProperty(jvmtiEnv* env, const char* property, const char* value) {
Andreas Gampe1bdaf732017-01-09 19:21:06 -08001047 return PropertiesUtil::SetSystemProperty(env, property, value);
Alex Light49948e92016-08-11 15:35:28 -07001048 }
1049
1050 static jvmtiError GetPhase(jvmtiEnv* env, jvmtiPhase* phase_ptr) {
1051 return ERR(NOT_IMPLEMENTED);
1052 }
1053
1054 static jvmtiError DisposeEnvironment(jvmtiEnv* env) {
Alex Lighte6574242016-08-17 09:56:24 -07001055 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001056 delete env;
1057 return OK;
1058 }
1059
1060 static jvmtiError SetEnvironmentLocalStorage(jvmtiEnv* env, const void* data) {
Alex Lighte6574242016-08-17 09:56:24 -07001061 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001062 reinterpret_cast<ArtJvmTiEnv*>(env)->local_data = const_cast<void*>(data);
1063 return OK;
1064 }
1065
1066 static jvmtiError GetEnvironmentLocalStorage(jvmtiEnv* env, void** data_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001067 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001068 *data_ptr = reinterpret_cast<ArtJvmTiEnv*>(env)->local_data;
1069 return OK;
1070 }
1071
1072 static jvmtiError GetVersionNumber(jvmtiEnv* env, jint* version_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001073 ENSURE_VALID_ENV(env);
Alex Light49948e92016-08-11 15:35:28 -07001074 *version_ptr = JVMTI_VERSION;
1075 return OK;
1076 }
1077
1078 static jvmtiError GetErrorName(jvmtiEnv* env, jvmtiError error, char** name_ptr) {
Alex Lighte6574242016-08-17 09:56:24 -07001079 ENSURE_NON_NULL(name_ptr);
Alex Light49948e92016-08-11 15:35:28 -07001080 switch (error) {
1081#define ERROR_CASE(e) case (JVMTI_ERROR_ ## e) : do { \
Alex Light41960712017-01-06 14:44:23 -08001082 jvmtiError res = CopyString(env, \
1083 "JVMTI_ERROR_"#e, \
1084 reinterpret_cast<unsigned char**>(name_ptr)); \
1085 if (res != OK) { \
1086 *name_ptr = nullptr; \
1087 return res; \
1088 } else { \
1089 return OK; \
1090 } \
Alex Light49948e92016-08-11 15:35:28 -07001091 } while (false)
1092 ERROR_CASE(NONE);
1093 ERROR_CASE(INVALID_THREAD);
1094 ERROR_CASE(INVALID_THREAD_GROUP);
1095 ERROR_CASE(INVALID_PRIORITY);
1096 ERROR_CASE(THREAD_NOT_SUSPENDED);
1097 ERROR_CASE(THREAD_NOT_ALIVE);
1098 ERROR_CASE(INVALID_OBJECT);
1099 ERROR_CASE(INVALID_CLASS);
1100 ERROR_CASE(CLASS_NOT_PREPARED);
1101 ERROR_CASE(INVALID_METHODID);
1102 ERROR_CASE(INVALID_LOCATION);
1103 ERROR_CASE(INVALID_FIELDID);
1104 ERROR_CASE(NO_MORE_FRAMES);
1105 ERROR_CASE(OPAQUE_FRAME);
1106 ERROR_CASE(TYPE_MISMATCH);
1107 ERROR_CASE(INVALID_SLOT);
1108 ERROR_CASE(DUPLICATE);
1109 ERROR_CASE(NOT_FOUND);
1110 ERROR_CASE(INVALID_MONITOR);
1111 ERROR_CASE(NOT_MONITOR_OWNER);
1112 ERROR_CASE(INTERRUPT);
1113 ERROR_CASE(INVALID_CLASS_FORMAT);
1114 ERROR_CASE(CIRCULAR_CLASS_DEFINITION);
1115 ERROR_CASE(FAILS_VERIFICATION);
1116 ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_ADDED);
1117 ERROR_CASE(UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED);
1118 ERROR_CASE(INVALID_TYPESTATE);
1119 ERROR_CASE(UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED);
1120 ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_DELETED);
1121 ERROR_CASE(UNSUPPORTED_VERSION);
1122 ERROR_CASE(NAMES_DONT_MATCH);
1123 ERROR_CASE(UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED);
1124 ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED);
1125 ERROR_CASE(UNMODIFIABLE_CLASS);
1126 ERROR_CASE(NOT_AVAILABLE);
1127 ERROR_CASE(MUST_POSSESS_CAPABILITY);
1128 ERROR_CASE(NULL_POINTER);
1129 ERROR_CASE(ABSENT_INFORMATION);
1130 ERROR_CASE(INVALID_EVENT_TYPE);
1131 ERROR_CASE(ILLEGAL_ARGUMENT);
1132 ERROR_CASE(NATIVE_METHOD);
1133 ERROR_CASE(CLASS_LOADER_UNSUPPORTED);
1134 ERROR_CASE(OUT_OF_MEMORY);
1135 ERROR_CASE(ACCESS_DENIED);
1136 ERROR_CASE(WRONG_PHASE);
1137 ERROR_CASE(INTERNAL);
1138 ERROR_CASE(UNATTACHED_THREAD);
1139 ERROR_CASE(INVALID_ENVIRONMENT);
1140#undef ERROR_CASE
1141 default: {
Alex Light41960712017-01-06 14:44:23 -08001142 jvmtiError res = CopyString(env,
1143 "JVMTI_ERROR_UNKNOWN",
1144 reinterpret_cast<unsigned char**>(name_ptr));
1145 if (res != OK) {
1146 *name_ptr = nullptr;
1147 return res;
1148 } else {
1149 return ERR(ILLEGAL_ARGUMENT);
1150 }
Alex Light49948e92016-08-11 15:35:28 -07001151 }
1152 }
1153 }
1154
1155 static jvmtiError SetVerboseFlag(jvmtiEnv* env, jvmtiVerboseFlag flag, jboolean value) {
1156 return ERR(NOT_IMPLEMENTED);
1157 }
1158
1159 static jvmtiError GetJLocationFormat(jvmtiEnv* env, jvmtiJlocationFormat* format_ptr) {
1160 return ERR(NOT_IMPLEMENTED);
1161 }
Alex Light9c20a142016-08-23 15:05:12 -07001162
1163 // TODO Remove this once events are working.
1164 static jvmtiError RetransformClassWithHook(jvmtiEnv* env,
1165 jclass klass,
1166 jvmtiEventClassFileLoadHook hook) {
1167 std::vector<jclass> classes;
1168 classes.push_back(klass);
1169 return RetransformClassesWithHook(reinterpret_cast<ArtJvmTiEnv*>(env), classes, hook);
1170 }
1171
Alex Light1e07ca62016-12-02 11:40:56 -08001172 static jvmtiError RedefineClassDirect(ArtJvmTiEnv* env,
1173 jclass klass,
1174 jint dex_size,
1175 unsigned char* dex_file) {
1176 if (!IsValidEnv(env)) {
1177 return ERR(INVALID_ENVIRONMENT);
1178 }
1179 jvmtiError ret = OK;
1180 std::string location;
1181 if ((ret = GetClassLocation(env, klass, &location)) != OK) {
1182 // TODO Do something more here? Maybe give log statements?
1183 return ret;
1184 }
1185 std::string error;
1186 ret = Redefiner::RedefineClass(env,
1187 art::Runtime::Current(),
1188 art::Thread::Current(),
1189 klass,
1190 location,
1191 dex_size,
1192 reinterpret_cast<uint8_t*>(dex_file),
1193 &error);
1194 if (ret != OK) {
Alex Light460d1b42017-01-10 15:37:17 +00001195 LOG(WARNING) << "FAILURE TO REDEFINE " << error;
Alex Light1e07ca62016-12-02 11:40:56 -08001196 }
1197 return ret;
1198 }
1199
Alex Light9c20a142016-08-23 15:05:12 -07001200 // TODO This will be called by the event handler for the art::ti Event Load Event
1201 static jvmtiError RetransformClassesWithHook(ArtJvmTiEnv* env,
1202 const std::vector<jclass>& classes,
1203 jvmtiEventClassFileLoadHook hook) {
1204 if (!IsValidEnv(env)) {
1205 return ERR(INVALID_ENVIRONMENT);
1206 }
Alex Lighta01de592016-11-15 10:43:06 -08001207 jvmtiError res = OK;
1208 std::string error;
Alex Light9c20a142016-08-23 15:05:12 -07001209 for (jclass klass : classes) {
1210 JNIEnv* jni_env = nullptr;
1211 jobject loader = nullptr;
1212 std::string name;
1213 jobject protection_domain = nullptr;
1214 jint data_len = 0;
1215 unsigned char* dex_data = nullptr;
1216 jvmtiError ret = OK;
1217 std::string location;
1218 if ((ret = GetTransformationData(env,
1219 klass,
1220 /*out*/&location,
1221 /*out*/&jni_env,
1222 /*out*/&loader,
1223 /*out*/&name,
1224 /*out*/&protection_domain,
1225 /*out*/&data_len,
1226 /*out*/&dex_data)) != OK) {
1227 // TODO Do something more here? Maybe give log statements?
1228 return ret;
1229 }
1230 jint new_data_len = 0;
1231 unsigned char* new_dex_data = nullptr;
1232 hook(env,
1233 jni_env,
1234 klass,
1235 loader,
1236 name.c_str(),
1237 protection_domain,
1238 data_len,
1239 dex_data,
1240 /*out*/&new_data_len,
1241 /*out*/&new_dex_data);
1242 // Check if anything actually changed.
1243 if ((new_data_len != 0 || new_dex_data != nullptr) && new_dex_data != dex_data) {
Alex Lighta01de592016-11-15 10:43:06 -08001244 res = Redefiner::RedefineClass(env,
1245 art::Runtime::Current(),
1246 art::Thread::Current(),
1247 klass,
1248 location,
1249 new_data_len,
1250 new_dex_data,
1251 &error);
Alex Light9c20a142016-08-23 15:05:12 -07001252 env->Deallocate(new_dex_data);
1253 }
1254 // Deallocate the old dex data.
1255 env->Deallocate(dex_data);
Alex Lighta01de592016-11-15 10:43:06 -08001256 if (res != OK) {
1257 LOG(ERROR) << "FAILURE TO REDEFINE " << error;
1258 return res;
1259 }
Alex Light9c20a142016-08-23 15:05:12 -07001260 }
1261 return OK;
1262 }
Alex Light49948e92016-08-11 15:35:28 -07001263};
1264
1265static bool IsJvmtiVersion(jint version) {
1266 return version == JVMTI_VERSION_1 ||
1267 version == JVMTI_VERSION_1_0 ||
1268 version == JVMTI_VERSION_1_1 ||
1269 version == JVMTI_VERSION_1_2 ||
1270 version == JVMTI_VERSION;
1271}
1272
1273// Creates a jvmtiEnv and returns it with the art::ti::Env that is associated with it. new_art_ti
1274// is a pointer to the uninitialized memory for an art::ti::Env.
1275static void CreateArtJvmTiEnv(art::JavaVMExt* vm, /*out*/void** new_jvmtiEnv) {
1276 struct ArtJvmTiEnv* env = new ArtJvmTiEnv(vm);
1277 *new_jvmtiEnv = env;
Andreas Gampe77708d92016-10-07 11:48:21 -07001278
1279 gEventHandler.RegisterArtJvmTiEnv(env);
Alex Light49948e92016-08-11 15:35:28 -07001280}
1281
1282// A hook that the runtime uses to allow plugins to handle GetEnv calls. It returns true and
1283// places the return value in 'env' if this library can handle the GetEnv request. Otherwise
1284// returns false and does not modify the 'env' pointer.
1285static jint GetEnvHandler(art::JavaVMExt* vm, /*out*/void** env, jint version) {
1286 if (IsJvmtiVersion(version)) {
1287 CreateArtJvmTiEnv(vm, env);
1288 return JNI_OK;
1289 } else {
1290 printf("version 0x%x is not valid!", version);
1291 return JNI_EVERSION;
1292 }
1293}
1294
1295// The plugin initialization function. This adds the jvmti environment.
1296extern "C" bool ArtPlugin_Initialize() {
Andreas Gampee08a2be2016-10-06 13:13:30 -07001297 art::Runtime* runtime = art::Runtime::Current();
1298 runtime->GetJavaVM()->AddEnvironmentHook(GetEnvHandler);
1299 runtime->AddSystemWeakHolder(&gObjectTagTable);
Alex Light49948e92016-08-11 15:35:28 -07001300 return true;
1301}
1302
1303// The actual struct holding all of the entrypoints into the jvmti interface.
1304const jvmtiInterface_1 gJvmtiInterface = {
Alex Light9c20a142016-08-23 15:05:12 -07001305 // SPECIAL FUNCTION: RetransformClassWithHook Is normally reserved1
1306 // TODO Remove once we have events working.
1307 reinterpret_cast<void*>(JvmtiFunctions::RetransformClassWithHook),
1308 // nullptr, // reserved1
Alex Light49948e92016-08-11 15:35:28 -07001309 JvmtiFunctions::SetEventNotificationMode,
Alex Light1e07ca62016-12-02 11:40:56 -08001310 // SPECIAL FUNCTION: RedefineClassDirect Is normally reserved3
1311 // TODO Remove once we have events working.
1312 reinterpret_cast<void*>(JvmtiFunctions::RedefineClassDirect),
1313 // nullptr, // reserved3
Alex Light49948e92016-08-11 15:35:28 -07001314 JvmtiFunctions::GetAllThreads,
1315 JvmtiFunctions::SuspendThread,
1316 JvmtiFunctions::ResumeThread,
1317 JvmtiFunctions::StopThread,
1318 JvmtiFunctions::InterruptThread,
1319 JvmtiFunctions::GetThreadInfo,
1320 JvmtiFunctions::GetOwnedMonitorInfo, // 10
1321 JvmtiFunctions::GetCurrentContendedMonitor,
1322 JvmtiFunctions::RunAgentThread,
1323 JvmtiFunctions::GetTopThreadGroups,
1324 JvmtiFunctions::GetThreadGroupInfo,
1325 JvmtiFunctions::GetThreadGroupChildren,
1326 JvmtiFunctions::GetFrameCount,
1327 JvmtiFunctions::GetThreadState,
1328 JvmtiFunctions::GetCurrentThread,
1329 JvmtiFunctions::GetFrameLocation,
1330 JvmtiFunctions::NotifyFramePop, // 20
1331 JvmtiFunctions::GetLocalObject,
1332 JvmtiFunctions::GetLocalInt,
1333 JvmtiFunctions::GetLocalLong,
1334 JvmtiFunctions::GetLocalFloat,
1335 JvmtiFunctions::GetLocalDouble,
1336 JvmtiFunctions::SetLocalObject,
1337 JvmtiFunctions::SetLocalInt,
1338 JvmtiFunctions::SetLocalLong,
1339 JvmtiFunctions::SetLocalFloat,
1340 JvmtiFunctions::SetLocalDouble, // 30
1341 JvmtiFunctions::CreateRawMonitor,
1342 JvmtiFunctions::DestroyRawMonitor,
1343 JvmtiFunctions::RawMonitorEnter,
1344 JvmtiFunctions::RawMonitorExit,
1345 JvmtiFunctions::RawMonitorWait,
1346 JvmtiFunctions::RawMonitorNotify,
1347 JvmtiFunctions::RawMonitorNotifyAll,
1348 JvmtiFunctions::SetBreakpoint,
1349 JvmtiFunctions::ClearBreakpoint,
1350 nullptr, // reserved40
1351 JvmtiFunctions::SetFieldAccessWatch,
1352 JvmtiFunctions::ClearFieldAccessWatch,
1353 JvmtiFunctions::SetFieldModificationWatch,
1354 JvmtiFunctions::ClearFieldModificationWatch,
1355 JvmtiFunctions::IsModifiableClass,
1356 JvmtiFunctions::Allocate,
1357 JvmtiFunctions::Deallocate,
1358 JvmtiFunctions::GetClassSignature,
1359 JvmtiFunctions::GetClassStatus,
1360 JvmtiFunctions::GetSourceFileName, // 50
1361 JvmtiFunctions::GetClassModifiers,
1362 JvmtiFunctions::GetClassMethods,
1363 JvmtiFunctions::GetClassFields,
1364 JvmtiFunctions::GetImplementedInterfaces,
1365 JvmtiFunctions::IsInterface,
1366 JvmtiFunctions::IsArrayClass,
1367 JvmtiFunctions::GetClassLoader,
1368 JvmtiFunctions::GetObjectHashCode,
1369 JvmtiFunctions::GetObjectMonitorUsage,
1370 JvmtiFunctions::GetFieldName, // 60
1371 JvmtiFunctions::GetFieldDeclaringClass,
1372 JvmtiFunctions::GetFieldModifiers,
1373 JvmtiFunctions::IsFieldSynthetic,
1374 JvmtiFunctions::GetMethodName,
1375 JvmtiFunctions::GetMethodDeclaringClass,
1376 JvmtiFunctions::GetMethodModifiers,
1377 nullptr, // reserved67
1378 JvmtiFunctions::GetMaxLocals,
1379 JvmtiFunctions::GetArgumentsSize,
1380 JvmtiFunctions::GetLineNumberTable, // 70
1381 JvmtiFunctions::GetMethodLocation,
1382 JvmtiFunctions::GetLocalVariableTable,
1383 JvmtiFunctions::SetNativeMethodPrefix,
1384 JvmtiFunctions::SetNativeMethodPrefixes,
1385 JvmtiFunctions::GetBytecodes,
1386 JvmtiFunctions::IsMethodNative,
1387 JvmtiFunctions::IsMethodSynthetic,
1388 JvmtiFunctions::GetLoadedClasses,
1389 JvmtiFunctions::GetClassLoaderClasses,
1390 JvmtiFunctions::PopFrame, // 80
1391 JvmtiFunctions::ForceEarlyReturnObject,
1392 JvmtiFunctions::ForceEarlyReturnInt,
1393 JvmtiFunctions::ForceEarlyReturnLong,
1394 JvmtiFunctions::ForceEarlyReturnFloat,
1395 JvmtiFunctions::ForceEarlyReturnDouble,
1396 JvmtiFunctions::ForceEarlyReturnVoid,
1397 JvmtiFunctions::RedefineClasses,
1398 JvmtiFunctions::GetVersionNumber,
1399 JvmtiFunctions::GetCapabilities,
1400 JvmtiFunctions::GetSourceDebugExtension, // 90
1401 JvmtiFunctions::IsMethodObsolete,
1402 JvmtiFunctions::SuspendThreadList,
1403 JvmtiFunctions::ResumeThreadList,
1404 nullptr, // reserved94
1405 nullptr, // reserved95
1406 nullptr, // reserved96
1407 nullptr, // reserved97
1408 nullptr, // reserved98
1409 nullptr, // reserved99
1410 JvmtiFunctions::GetAllStackTraces, // 100
1411 JvmtiFunctions::GetThreadListStackTraces,
1412 JvmtiFunctions::GetThreadLocalStorage,
1413 JvmtiFunctions::SetThreadLocalStorage,
1414 JvmtiFunctions::GetStackTrace,
1415 nullptr, // reserved105
1416 JvmtiFunctions::GetTag,
1417 JvmtiFunctions::SetTag,
1418 JvmtiFunctions::ForceGarbageCollection,
1419 JvmtiFunctions::IterateOverObjectsReachableFromObject,
1420 JvmtiFunctions::IterateOverReachableObjects, // 110
1421 JvmtiFunctions::IterateOverHeap,
1422 JvmtiFunctions::IterateOverInstancesOfClass,
1423 nullptr, // reserved113
1424 JvmtiFunctions::GetObjectsWithTags,
1425 JvmtiFunctions::FollowReferences,
1426 JvmtiFunctions::IterateThroughHeap,
1427 nullptr, // reserved117
1428 nullptr, // reserved118
1429 nullptr, // reserved119
1430 JvmtiFunctions::SetJNIFunctionTable, // 120
1431 JvmtiFunctions::GetJNIFunctionTable,
1432 JvmtiFunctions::SetEventCallbacks,
1433 JvmtiFunctions::GenerateEvents,
1434 JvmtiFunctions::GetExtensionFunctions,
1435 JvmtiFunctions::GetExtensionEvents,
1436 JvmtiFunctions::SetExtensionEventCallback,
1437 JvmtiFunctions::DisposeEnvironment,
1438 JvmtiFunctions::GetErrorName,
1439 JvmtiFunctions::GetJLocationFormat,
1440 JvmtiFunctions::GetSystemProperties, // 130
1441 JvmtiFunctions::GetSystemProperty,
1442 JvmtiFunctions::SetSystemProperty,
1443 JvmtiFunctions::GetPhase,
1444 JvmtiFunctions::GetCurrentThreadCpuTimerInfo,
1445 JvmtiFunctions::GetCurrentThreadCpuTime,
1446 JvmtiFunctions::GetThreadCpuTimerInfo,
1447 JvmtiFunctions::GetThreadCpuTime,
1448 JvmtiFunctions::GetTimerInfo,
1449 JvmtiFunctions::GetTime,
1450 JvmtiFunctions::GetPotentialCapabilities, // 140
1451 nullptr, // reserved141
1452 JvmtiFunctions::AddCapabilities,
1453 JvmtiFunctions::RelinquishCapabilities,
1454 JvmtiFunctions::GetAvailableProcessors,
1455 JvmtiFunctions::GetClassVersionNumbers,
1456 JvmtiFunctions::GetConstantPool,
1457 JvmtiFunctions::GetEnvironmentLocalStorage,
1458 JvmtiFunctions::SetEnvironmentLocalStorage,
1459 JvmtiFunctions::AddToBootstrapClassLoaderSearch,
1460 JvmtiFunctions::SetVerboseFlag, // 150
1461 JvmtiFunctions::AddToSystemClassLoaderSearch,
1462 JvmtiFunctions::RetransformClasses,
1463 JvmtiFunctions::GetOwnedMonitorStackDepthInfo,
1464 JvmtiFunctions::GetObjectSize,
1465 JvmtiFunctions::GetLocalInstance,
1466};
1467
1468}; // namespace openjdkjvmti