Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1 | /* 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 Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 32 | #include <string> |
Andreas Gampe | f37e302 | 2017-01-13 17:54:46 -0800 | [diff] [blame] | 33 | #include <type_traits> |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 34 | #include <vector> |
| 35 | |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 36 | #include <jni.h> |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 37 | |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 38 | #include "openjdkjvmti/jvmti.h" |
| 39 | |
Andreas Gampe | db6dcb6 | 2016-09-13 09:05:59 -0700 | [diff] [blame] | 40 | #include "art_jvmti.h" |
Andreas Gampe | f37e302 | 2017-01-13 17:54:46 -0800 | [diff] [blame] | 41 | #include "base/logging.h" |
Andreas Gampe | 77708d9 | 2016-10-07 11:48:21 -0700 | [diff] [blame] | 42 | #include "base/mutex.h" |
| 43 | #include "events-inl.h" |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 44 | #include "jni_env_ext-inl.h" |
Andreas Gampe | 6dee92e | 2016-09-12 19:58:13 -0700 | [diff] [blame] | 45 | #include "obj_ptr-inl.h" |
Alex Light | a01de59 | 2016-11-15 10:43:06 -0800 | [diff] [blame] | 46 | #include "object_tagging.h" |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 47 | #include "runtime.h" |
Andreas Gampe | 6dee92e | 2016-09-12 19:58:13 -0700 | [diff] [blame] | 48 | #include "scoped_thread_state_change-inl.h" |
Andreas Gampe | 77708d9 | 2016-10-07 11:48:21 -0700 | [diff] [blame] | 49 | #include "thread-inl.h" |
Alex Light | a01de59 | 2016-11-15 10:43:06 -0800 | [diff] [blame] | 50 | #include "thread_list.h" |
Andreas Gampe | e492ae3 | 2016-10-28 19:34:57 -0700 | [diff] [blame] | 51 | #include "ti_class.h" |
Andreas Gampe | ab2f0d0 | 2017-01-05 17:23:45 -0800 | [diff] [blame] | 52 | #include "ti_field.h" |
Andreas Gampe | ba8df69 | 2016-11-01 10:30:44 -0700 | [diff] [blame] | 53 | #include "ti_heap.h" |
Andreas Gampe | 3c252f0 | 2016-10-27 18:25:17 -0700 | [diff] [blame] | 54 | #include "ti_method.h" |
Andreas Gampe | 319dbe8 | 2017-01-09 16:42:21 -0800 | [diff] [blame] | 55 | #include "ti_monitor.h" |
Andreas Gampe | 50a4e49 | 2017-01-06 18:00:20 -0800 | [diff] [blame] | 56 | #include "ti_object.h" |
Andreas Gampe | 1bdaf73 | 2017-01-09 19:21:06 -0800 | [diff] [blame] | 57 | #include "ti_properties.h" |
Alex Light | a01de59 | 2016-11-15 10:43:06 -0800 | [diff] [blame] | 58 | #include "ti_redefine.h" |
Andreas Gampe | b5eb94a | 2016-10-27 19:23:09 -0700 | [diff] [blame] | 59 | #include "ti_stack.h" |
Andreas Gampe | af13ab9 | 2017-01-11 20:57:40 -0800 | [diff] [blame] | 60 | #include "ti_thread.h" |
Andreas Gampe | 35bcf81 | 2017-01-13 16:24:17 -0800 | [diff] [blame^] | 61 | #include "ti_timers.h" |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 62 | #include "transform.h" |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 63 | |
| 64 | // TODO Remove this at some point by annotating all the methods. It was put in to make the skeleton |
| 65 | // easier to create. |
| 66 | #pragma GCC diagnostic ignored "-Wunused-parameter" |
| 67 | |
| 68 | namespace openjdkjvmti { |
| 69 | |
Andreas Gampe | 77708d9 | 2016-10-07 11:48:21 -0700 | [diff] [blame] | 70 | EventHandler gEventHandler; |
Andreas Gampe | cc13b22 | 2016-10-10 19:09:09 -0700 | [diff] [blame] | 71 | ObjectTagTable gObjectTagTable(&gEventHandler); |
Andreas Gampe | 6dee92e | 2016-09-12 19:58:13 -0700 | [diff] [blame] | 72 | |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 73 | #define ENSURE_NON_NULL(n) \ |
| 74 | do { \ |
| 75 | if ((n) == nullptr) { \ |
| 76 | return ERR(NULL_POINTER); \ |
| 77 | } \ |
| 78 | } while (false) |
| 79 | |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 80 | class JvmtiFunctions { |
| 81 | private: |
| 82 | static bool IsValidEnv(jvmtiEnv* env) { |
| 83 | return env != nullptr; |
| 84 | } |
| 85 | |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 86 | #define ENSURE_VALID_ENV(env) \ |
| 87 | do { \ |
| 88 | if (!IsValidEnv(env)) { \ |
| 89 | return ERR(INVALID_ENVIRONMENT); \ |
| 90 | } \ |
| 91 | } while (false) |
| 92 | |
| 93 | #define ENSURE_HAS_CAP(env, cap) \ |
| 94 | do { \ |
| 95 | ENSURE_VALID_ENV(env); \ |
| 96 | if (ArtJvmTiEnv::AsArtJvmTiEnv(env)->capabilities.cap != 1) { \ |
| 97 | return ERR(MUST_POSSESS_CAPABILITY); \ |
| 98 | } \ |
| 99 | } while (false) |
| 100 | |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 101 | public: |
| 102 | static jvmtiError Allocate(jvmtiEnv* env, jlong size, unsigned char** mem_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 103 | ENSURE_VALID_ENV(env); |
| 104 | ENSURE_NON_NULL(mem_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 105 | if (size < 0) { |
| 106 | return ERR(ILLEGAL_ARGUMENT); |
| 107 | } else if (size == 0) { |
| 108 | *mem_ptr = nullptr; |
| 109 | return OK; |
| 110 | } |
| 111 | *mem_ptr = static_cast<unsigned char*>(malloc(size)); |
| 112 | return (*mem_ptr != nullptr) ? OK : ERR(OUT_OF_MEMORY); |
| 113 | } |
| 114 | |
| 115 | static jvmtiError Deallocate(jvmtiEnv* env, unsigned char* mem) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 116 | ENSURE_VALID_ENV(env); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 117 | if (mem != nullptr) { |
| 118 | free(mem); |
| 119 | } |
| 120 | return OK; |
| 121 | } |
| 122 | |
| 123 | static jvmtiError GetThreadState(jvmtiEnv* env, jthread thread, jint* thread_state_ptr) { |
Andreas Gampe | 72c1983 | 2017-01-12 13:22:16 -0800 | [diff] [blame] | 124 | return ThreadUtil::GetThreadState(env, thread, thread_state_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | static jvmtiError GetCurrentThread(jvmtiEnv* env, jthread* thread_ptr) { |
Andreas Gampe | af13ab9 | 2017-01-11 20:57:40 -0800 | [diff] [blame] | 128 | return ThreadUtil::GetCurrentThread(env, thread_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 129 | } |
| 130 | |
| 131 | static jvmtiError GetAllThreads(jvmtiEnv* env, jint* threads_count_ptr, jthread** threads_ptr) { |
Andreas Gampe | 8580744 | 2017-01-13 14:40:58 -0800 | [diff] [blame] | 132 | return ThreadUtil::GetAllThreads(env, threads_count_ptr, threads_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 133 | } |
| 134 | |
| 135 | static jvmtiError SuspendThread(jvmtiEnv* env, jthread thread) { |
| 136 | return ERR(NOT_IMPLEMENTED); |
| 137 | } |
| 138 | |
| 139 | static jvmtiError SuspendThreadList(jvmtiEnv* env, |
| 140 | jint request_count, |
| 141 | const jthread* request_list, |
| 142 | jvmtiError* results) { |
| 143 | return ERR(NOT_IMPLEMENTED); |
| 144 | } |
| 145 | |
| 146 | static jvmtiError ResumeThread(jvmtiEnv* env, jthread thread) { |
| 147 | return ERR(NOT_IMPLEMENTED); |
| 148 | } |
| 149 | |
| 150 | static jvmtiError ResumeThreadList(jvmtiEnv* env, |
| 151 | jint request_count, |
| 152 | const jthread* request_list, |
| 153 | jvmtiError* results) { |
| 154 | return ERR(NOT_IMPLEMENTED); |
| 155 | } |
| 156 | |
| 157 | static jvmtiError StopThread(jvmtiEnv* env, jthread thread, jobject exception) { |
| 158 | return ERR(NOT_IMPLEMENTED); |
| 159 | } |
| 160 | |
| 161 | static jvmtiError InterruptThread(jvmtiEnv* env, jthread thread) { |
| 162 | return ERR(NOT_IMPLEMENTED); |
| 163 | } |
| 164 | |
| 165 | static jvmtiError GetThreadInfo(jvmtiEnv* env, jthread thread, jvmtiThreadInfo* info_ptr) { |
Andreas Gampe | af13ab9 | 2017-01-11 20:57:40 -0800 | [diff] [blame] | 166 | return ThreadUtil::GetThreadInfo(env, thread, info_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | static jvmtiError GetOwnedMonitorInfo(jvmtiEnv* env, |
| 170 | jthread thread, |
| 171 | jint* owned_monitor_count_ptr, |
| 172 | jobject** owned_monitors_ptr) { |
| 173 | return ERR(NOT_IMPLEMENTED); |
| 174 | } |
| 175 | |
| 176 | static jvmtiError GetOwnedMonitorStackDepthInfo(jvmtiEnv* env, |
| 177 | jthread thread, |
| 178 | jint* monitor_info_count_ptr, |
| 179 | jvmtiMonitorStackDepthInfo** monitor_info_ptr) { |
| 180 | return ERR(NOT_IMPLEMENTED); |
| 181 | } |
| 182 | |
| 183 | static jvmtiError GetCurrentContendedMonitor(jvmtiEnv* env, |
| 184 | jthread thread, |
| 185 | jobject* monitor_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 186 | return ERR(NOT_IMPLEMENTED); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 187 | } |
| 188 | |
| 189 | static jvmtiError RunAgentThread(jvmtiEnv* env, |
| 190 | jthread thread, |
| 191 | jvmtiStartFunction proc, |
| 192 | const void* arg, |
| 193 | jint priority) { |
| 194 | return ERR(NOT_IMPLEMENTED); |
| 195 | } |
| 196 | |
| 197 | static jvmtiError SetThreadLocalStorage(jvmtiEnv* env, jthread thread, const void* data) { |
| 198 | return ERR(NOT_IMPLEMENTED); |
| 199 | } |
| 200 | |
| 201 | static jvmtiError GetThreadLocalStorage(jvmtiEnv* env, jthread thread, void** data_ptr) { |
| 202 | return ERR(NOT_IMPLEMENTED); |
| 203 | } |
| 204 | |
| 205 | static jvmtiError GetTopThreadGroups(jvmtiEnv* env, |
| 206 | jint* group_count_ptr, |
| 207 | jthreadGroup** groups_ptr) { |
Nicolas Geoffray | 87071bf | 2017-01-16 10:27:16 +0000 | [diff] [blame] | 208 | return ERR(NOT_IMPLEMENTED); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 209 | } |
| 210 | |
| 211 | static jvmtiError GetThreadGroupInfo(jvmtiEnv* env, |
| 212 | jthreadGroup group, |
| 213 | jvmtiThreadGroupInfo* info_ptr) { |
Nicolas Geoffray | 87071bf | 2017-01-16 10:27:16 +0000 | [diff] [blame] | 214 | return ERR(NOT_IMPLEMENTED); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 215 | } |
| 216 | |
| 217 | static jvmtiError GetThreadGroupChildren(jvmtiEnv* env, |
| 218 | jthreadGroup group, |
| 219 | jint* thread_count_ptr, |
| 220 | jthread** threads_ptr, |
| 221 | jint* group_count_ptr, |
| 222 | jthreadGroup** groups_ptr) { |
Nicolas Geoffray | 87071bf | 2017-01-16 10:27:16 +0000 | [diff] [blame] | 223 | return ERR(NOT_IMPLEMENTED); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 224 | } |
| 225 | |
| 226 | static jvmtiError GetStackTrace(jvmtiEnv* env, |
| 227 | jthread thread, |
| 228 | jint start_depth, |
| 229 | jint max_frame_count, |
| 230 | jvmtiFrameInfo* frame_buffer, |
| 231 | jint* count_ptr) { |
Andreas Gampe | b5eb94a | 2016-10-27 19:23:09 -0700 | [diff] [blame] | 232 | return StackUtil::GetStackTrace(env, |
| 233 | thread, |
| 234 | start_depth, |
| 235 | max_frame_count, |
| 236 | frame_buffer, |
| 237 | count_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | static jvmtiError GetAllStackTraces(jvmtiEnv* env, |
| 241 | jint max_frame_count, |
| 242 | jvmtiStackInfo** stack_info_ptr, |
| 243 | jint* thread_count_ptr) { |
Andreas Gampe | a1a27c6 | 2017-01-11 16:37:16 -0800 | [diff] [blame] | 244 | return StackUtil::GetAllStackTraces(env, max_frame_count, stack_info_ptr, thread_count_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | static jvmtiError GetThreadListStackTraces(jvmtiEnv* env, |
| 248 | jint thread_count, |
| 249 | const jthread* thread_list, |
| 250 | jint max_frame_count, |
| 251 | jvmtiStackInfo** stack_info_ptr) { |
Andreas Gampe | eba32fb | 2017-01-12 17:40:05 -0800 | [diff] [blame] | 252 | return StackUtil::GetThreadListStackTraces(env, |
| 253 | thread_count, |
| 254 | thread_list, |
| 255 | max_frame_count, |
| 256 | stack_info_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | static jvmtiError GetFrameCount(jvmtiEnv* env, jthread thread, jint* count_ptr) { |
Andreas Gampe | f6f3b5f | 2017-01-13 09:21:42 -0800 | [diff] [blame] | 260 | return StackUtil::GetFrameCount(env, thread, count_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | static jvmtiError PopFrame(jvmtiEnv* env, jthread thread) { |
| 264 | return ERR(NOT_IMPLEMENTED); |
| 265 | } |
| 266 | |
| 267 | static jvmtiError GetFrameLocation(jvmtiEnv* env, |
| 268 | jthread thread, |
| 269 | jint depth, |
| 270 | jmethodID* method_ptr, |
| 271 | jlocation* location_ptr) { |
Andreas Gampe | f6f3b5f | 2017-01-13 09:21:42 -0800 | [diff] [blame] | 272 | return StackUtil::GetFrameLocation(env, thread, depth, method_ptr, location_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 273 | } |
| 274 | |
| 275 | static jvmtiError NotifyFramePop(jvmtiEnv* env, jthread thread, jint depth) { |
| 276 | return ERR(NOT_IMPLEMENTED); |
| 277 | } |
| 278 | |
| 279 | static jvmtiError ForceEarlyReturnObject(jvmtiEnv* env, jthread thread, jobject value) { |
| 280 | return ERR(NOT_IMPLEMENTED); |
| 281 | } |
| 282 | |
| 283 | static jvmtiError ForceEarlyReturnInt(jvmtiEnv* env, jthread thread, jint value) { |
| 284 | return ERR(NOT_IMPLEMENTED); |
| 285 | } |
| 286 | |
| 287 | static jvmtiError ForceEarlyReturnLong(jvmtiEnv* env, jthread thread, jlong value) { |
| 288 | return ERR(NOT_IMPLEMENTED); |
| 289 | } |
| 290 | |
| 291 | static jvmtiError ForceEarlyReturnFloat(jvmtiEnv* env, jthread thread, jfloat value) { |
| 292 | return ERR(NOT_IMPLEMENTED); |
| 293 | } |
| 294 | |
| 295 | static jvmtiError ForceEarlyReturnDouble(jvmtiEnv* env, jthread thread, jdouble value) { |
| 296 | return ERR(NOT_IMPLEMENTED); |
| 297 | } |
| 298 | |
| 299 | static jvmtiError ForceEarlyReturnVoid(jvmtiEnv* env, jthread thread) { |
| 300 | return ERR(NOT_IMPLEMENTED); |
| 301 | } |
| 302 | |
| 303 | static jvmtiError FollowReferences(jvmtiEnv* env, |
| 304 | jint heap_filter, |
| 305 | jclass klass, |
| 306 | jobject initial_object, |
| 307 | const jvmtiHeapCallbacks* callbacks, |
| 308 | const void* user_data) { |
Andreas Gampe | 70bfc8a | 2016-11-03 11:04:15 -0700 | [diff] [blame] | 309 | HeapUtil heap_util(&gObjectTagTable); |
| 310 | return heap_util.FollowReferences(env, |
| 311 | heap_filter, |
| 312 | klass, |
| 313 | initial_object, |
| 314 | callbacks, |
| 315 | user_data); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 316 | } |
| 317 | |
| 318 | static jvmtiError IterateThroughHeap(jvmtiEnv* env, |
| 319 | jint heap_filter, |
| 320 | jclass klass, |
| 321 | const jvmtiHeapCallbacks* callbacks, |
| 322 | const void* user_data) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 323 | ENSURE_HAS_CAP(env, can_tag_objects); |
Andreas Gampe | e54d992 | 2016-10-11 19:55:37 -0700 | [diff] [blame] | 324 | HeapUtil heap_util(&gObjectTagTable); |
| 325 | return heap_util.IterateThroughHeap(env, heap_filter, klass, callbacks, user_data); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 326 | } |
| 327 | |
| 328 | static jvmtiError GetTag(jvmtiEnv* env, jobject object, jlong* tag_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 329 | ENSURE_HAS_CAP(env, can_tag_objects); |
Andreas Gampe | 6dee92e | 2016-09-12 19:58:13 -0700 | [diff] [blame] | 330 | |
| 331 | JNIEnv* jni_env = GetJniEnv(env); |
| 332 | if (jni_env == nullptr) { |
| 333 | return ERR(INTERNAL); |
| 334 | } |
| 335 | |
| 336 | art::ScopedObjectAccess soa(jni_env); |
| 337 | art::ObjPtr<art::mirror::Object> obj = soa.Decode<art::mirror::Object>(object); |
| 338 | if (!gObjectTagTable.GetTag(obj.Ptr(), tag_ptr)) { |
| 339 | *tag_ptr = 0; |
| 340 | } |
| 341 | |
| 342 | return ERR(NONE); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 343 | } |
| 344 | |
| 345 | static jvmtiError SetTag(jvmtiEnv* env, jobject object, jlong tag) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 346 | ENSURE_HAS_CAP(env, can_tag_objects); |
| 347 | |
Andreas Gampe | 6dee92e | 2016-09-12 19:58:13 -0700 | [diff] [blame] | 348 | if (object == nullptr) { |
| 349 | return ERR(NULL_POINTER); |
| 350 | } |
| 351 | |
| 352 | JNIEnv* jni_env = GetJniEnv(env); |
| 353 | if (jni_env == nullptr) { |
| 354 | return ERR(INTERNAL); |
| 355 | } |
| 356 | |
| 357 | art::ScopedObjectAccess soa(jni_env); |
| 358 | art::ObjPtr<art::mirror::Object> obj = soa.Decode<art::mirror::Object>(object); |
Andreas Gampe | e54eee1 | 2016-10-20 19:03:58 -0700 | [diff] [blame] | 359 | gObjectTagTable.Set(obj.Ptr(), tag); |
Andreas Gampe | 6dee92e | 2016-09-12 19:58:13 -0700 | [diff] [blame] | 360 | |
| 361 | return ERR(NONE); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 362 | } |
| 363 | |
| 364 | static jvmtiError GetObjectsWithTags(jvmtiEnv* env, |
| 365 | jint tag_count, |
| 366 | const jlong* tags, |
| 367 | jint* count_ptr, |
| 368 | jobject** object_result_ptr, |
| 369 | jlong** tag_result_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 370 | ENSURE_HAS_CAP(env, can_tag_objects); |
| 371 | |
Andreas Gampe | 5e6046b | 2016-10-25 12:05:53 -0700 | [diff] [blame] | 372 | JNIEnv* jni_env = GetJniEnv(env); |
| 373 | if (jni_env == nullptr) { |
| 374 | return ERR(INTERNAL); |
| 375 | } |
| 376 | |
| 377 | art::ScopedObjectAccess soa(jni_env); |
| 378 | return gObjectTagTable.GetTaggedObjects(env, |
| 379 | tag_count, |
| 380 | tags, |
| 381 | count_ptr, |
| 382 | object_result_ptr, |
| 383 | tag_result_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 384 | } |
| 385 | |
| 386 | static jvmtiError ForceGarbageCollection(jvmtiEnv* env) { |
Andreas Gampe | 8da6d03 | 2016-10-31 19:31:03 -0700 | [diff] [blame] | 387 | return HeapUtil::ForceGarbageCollection(env); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 388 | } |
| 389 | |
| 390 | static jvmtiError IterateOverObjectsReachableFromObject( |
| 391 | jvmtiEnv* env, |
| 392 | jobject object, |
| 393 | jvmtiObjectReferenceCallback object_reference_callback, |
| 394 | const void* user_data) { |
| 395 | return ERR(NOT_IMPLEMENTED); |
| 396 | } |
| 397 | |
| 398 | static jvmtiError IterateOverReachableObjects(jvmtiEnv* env, |
| 399 | jvmtiHeapRootCallback heap_root_callback, |
| 400 | jvmtiStackReferenceCallback stack_ref_callback, |
| 401 | jvmtiObjectReferenceCallback object_ref_callback, |
| 402 | const void* user_data) { |
| 403 | return ERR(NOT_IMPLEMENTED); |
| 404 | } |
| 405 | |
| 406 | static jvmtiError IterateOverHeap(jvmtiEnv* env, |
| 407 | jvmtiHeapObjectFilter object_filter, |
| 408 | jvmtiHeapObjectCallback heap_object_callback, |
| 409 | const void* user_data) { |
| 410 | return ERR(NOT_IMPLEMENTED); |
| 411 | } |
| 412 | |
| 413 | static jvmtiError IterateOverInstancesOfClass(jvmtiEnv* env, |
| 414 | jclass klass, |
| 415 | jvmtiHeapObjectFilter object_filter, |
| 416 | jvmtiHeapObjectCallback heap_object_callback, |
| 417 | const void* user_data) { |
| 418 | return ERR(NOT_IMPLEMENTED); |
| 419 | } |
| 420 | |
| 421 | static jvmtiError GetLocalObject(jvmtiEnv* env, |
| 422 | jthread thread, |
| 423 | jint depth, |
| 424 | jint slot, |
| 425 | jobject* value_ptr) { |
| 426 | return ERR(NOT_IMPLEMENTED); |
| 427 | } |
| 428 | |
| 429 | static jvmtiError GetLocalInstance(jvmtiEnv* env, |
| 430 | jthread thread, |
| 431 | jint depth, |
| 432 | jobject* value_ptr) { |
| 433 | return ERR(NOT_IMPLEMENTED); |
| 434 | } |
| 435 | |
| 436 | static jvmtiError GetLocalInt(jvmtiEnv* env, |
| 437 | jthread thread, |
| 438 | jint depth, |
| 439 | jint slot, |
| 440 | jint* value_ptr) { |
| 441 | return ERR(NOT_IMPLEMENTED); |
| 442 | } |
| 443 | |
| 444 | static jvmtiError GetLocalLong(jvmtiEnv* env, |
| 445 | jthread thread, |
| 446 | jint depth, |
| 447 | jint slot, |
| 448 | jlong* value_ptr) { |
| 449 | return ERR(NOT_IMPLEMENTED); |
| 450 | } |
| 451 | |
| 452 | static jvmtiError GetLocalFloat(jvmtiEnv* env, |
| 453 | jthread thread, |
| 454 | jint depth, |
| 455 | jint slot, |
| 456 | jfloat* value_ptr) { |
| 457 | return ERR(NOT_IMPLEMENTED); |
| 458 | } |
| 459 | |
| 460 | static jvmtiError GetLocalDouble(jvmtiEnv* env, |
| 461 | jthread thread, |
| 462 | jint depth, |
| 463 | jint slot, |
| 464 | jdouble* value_ptr) { |
| 465 | return ERR(NOT_IMPLEMENTED); |
| 466 | } |
| 467 | |
| 468 | static jvmtiError SetLocalObject(jvmtiEnv* env, |
| 469 | jthread thread, |
| 470 | jint depth, |
| 471 | jint slot, |
| 472 | jobject value) { |
| 473 | return ERR(NOT_IMPLEMENTED); |
| 474 | } |
| 475 | |
| 476 | static jvmtiError SetLocalInt(jvmtiEnv* env, |
| 477 | jthread thread, |
| 478 | jint depth, |
| 479 | jint slot, |
| 480 | jint value) { |
| 481 | return ERR(NOT_IMPLEMENTED); |
| 482 | } |
| 483 | |
| 484 | static jvmtiError SetLocalLong(jvmtiEnv* env, |
| 485 | jthread thread, |
| 486 | jint depth, |
| 487 | jint slot, |
| 488 | jlong value) { |
| 489 | return ERR(NOT_IMPLEMENTED); |
| 490 | } |
| 491 | |
| 492 | static jvmtiError SetLocalFloat(jvmtiEnv* env, |
| 493 | jthread thread, |
| 494 | jint depth, |
| 495 | jint slot, |
| 496 | jfloat value) { |
| 497 | return ERR(NOT_IMPLEMENTED); |
| 498 | } |
| 499 | |
| 500 | static jvmtiError SetLocalDouble(jvmtiEnv* env, |
| 501 | jthread thread, |
| 502 | jint depth, |
| 503 | jint slot, |
| 504 | jdouble value) { |
| 505 | return ERR(NOT_IMPLEMENTED); |
| 506 | } |
| 507 | |
| 508 | static jvmtiError SetBreakpoint(jvmtiEnv* env, jmethodID method, jlocation location) { |
| 509 | return ERR(NOT_IMPLEMENTED); |
| 510 | } |
| 511 | |
| 512 | static jvmtiError ClearBreakpoint(jvmtiEnv* env, jmethodID method, jlocation location) { |
| 513 | return ERR(NOT_IMPLEMENTED); |
| 514 | } |
| 515 | |
| 516 | static jvmtiError SetFieldAccessWatch(jvmtiEnv* env, jclass klass, jfieldID field) { |
| 517 | return ERR(NOT_IMPLEMENTED); |
| 518 | } |
| 519 | |
| 520 | static jvmtiError ClearFieldAccessWatch(jvmtiEnv* env, jclass klass, jfieldID field) { |
| 521 | return ERR(NOT_IMPLEMENTED); |
| 522 | } |
| 523 | |
| 524 | static jvmtiError SetFieldModificationWatch(jvmtiEnv* env, jclass klass, jfieldID field) { |
| 525 | return ERR(NOT_IMPLEMENTED); |
| 526 | } |
| 527 | |
| 528 | static jvmtiError ClearFieldModificationWatch(jvmtiEnv* env, jclass klass, jfieldID field) { |
| 529 | return ERR(NOT_IMPLEMENTED); |
| 530 | } |
| 531 | |
| 532 | static jvmtiError GetLoadedClasses(jvmtiEnv* env, jint* class_count_ptr, jclass** classes_ptr) { |
Andreas Gampe | aa8b60c | 2016-10-12 12:51:25 -0700 | [diff] [blame] | 533 | HeapUtil heap_util(&gObjectTagTable); |
| 534 | return heap_util.GetLoadedClasses(env, class_count_ptr, classes_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 535 | } |
| 536 | |
| 537 | static jvmtiError GetClassLoaderClasses(jvmtiEnv* env, |
| 538 | jobject initiating_loader, |
| 539 | jint* class_count_ptr, |
| 540 | jclass** classes_ptr) { |
Andreas Gampe | 70f1639 | 2017-01-16 14:20:10 -0800 | [diff] [blame] | 541 | return ClassUtil::GetClassLoaderClasses(env, initiating_loader, class_count_ptr, classes_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 542 | } |
| 543 | |
| 544 | static jvmtiError GetClassSignature(jvmtiEnv* env, |
| 545 | jclass klass, |
| 546 | char** signature_ptr, |
| 547 | char** generic_ptr) { |
Andreas Gampe | e492ae3 | 2016-10-28 19:34:57 -0700 | [diff] [blame] | 548 | return ClassUtil::GetClassSignature(env, klass, signature_ptr, generic_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 549 | } |
| 550 | |
| 551 | static jvmtiError GetClassStatus(jvmtiEnv* env, jclass klass, jint* status_ptr) { |
Andreas Gampe | ff9d209 | 2017-01-06 09:12:49 -0800 | [diff] [blame] | 552 | return ClassUtil::GetClassStatus(env, klass, status_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 553 | } |
| 554 | |
| 555 | static jvmtiError GetSourceFileName(jvmtiEnv* env, jclass klass, char** source_name_ptr) { |
| 556 | return ERR(NOT_IMPLEMENTED); |
| 557 | } |
| 558 | |
| 559 | static jvmtiError GetClassModifiers(jvmtiEnv* env, jclass klass, jint* modifiers_ptr) { |
Andreas Gampe | 64013e5 | 2017-01-06 13:07:19 -0800 | [diff] [blame] | 560 | return ClassUtil::GetClassModifiers(env, klass, modifiers_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 561 | } |
| 562 | |
| 563 | static jvmtiError GetClassMethods(jvmtiEnv* env, |
| 564 | jclass klass, |
| 565 | jint* method_count_ptr, |
| 566 | jmethodID** methods_ptr) { |
Andreas Gampe | 18fee4d | 2017-01-06 11:36:35 -0800 | [diff] [blame] | 567 | return ClassUtil::GetClassMethods(env, klass, method_count_ptr, methods_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 568 | } |
| 569 | |
| 570 | static jvmtiError GetClassFields(jvmtiEnv* env, |
| 571 | jclass klass, |
| 572 | jint* field_count_ptr, |
| 573 | jfieldID** fields_ptr) { |
Andreas Gampe | ac58727 | 2017-01-05 15:21:34 -0800 | [diff] [blame] | 574 | return ClassUtil::GetClassFields(env, klass, field_count_ptr, fields_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 575 | } |
| 576 | |
| 577 | static jvmtiError GetImplementedInterfaces(jvmtiEnv* env, |
| 578 | jclass klass, |
| 579 | jint* interface_count_ptr, |
| 580 | jclass** interfaces_ptr) { |
Andreas Gampe | 8b07e47 | 2017-01-06 14:20:39 -0800 | [diff] [blame] | 581 | return ClassUtil::GetImplementedInterfaces(env, klass, interface_count_ptr, interfaces_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 582 | } |
| 583 | |
| 584 | static jvmtiError GetClassVersionNumbers(jvmtiEnv* env, |
| 585 | jclass klass, |
| 586 | jint* minor_version_ptr, |
| 587 | jint* major_version_ptr) { |
| 588 | return ERR(NOT_IMPLEMENTED); |
| 589 | } |
| 590 | |
| 591 | static jvmtiError GetConstantPool(jvmtiEnv* env, |
| 592 | jclass klass, |
| 593 | jint* constant_pool_count_ptr, |
| 594 | jint* constant_pool_byte_count_ptr, |
| 595 | unsigned char** constant_pool_bytes_ptr) { |
| 596 | return ERR(NOT_IMPLEMENTED); |
| 597 | } |
| 598 | |
| 599 | static jvmtiError IsInterface(jvmtiEnv* env, jclass klass, jboolean* is_interface_ptr) { |
Andreas Gampe | 4fd66ec | 2017-01-05 14:42:13 -0800 | [diff] [blame] | 600 | return ClassUtil::IsInterface(env, klass, is_interface_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 601 | } |
| 602 | |
| 603 | static jvmtiError IsArrayClass(jvmtiEnv* env, |
| 604 | jclass klass, |
| 605 | jboolean* is_array_class_ptr) { |
Andreas Gampe | 4fd66ec | 2017-01-05 14:42:13 -0800 | [diff] [blame] | 606 | return ClassUtil::IsArrayClass(env, klass, is_array_class_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 607 | } |
| 608 | |
| 609 | static jvmtiError IsModifiableClass(jvmtiEnv* env, |
| 610 | jclass klass, |
| 611 | jboolean* is_modifiable_class_ptr) { |
Alex Light | e4a8863 | 2017-01-10 07:41:24 -0800 | [diff] [blame] | 612 | return Redefiner::IsModifiableClass(env, klass, is_modifiable_class_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 613 | } |
| 614 | |
| 615 | static jvmtiError GetClassLoader(jvmtiEnv* env, jclass klass, jobject* classloader_ptr) { |
Andreas Gampe | 8f5b603 | 2017-01-06 15:50:55 -0800 | [diff] [blame] | 616 | return ClassUtil::GetClassLoader(env, klass, classloader_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 617 | } |
| 618 | |
| 619 | static jvmtiError GetSourceDebugExtension(jvmtiEnv* env, |
| 620 | jclass klass, |
| 621 | char** source_debug_extension_ptr) { |
| 622 | return ERR(NOT_IMPLEMENTED); |
| 623 | } |
| 624 | |
| 625 | static jvmtiError RetransformClasses(jvmtiEnv* env, jint class_count, const jclass* classes) { |
| 626 | return ERR(NOT_IMPLEMENTED); |
| 627 | } |
| 628 | |
| 629 | static jvmtiError RedefineClasses(jvmtiEnv* env, |
| 630 | jint class_count, |
| 631 | const jvmtiClassDefinition* class_definitions) { |
Alex Light | 0e69273 | 2017-01-10 15:00:05 -0800 | [diff] [blame] | 632 | std::string error_msg; |
| 633 | jvmtiError res = Redefiner::RedefineClasses(ArtJvmTiEnv::AsArtJvmTiEnv(env), |
| 634 | art::Runtime::Current(), |
| 635 | art::Thread::Current(), |
| 636 | class_count, |
| 637 | class_definitions, |
| 638 | &error_msg); |
| 639 | if (res != OK) { |
| 640 | LOG(WARNING) << "FAILURE TO REDEFINE " << error_msg; |
| 641 | } |
| 642 | return res; |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 643 | } |
| 644 | |
| 645 | static jvmtiError GetObjectSize(jvmtiEnv* env, jobject object, jlong* size_ptr) { |
Andreas Gampe | 50a4e49 | 2017-01-06 18:00:20 -0800 | [diff] [blame] | 646 | return ObjectUtil::GetObjectSize(env, object, size_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 647 | } |
| 648 | |
| 649 | static jvmtiError GetObjectHashCode(jvmtiEnv* env, jobject object, jint* hash_code_ptr) { |
Andreas Gampe | 50a4e49 | 2017-01-06 18:00:20 -0800 | [diff] [blame] | 650 | return ObjectUtil::GetObjectHashCode(env, object, hash_code_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 651 | } |
| 652 | |
| 653 | static jvmtiError GetObjectMonitorUsage(jvmtiEnv* env, |
| 654 | jobject object, |
| 655 | jvmtiMonitorUsage* info_ptr) { |
| 656 | return ERR(NOT_IMPLEMENTED); |
| 657 | } |
| 658 | |
| 659 | static jvmtiError GetFieldName(jvmtiEnv* env, |
| 660 | jclass klass, |
| 661 | jfieldID field, |
| 662 | char** name_ptr, |
| 663 | char** signature_ptr, |
| 664 | char** generic_ptr) { |
Andreas Gampe | ab2f0d0 | 2017-01-05 17:23:45 -0800 | [diff] [blame] | 665 | return FieldUtil::GetFieldName(env, klass, field, name_ptr, signature_ptr, generic_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 666 | } |
| 667 | |
| 668 | static jvmtiError GetFieldDeclaringClass(jvmtiEnv* env, |
| 669 | jclass klass, |
| 670 | jfieldID field, |
| 671 | jclass* declaring_class_ptr) { |
Andreas Gampe | ab2f0d0 | 2017-01-05 17:23:45 -0800 | [diff] [blame] | 672 | return FieldUtil::GetFieldDeclaringClass(env, klass, field, declaring_class_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 673 | } |
| 674 | |
| 675 | static jvmtiError GetFieldModifiers(jvmtiEnv* env, |
| 676 | jclass klass, |
| 677 | jfieldID field, |
| 678 | jint* modifiers_ptr) { |
Andreas Gampe | ab2f0d0 | 2017-01-05 17:23:45 -0800 | [diff] [blame] | 679 | return FieldUtil::GetFieldModifiers(env, klass, field, modifiers_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 680 | } |
| 681 | |
| 682 | static jvmtiError IsFieldSynthetic(jvmtiEnv* env, |
| 683 | jclass klass, |
| 684 | jfieldID field, |
| 685 | jboolean* is_synthetic_ptr) { |
Andreas Gampe | ab2f0d0 | 2017-01-05 17:23:45 -0800 | [diff] [blame] | 686 | return FieldUtil::IsFieldSynthetic(env, klass, field, is_synthetic_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 687 | } |
| 688 | |
| 689 | static jvmtiError GetMethodName(jvmtiEnv* env, |
| 690 | jmethodID method, |
| 691 | char** name_ptr, |
| 692 | char** signature_ptr, |
| 693 | char** generic_ptr) { |
Andreas Gampe | 3c252f0 | 2016-10-27 18:25:17 -0700 | [diff] [blame] | 694 | return MethodUtil::GetMethodName(env, method, name_ptr, signature_ptr, generic_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 695 | } |
| 696 | |
| 697 | static jvmtiError GetMethodDeclaringClass(jvmtiEnv* env, |
| 698 | jmethodID method, |
| 699 | jclass* declaring_class_ptr) { |
Andreas Gampe | 368a208 | 2016-10-28 17:33:13 -0700 | [diff] [blame] | 700 | return MethodUtil::GetMethodDeclaringClass(env, method, declaring_class_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 701 | } |
| 702 | |
| 703 | static jvmtiError GetMethodModifiers(jvmtiEnv* env, |
| 704 | jmethodID method, |
| 705 | jint* modifiers_ptr) { |
Andreas Gampe | 36bcd4f | 2016-10-28 18:07:18 -0700 | [diff] [blame] | 706 | return MethodUtil::GetMethodModifiers(env, method, modifiers_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 707 | } |
| 708 | |
| 709 | static jvmtiError GetMaxLocals(jvmtiEnv* env, |
| 710 | jmethodID method, |
| 711 | jint* max_ptr) { |
Andreas Gampe | f71832e | 2017-01-09 11:38:04 -0800 | [diff] [blame] | 712 | return MethodUtil::GetMaxLocals(env, method, max_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 713 | } |
| 714 | |
| 715 | static jvmtiError GetArgumentsSize(jvmtiEnv* env, |
| 716 | jmethodID method, |
| 717 | jint* size_ptr) { |
Andreas Gampe | f71832e | 2017-01-09 11:38:04 -0800 | [diff] [blame] | 718 | return MethodUtil::GetArgumentsSize(env, method, size_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 719 | } |
| 720 | |
| 721 | static jvmtiError GetLineNumberTable(jvmtiEnv* env, |
| 722 | jmethodID method, |
| 723 | jint* entry_count_ptr, |
| 724 | jvmtiLineNumberEntry** table_ptr) { |
Andreas Gampe | da3e561 | 2016-12-13 19:00:53 -0800 | [diff] [blame] | 725 | return MethodUtil::GetLineNumberTable(env, method, entry_count_ptr, table_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 726 | } |
| 727 | |
| 728 | static jvmtiError GetMethodLocation(jvmtiEnv* env, |
| 729 | jmethodID method, |
| 730 | jlocation* start_location_ptr, |
| 731 | jlocation* end_location_ptr) { |
Andreas Gampe | f71832e | 2017-01-09 11:38:04 -0800 | [diff] [blame] | 732 | return MethodUtil::GetMethodLocation(env, method, start_location_ptr, end_location_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 733 | } |
| 734 | |
| 735 | static jvmtiError GetLocalVariableTable(jvmtiEnv* env, |
| 736 | jmethodID method, |
| 737 | jint* entry_count_ptr, |
| 738 | jvmtiLocalVariableEntry** table_ptr) { |
| 739 | return ERR(NOT_IMPLEMENTED); |
| 740 | } |
| 741 | |
| 742 | static jvmtiError GetBytecodes(jvmtiEnv* env, |
| 743 | jmethodID method, |
| 744 | jint* bytecode_count_ptr, |
| 745 | unsigned char** bytecodes_ptr) { |
| 746 | return ERR(NOT_IMPLEMENTED); |
| 747 | } |
| 748 | |
| 749 | static jvmtiError IsMethodNative(jvmtiEnv* env, jmethodID method, jboolean* is_native_ptr) { |
Andreas Gampe | fdeef52 | 2017-01-09 14:40:25 -0800 | [diff] [blame] | 750 | return MethodUtil::IsMethodNative(env, method, is_native_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 751 | } |
| 752 | |
| 753 | static jvmtiError IsMethodSynthetic(jvmtiEnv* env, jmethodID method, jboolean* is_synthetic_ptr) { |
Andreas Gampe | fdeef52 | 2017-01-09 14:40:25 -0800 | [diff] [blame] | 754 | return MethodUtil::IsMethodSynthetic(env, method, is_synthetic_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 755 | } |
| 756 | |
| 757 | static jvmtiError IsMethodObsolete(jvmtiEnv* env, jmethodID method, jboolean* is_obsolete_ptr) { |
Andreas Gampe | fdeef52 | 2017-01-09 14:40:25 -0800 | [diff] [blame] | 758 | return MethodUtil::IsMethodObsolete(env, method, is_obsolete_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 759 | } |
| 760 | |
| 761 | static jvmtiError SetNativeMethodPrefix(jvmtiEnv* env, const char* prefix) { |
| 762 | return ERR(NOT_IMPLEMENTED); |
| 763 | } |
| 764 | |
| 765 | static jvmtiError SetNativeMethodPrefixes(jvmtiEnv* env, jint prefix_count, char** prefixes) { |
| 766 | return ERR(NOT_IMPLEMENTED); |
| 767 | } |
| 768 | |
| 769 | static jvmtiError CreateRawMonitor(jvmtiEnv* env, const char* name, jrawMonitorID* monitor_ptr) { |
Andreas Gampe | 319dbe8 | 2017-01-09 16:42:21 -0800 | [diff] [blame] | 770 | return MonitorUtil::CreateRawMonitor(env, name, monitor_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 771 | } |
| 772 | |
| 773 | static jvmtiError DestroyRawMonitor(jvmtiEnv* env, jrawMonitorID monitor) { |
Andreas Gampe | 319dbe8 | 2017-01-09 16:42:21 -0800 | [diff] [blame] | 774 | return MonitorUtil::DestroyRawMonitor(env, monitor); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 775 | } |
| 776 | |
| 777 | static jvmtiError RawMonitorEnter(jvmtiEnv* env, jrawMonitorID monitor) { |
Andreas Gampe | 319dbe8 | 2017-01-09 16:42:21 -0800 | [diff] [blame] | 778 | return MonitorUtil::RawMonitorEnter(env, monitor); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 779 | } |
| 780 | |
| 781 | static jvmtiError RawMonitorExit(jvmtiEnv* env, jrawMonitorID monitor) { |
Andreas Gampe | 319dbe8 | 2017-01-09 16:42:21 -0800 | [diff] [blame] | 782 | return MonitorUtil::RawMonitorExit(env, monitor); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 783 | } |
| 784 | |
| 785 | static jvmtiError RawMonitorWait(jvmtiEnv* env, jrawMonitorID monitor, jlong millis) { |
Andreas Gampe | 319dbe8 | 2017-01-09 16:42:21 -0800 | [diff] [blame] | 786 | return MonitorUtil::RawMonitorWait(env, monitor, millis); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 787 | } |
| 788 | |
| 789 | static jvmtiError RawMonitorNotify(jvmtiEnv* env, jrawMonitorID monitor) { |
Andreas Gampe | 319dbe8 | 2017-01-09 16:42:21 -0800 | [diff] [blame] | 790 | return MonitorUtil::RawMonitorNotify(env, monitor); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 791 | } |
| 792 | |
| 793 | static jvmtiError RawMonitorNotifyAll(jvmtiEnv* env, jrawMonitorID monitor) { |
Andreas Gampe | 319dbe8 | 2017-01-09 16:42:21 -0800 | [diff] [blame] | 794 | return MonitorUtil::RawMonitorNotifyAll(env, monitor); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 795 | } |
| 796 | |
| 797 | static jvmtiError SetJNIFunctionTable(jvmtiEnv* env, const jniNativeInterface* function_table) { |
| 798 | return ERR(NOT_IMPLEMENTED); |
| 799 | } |
| 800 | |
| 801 | static jvmtiError GetJNIFunctionTable(jvmtiEnv* env, jniNativeInterface** function_table) { |
| 802 | return ERR(NOT_IMPLEMENTED); |
| 803 | } |
| 804 | |
Andreas Gampe | 77708d9 | 2016-10-07 11:48:21 -0700 | [diff] [blame] | 805 | // TODO: This will require locking, so that an agent can't remove callbacks when we're dispatching |
| 806 | // an event. |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 807 | static jvmtiError SetEventCallbacks(jvmtiEnv* env, |
| 808 | const jvmtiEventCallbacks* callbacks, |
| 809 | jint size_of_callbacks) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 810 | ENSURE_VALID_ENV(env); |
Andreas Gampe | 77708d9 | 2016-10-07 11:48:21 -0700 | [diff] [blame] | 811 | if (size_of_callbacks < 0) { |
| 812 | return ERR(ILLEGAL_ARGUMENT); |
| 813 | } |
| 814 | |
| 815 | if (callbacks == nullptr) { |
| 816 | ArtJvmTiEnv::AsArtJvmTiEnv(env)->event_callbacks.reset(); |
| 817 | return ERR(NONE); |
| 818 | } |
| 819 | |
| 820 | std::unique_ptr<jvmtiEventCallbacks> tmp(new jvmtiEventCallbacks()); |
| 821 | memset(tmp.get(), 0, sizeof(jvmtiEventCallbacks)); |
| 822 | size_t copy_size = std::min(sizeof(jvmtiEventCallbacks), |
| 823 | static_cast<size_t>(size_of_callbacks)); |
| 824 | copy_size = art::RoundDown(copy_size, sizeof(void*)); |
| 825 | memcpy(tmp.get(), callbacks, copy_size); |
| 826 | |
| 827 | ArtJvmTiEnv::AsArtJvmTiEnv(env)->event_callbacks = std::move(tmp); |
| 828 | |
| 829 | return ERR(NONE); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 830 | } |
| 831 | |
| 832 | static jvmtiError SetEventNotificationMode(jvmtiEnv* env, |
| 833 | jvmtiEventMode mode, |
| 834 | jvmtiEvent event_type, |
| 835 | jthread event_thread, |
| 836 | ...) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 837 | ENSURE_VALID_ENV(env); |
| 838 | // TODO: Check for capabilities. |
Andreas Gampe | 77708d9 | 2016-10-07 11:48:21 -0700 | [diff] [blame] | 839 | art::Thread* art_thread = nullptr; |
| 840 | if (event_thread != nullptr) { |
| 841 | // TODO: Need non-aborting call here, to return JVMTI_ERROR_INVALID_THREAD. |
| 842 | art::ScopedObjectAccess soa(art::Thread::Current()); |
| 843 | art::MutexLock mu(soa.Self(), *art::Locks::thread_list_lock_); |
| 844 | art_thread = art::Thread::FromManagedThread(soa, event_thread); |
| 845 | |
| 846 | if (art_thread == nullptr || // The thread hasn't been started or is already dead. |
| 847 | art_thread->IsStillStarting()) { |
| 848 | // TODO: We may want to let the EventHandler know, so it could clean up masks, potentially. |
| 849 | return ERR(THREAD_NOT_ALIVE); |
| 850 | } |
| 851 | } |
| 852 | |
| 853 | return gEventHandler.SetEvent(ArtJvmTiEnv::AsArtJvmTiEnv(env), art_thread, event_type, mode); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 854 | } |
| 855 | |
| 856 | static jvmtiError GenerateEvents(jvmtiEnv* env, jvmtiEvent event_type) { |
| 857 | return ERR(NOT_IMPLEMENTED); |
| 858 | } |
| 859 | |
| 860 | static jvmtiError GetExtensionFunctions(jvmtiEnv* env, |
| 861 | jint* extension_count_ptr, |
| 862 | jvmtiExtensionFunctionInfo** extensions) { |
Andreas Gampe | e4c3384 | 2017-01-09 10:50:17 -0800 | [diff] [blame] | 863 | // We do not have any extension functions. |
| 864 | *extension_count_ptr = 0; |
| 865 | *extensions = nullptr; |
| 866 | |
| 867 | return ERR(NONE); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 868 | } |
| 869 | |
| 870 | static jvmtiError GetExtensionEvents(jvmtiEnv* env, |
| 871 | jint* extension_count_ptr, |
| 872 | jvmtiExtensionEventInfo** extensions) { |
Andreas Gampe | e4c3384 | 2017-01-09 10:50:17 -0800 | [diff] [blame] | 873 | // We do not have any extension events. |
| 874 | *extension_count_ptr = 0; |
| 875 | *extensions = nullptr; |
| 876 | |
| 877 | return ERR(NONE); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 878 | } |
| 879 | |
| 880 | static jvmtiError SetExtensionEventCallback(jvmtiEnv* env, |
| 881 | jint extension_event_index, |
| 882 | jvmtiExtensionEvent callback) { |
Andreas Gampe | e4c3384 | 2017-01-09 10:50:17 -0800 | [diff] [blame] | 883 | // We do not have any extension events, so any call is illegal. |
| 884 | return ERR(ILLEGAL_ARGUMENT); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 885 | } |
| 886 | |
| 887 | static jvmtiError GetPotentialCapabilities(jvmtiEnv* env, jvmtiCapabilities* capabilities_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 888 | ENSURE_VALID_ENV(env); |
| 889 | ENSURE_NON_NULL(capabilities_ptr); |
| 890 | *capabilities_ptr = kPotentialCapabilities; |
| 891 | return OK; |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 892 | } |
| 893 | |
| 894 | static jvmtiError AddCapabilities(jvmtiEnv* env, const jvmtiCapabilities* capabilities_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 895 | ENSURE_VALID_ENV(env); |
| 896 | ENSURE_NON_NULL(capabilities_ptr); |
| 897 | ArtJvmTiEnv* art_env = static_cast<ArtJvmTiEnv*>(env); |
| 898 | jvmtiError ret = OK; |
| 899 | #define ADD_CAPABILITY(e) \ |
| 900 | do { \ |
| 901 | if (capabilities_ptr->e == 1) { \ |
| 902 | if (kPotentialCapabilities.e == 1) { \ |
| 903 | art_env->capabilities.e = 1;\ |
| 904 | } else { \ |
| 905 | ret = ERR(NOT_AVAILABLE); \ |
| 906 | } \ |
| 907 | } \ |
| 908 | } while (false) |
| 909 | |
| 910 | ADD_CAPABILITY(can_tag_objects); |
| 911 | ADD_CAPABILITY(can_generate_field_modification_events); |
| 912 | ADD_CAPABILITY(can_generate_field_access_events); |
| 913 | ADD_CAPABILITY(can_get_bytecodes); |
| 914 | ADD_CAPABILITY(can_get_synthetic_attribute); |
| 915 | ADD_CAPABILITY(can_get_owned_monitor_info); |
| 916 | ADD_CAPABILITY(can_get_current_contended_monitor); |
| 917 | ADD_CAPABILITY(can_get_monitor_info); |
| 918 | ADD_CAPABILITY(can_pop_frame); |
| 919 | ADD_CAPABILITY(can_redefine_classes); |
| 920 | ADD_CAPABILITY(can_signal_thread); |
| 921 | ADD_CAPABILITY(can_get_source_file_name); |
| 922 | ADD_CAPABILITY(can_get_line_numbers); |
| 923 | ADD_CAPABILITY(can_get_source_debug_extension); |
| 924 | ADD_CAPABILITY(can_access_local_variables); |
| 925 | ADD_CAPABILITY(can_maintain_original_method_order); |
| 926 | ADD_CAPABILITY(can_generate_single_step_events); |
| 927 | ADD_CAPABILITY(can_generate_exception_events); |
| 928 | ADD_CAPABILITY(can_generate_frame_pop_events); |
| 929 | ADD_CAPABILITY(can_generate_breakpoint_events); |
| 930 | ADD_CAPABILITY(can_suspend); |
| 931 | ADD_CAPABILITY(can_redefine_any_class); |
| 932 | ADD_CAPABILITY(can_get_current_thread_cpu_time); |
| 933 | ADD_CAPABILITY(can_get_thread_cpu_time); |
| 934 | ADD_CAPABILITY(can_generate_method_entry_events); |
| 935 | ADD_CAPABILITY(can_generate_method_exit_events); |
| 936 | ADD_CAPABILITY(can_generate_all_class_hook_events); |
| 937 | ADD_CAPABILITY(can_generate_compiled_method_load_events); |
| 938 | ADD_CAPABILITY(can_generate_monitor_events); |
| 939 | ADD_CAPABILITY(can_generate_vm_object_alloc_events); |
| 940 | ADD_CAPABILITY(can_generate_native_method_bind_events); |
| 941 | ADD_CAPABILITY(can_generate_garbage_collection_events); |
| 942 | ADD_CAPABILITY(can_generate_object_free_events); |
| 943 | ADD_CAPABILITY(can_force_early_return); |
| 944 | ADD_CAPABILITY(can_get_owned_monitor_stack_depth_info); |
| 945 | ADD_CAPABILITY(can_get_constant_pool); |
| 946 | ADD_CAPABILITY(can_set_native_method_prefix); |
| 947 | ADD_CAPABILITY(can_retransform_classes); |
| 948 | ADD_CAPABILITY(can_retransform_any_class); |
| 949 | ADD_CAPABILITY(can_generate_resource_exhaustion_heap_events); |
| 950 | ADD_CAPABILITY(can_generate_resource_exhaustion_threads_events); |
| 951 | #undef ADD_CAPABILITY |
| 952 | return ret; |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 953 | } |
| 954 | |
| 955 | static jvmtiError RelinquishCapabilities(jvmtiEnv* env, |
| 956 | const jvmtiCapabilities* capabilities_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 957 | ENSURE_VALID_ENV(env); |
| 958 | ENSURE_NON_NULL(capabilities_ptr); |
| 959 | ArtJvmTiEnv* art_env = reinterpret_cast<ArtJvmTiEnv*>(env); |
| 960 | #define DEL_CAPABILITY(e) \ |
| 961 | do { \ |
| 962 | if (capabilities_ptr->e == 1) { \ |
| 963 | art_env->capabilities.e = 0;\ |
| 964 | } \ |
| 965 | } while (false) |
| 966 | |
| 967 | DEL_CAPABILITY(can_tag_objects); |
| 968 | DEL_CAPABILITY(can_generate_field_modification_events); |
| 969 | DEL_CAPABILITY(can_generate_field_access_events); |
| 970 | DEL_CAPABILITY(can_get_bytecodes); |
| 971 | DEL_CAPABILITY(can_get_synthetic_attribute); |
| 972 | DEL_CAPABILITY(can_get_owned_monitor_info); |
| 973 | DEL_CAPABILITY(can_get_current_contended_monitor); |
| 974 | DEL_CAPABILITY(can_get_monitor_info); |
| 975 | DEL_CAPABILITY(can_pop_frame); |
| 976 | DEL_CAPABILITY(can_redefine_classes); |
| 977 | DEL_CAPABILITY(can_signal_thread); |
| 978 | DEL_CAPABILITY(can_get_source_file_name); |
| 979 | DEL_CAPABILITY(can_get_line_numbers); |
| 980 | DEL_CAPABILITY(can_get_source_debug_extension); |
| 981 | DEL_CAPABILITY(can_access_local_variables); |
| 982 | DEL_CAPABILITY(can_maintain_original_method_order); |
| 983 | DEL_CAPABILITY(can_generate_single_step_events); |
| 984 | DEL_CAPABILITY(can_generate_exception_events); |
| 985 | DEL_CAPABILITY(can_generate_frame_pop_events); |
| 986 | DEL_CAPABILITY(can_generate_breakpoint_events); |
| 987 | DEL_CAPABILITY(can_suspend); |
| 988 | DEL_CAPABILITY(can_redefine_any_class); |
| 989 | DEL_CAPABILITY(can_get_current_thread_cpu_time); |
| 990 | DEL_CAPABILITY(can_get_thread_cpu_time); |
| 991 | DEL_CAPABILITY(can_generate_method_entry_events); |
| 992 | DEL_CAPABILITY(can_generate_method_exit_events); |
| 993 | DEL_CAPABILITY(can_generate_all_class_hook_events); |
| 994 | DEL_CAPABILITY(can_generate_compiled_method_load_events); |
| 995 | DEL_CAPABILITY(can_generate_monitor_events); |
| 996 | DEL_CAPABILITY(can_generate_vm_object_alloc_events); |
| 997 | DEL_CAPABILITY(can_generate_native_method_bind_events); |
| 998 | DEL_CAPABILITY(can_generate_garbage_collection_events); |
| 999 | DEL_CAPABILITY(can_generate_object_free_events); |
| 1000 | DEL_CAPABILITY(can_force_early_return); |
| 1001 | DEL_CAPABILITY(can_get_owned_monitor_stack_depth_info); |
| 1002 | DEL_CAPABILITY(can_get_constant_pool); |
| 1003 | DEL_CAPABILITY(can_set_native_method_prefix); |
| 1004 | DEL_CAPABILITY(can_retransform_classes); |
| 1005 | DEL_CAPABILITY(can_retransform_any_class); |
| 1006 | DEL_CAPABILITY(can_generate_resource_exhaustion_heap_events); |
| 1007 | DEL_CAPABILITY(can_generate_resource_exhaustion_threads_events); |
| 1008 | #undef DEL_CAPABILITY |
| 1009 | return OK; |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1010 | } |
| 1011 | |
| 1012 | static jvmtiError GetCapabilities(jvmtiEnv* env, jvmtiCapabilities* capabilities_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 1013 | ENSURE_VALID_ENV(env); |
| 1014 | ENSURE_NON_NULL(capabilities_ptr); |
| 1015 | ArtJvmTiEnv* artenv = reinterpret_cast<ArtJvmTiEnv*>(env); |
| 1016 | *capabilities_ptr = artenv->capabilities; |
| 1017 | return OK; |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1018 | } |
| 1019 | |
| 1020 | static jvmtiError GetCurrentThreadCpuTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) { |
| 1021 | return ERR(NOT_IMPLEMENTED); |
| 1022 | } |
| 1023 | |
| 1024 | static jvmtiError GetCurrentThreadCpuTime(jvmtiEnv* env, jlong* nanos_ptr) { |
| 1025 | return ERR(NOT_IMPLEMENTED); |
| 1026 | } |
| 1027 | |
| 1028 | static jvmtiError GetThreadCpuTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) { |
| 1029 | return ERR(NOT_IMPLEMENTED); |
| 1030 | } |
| 1031 | |
| 1032 | static jvmtiError GetThreadCpuTime(jvmtiEnv* env, jthread thread, jlong* nanos_ptr) { |
| 1033 | return ERR(NOT_IMPLEMENTED); |
| 1034 | } |
| 1035 | |
| 1036 | static jvmtiError GetTimerInfo(jvmtiEnv* env, jvmtiTimerInfo* info_ptr) { |
Andreas Gampe | 35bcf81 | 2017-01-13 16:24:17 -0800 | [diff] [blame^] | 1037 | return TimerUtil::GetTimerInfo(env, info_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1038 | } |
| 1039 | |
| 1040 | static jvmtiError GetTime(jvmtiEnv* env, jlong* nanos_ptr) { |
Andreas Gampe | 35bcf81 | 2017-01-13 16:24:17 -0800 | [diff] [blame^] | 1041 | return TimerUtil::GetTime(env, nanos_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1042 | } |
| 1043 | |
| 1044 | static jvmtiError GetAvailableProcessors(jvmtiEnv* env, jint* processor_count_ptr) { |
Andreas Gampe | 35bcf81 | 2017-01-13 16:24:17 -0800 | [diff] [blame^] | 1045 | return TimerUtil::GetAvailableProcessors(env, processor_count_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1046 | } |
| 1047 | |
| 1048 | static jvmtiError AddToBootstrapClassLoaderSearch(jvmtiEnv* env, const char* segment) { |
| 1049 | return ERR(NOT_IMPLEMENTED); |
| 1050 | } |
| 1051 | |
| 1052 | static jvmtiError AddToSystemClassLoaderSearch(jvmtiEnv* env, const char* segment) { |
| 1053 | return ERR(NOT_IMPLEMENTED); |
| 1054 | } |
| 1055 | |
| 1056 | static jvmtiError GetSystemProperties(jvmtiEnv* env, jint* count_ptr, char*** property_ptr) { |
Andreas Gampe | 1bdaf73 | 2017-01-09 19:21:06 -0800 | [diff] [blame] | 1057 | return PropertiesUtil::GetSystemProperties(env, count_ptr, property_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1058 | } |
| 1059 | |
| 1060 | static jvmtiError GetSystemProperty(jvmtiEnv* env, const char* property, char** value_ptr) { |
Andreas Gampe | 1bdaf73 | 2017-01-09 19:21:06 -0800 | [diff] [blame] | 1061 | return PropertiesUtil::GetSystemProperty(env, property, value_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1062 | } |
| 1063 | |
| 1064 | static jvmtiError SetSystemProperty(jvmtiEnv* env, const char* property, const char* value) { |
Andreas Gampe | 1bdaf73 | 2017-01-09 19:21:06 -0800 | [diff] [blame] | 1065 | return PropertiesUtil::SetSystemProperty(env, property, value); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1066 | } |
| 1067 | |
| 1068 | static jvmtiError GetPhase(jvmtiEnv* env, jvmtiPhase* phase_ptr) { |
| 1069 | return ERR(NOT_IMPLEMENTED); |
| 1070 | } |
| 1071 | |
| 1072 | static jvmtiError DisposeEnvironment(jvmtiEnv* env) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 1073 | ENSURE_VALID_ENV(env); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1074 | delete env; |
| 1075 | return OK; |
| 1076 | } |
| 1077 | |
| 1078 | static jvmtiError SetEnvironmentLocalStorage(jvmtiEnv* env, const void* data) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 1079 | ENSURE_VALID_ENV(env); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1080 | reinterpret_cast<ArtJvmTiEnv*>(env)->local_data = const_cast<void*>(data); |
| 1081 | return OK; |
| 1082 | } |
| 1083 | |
| 1084 | static jvmtiError GetEnvironmentLocalStorage(jvmtiEnv* env, void** data_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 1085 | ENSURE_VALID_ENV(env); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1086 | *data_ptr = reinterpret_cast<ArtJvmTiEnv*>(env)->local_data; |
| 1087 | return OK; |
| 1088 | } |
| 1089 | |
| 1090 | static jvmtiError GetVersionNumber(jvmtiEnv* env, jint* version_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 1091 | ENSURE_VALID_ENV(env); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1092 | *version_ptr = JVMTI_VERSION; |
| 1093 | return OK; |
| 1094 | } |
| 1095 | |
| 1096 | static jvmtiError GetErrorName(jvmtiEnv* env, jvmtiError error, char** name_ptr) { |
Alex Light | e657424 | 2016-08-17 09:56:24 -0700 | [diff] [blame] | 1097 | ENSURE_NON_NULL(name_ptr); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1098 | switch (error) { |
| 1099 | #define ERROR_CASE(e) case (JVMTI_ERROR_ ## e) : do { \ |
Alex Light | 4196071 | 2017-01-06 14:44:23 -0800 | [diff] [blame] | 1100 | jvmtiError res = CopyString(env, \ |
| 1101 | "JVMTI_ERROR_"#e, \ |
| 1102 | reinterpret_cast<unsigned char**>(name_ptr)); \ |
| 1103 | if (res != OK) { \ |
| 1104 | *name_ptr = nullptr; \ |
| 1105 | return res; \ |
| 1106 | } else { \ |
| 1107 | return OK; \ |
| 1108 | } \ |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1109 | } while (false) |
| 1110 | ERROR_CASE(NONE); |
| 1111 | ERROR_CASE(INVALID_THREAD); |
| 1112 | ERROR_CASE(INVALID_THREAD_GROUP); |
| 1113 | ERROR_CASE(INVALID_PRIORITY); |
| 1114 | ERROR_CASE(THREAD_NOT_SUSPENDED); |
| 1115 | ERROR_CASE(THREAD_NOT_ALIVE); |
| 1116 | ERROR_CASE(INVALID_OBJECT); |
| 1117 | ERROR_CASE(INVALID_CLASS); |
| 1118 | ERROR_CASE(CLASS_NOT_PREPARED); |
| 1119 | ERROR_CASE(INVALID_METHODID); |
| 1120 | ERROR_CASE(INVALID_LOCATION); |
| 1121 | ERROR_CASE(INVALID_FIELDID); |
| 1122 | ERROR_CASE(NO_MORE_FRAMES); |
| 1123 | ERROR_CASE(OPAQUE_FRAME); |
| 1124 | ERROR_CASE(TYPE_MISMATCH); |
| 1125 | ERROR_CASE(INVALID_SLOT); |
| 1126 | ERROR_CASE(DUPLICATE); |
| 1127 | ERROR_CASE(NOT_FOUND); |
| 1128 | ERROR_CASE(INVALID_MONITOR); |
| 1129 | ERROR_CASE(NOT_MONITOR_OWNER); |
| 1130 | ERROR_CASE(INTERRUPT); |
| 1131 | ERROR_CASE(INVALID_CLASS_FORMAT); |
| 1132 | ERROR_CASE(CIRCULAR_CLASS_DEFINITION); |
| 1133 | ERROR_CASE(FAILS_VERIFICATION); |
| 1134 | ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_ADDED); |
| 1135 | ERROR_CASE(UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED); |
| 1136 | ERROR_CASE(INVALID_TYPESTATE); |
| 1137 | ERROR_CASE(UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED); |
| 1138 | ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_DELETED); |
| 1139 | ERROR_CASE(UNSUPPORTED_VERSION); |
| 1140 | ERROR_CASE(NAMES_DONT_MATCH); |
| 1141 | ERROR_CASE(UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED); |
| 1142 | ERROR_CASE(UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED); |
| 1143 | ERROR_CASE(UNMODIFIABLE_CLASS); |
| 1144 | ERROR_CASE(NOT_AVAILABLE); |
| 1145 | ERROR_CASE(MUST_POSSESS_CAPABILITY); |
| 1146 | ERROR_CASE(NULL_POINTER); |
| 1147 | ERROR_CASE(ABSENT_INFORMATION); |
| 1148 | ERROR_CASE(INVALID_EVENT_TYPE); |
| 1149 | ERROR_CASE(ILLEGAL_ARGUMENT); |
| 1150 | ERROR_CASE(NATIVE_METHOD); |
| 1151 | ERROR_CASE(CLASS_LOADER_UNSUPPORTED); |
| 1152 | ERROR_CASE(OUT_OF_MEMORY); |
| 1153 | ERROR_CASE(ACCESS_DENIED); |
| 1154 | ERROR_CASE(WRONG_PHASE); |
| 1155 | ERROR_CASE(INTERNAL); |
| 1156 | ERROR_CASE(UNATTACHED_THREAD); |
| 1157 | ERROR_CASE(INVALID_ENVIRONMENT); |
| 1158 | #undef ERROR_CASE |
| 1159 | default: { |
Alex Light | 4196071 | 2017-01-06 14:44:23 -0800 | [diff] [blame] | 1160 | jvmtiError res = CopyString(env, |
| 1161 | "JVMTI_ERROR_UNKNOWN", |
| 1162 | reinterpret_cast<unsigned char**>(name_ptr)); |
| 1163 | if (res != OK) { |
| 1164 | *name_ptr = nullptr; |
| 1165 | return res; |
| 1166 | } else { |
| 1167 | return ERR(ILLEGAL_ARGUMENT); |
| 1168 | } |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1169 | } |
| 1170 | } |
| 1171 | } |
| 1172 | |
| 1173 | static jvmtiError SetVerboseFlag(jvmtiEnv* env, jvmtiVerboseFlag flag, jboolean value) { |
Andreas Gampe | f37e302 | 2017-01-13 17:54:46 -0800 | [diff] [blame] | 1174 | if (flag == jvmtiVerboseFlag::JVMTI_VERBOSE_OTHER) { |
| 1175 | // OTHER is special, as it's 0, so can't do a bit check. |
| 1176 | bool val = (value == JNI_TRUE) ? true : false; |
| 1177 | |
| 1178 | art::gLogVerbosity.collector = val; |
| 1179 | art::gLogVerbosity.compiler = val; |
| 1180 | art::gLogVerbosity.deopt = val; |
| 1181 | art::gLogVerbosity.heap = val; |
| 1182 | art::gLogVerbosity.jdwp = val; |
| 1183 | art::gLogVerbosity.jit = val; |
| 1184 | art::gLogVerbosity.monitor = val; |
| 1185 | art::gLogVerbosity.oat = val; |
| 1186 | art::gLogVerbosity.profiler = val; |
| 1187 | art::gLogVerbosity.signals = val; |
| 1188 | art::gLogVerbosity.simulator = val; |
| 1189 | art::gLogVerbosity.startup = val; |
| 1190 | art::gLogVerbosity.third_party_jni = val; |
| 1191 | art::gLogVerbosity.threads = val; |
| 1192 | art::gLogVerbosity.verifier = val; |
| 1193 | art::gLogVerbosity.image = val; |
| 1194 | |
| 1195 | // Note: can't switch systrace_lock_logging. That requires changing entrypoints. |
| 1196 | |
| 1197 | art::gLogVerbosity.agents = val; |
| 1198 | } else { |
| 1199 | // Spec isn't clear whether "flag" is a mask or supposed to be single. We implement the mask |
| 1200 | // semantics. |
| 1201 | constexpr std::underlying_type<jvmtiVerboseFlag>::type kMask = |
| 1202 | jvmtiVerboseFlag::JVMTI_VERBOSE_GC | |
| 1203 | jvmtiVerboseFlag::JVMTI_VERBOSE_CLASS | |
| 1204 | jvmtiVerboseFlag::JVMTI_VERBOSE_JNI; |
| 1205 | if ((flag & ~kMask) != 0) { |
| 1206 | return ERR(ILLEGAL_ARGUMENT); |
| 1207 | } |
| 1208 | |
| 1209 | bool val = (value == JNI_TRUE) ? true : false; |
| 1210 | |
| 1211 | if ((flag & jvmtiVerboseFlag::JVMTI_VERBOSE_GC) != 0) { |
| 1212 | art::gLogVerbosity.gc = val; |
| 1213 | } |
| 1214 | |
| 1215 | if ((flag & jvmtiVerboseFlag::JVMTI_VERBOSE_CLASS) != 0) { |
| 1216 | art::gLogVerbosity.class_linker = val; |
| 1217 | } |
| 1218 | |
| 1219 | if ((flag & jvmtiVerboseFlag::JVMTI_VERBOSE_JNI) != 0) { |
| 1220 | art::gLogVerbosity.jni = val; |
| 1221 | } |
| 1222 | } |
| 1223 | |
| 1224 | return ERR(NONE); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1225 | } |
| 1226 | |
| 1227 | static jvmtiError GetJLocationFormat(jvmtiEnv* env, jvmtiJlocationFormat* format_ptr) { |
| 1228 | return ERR(NOT_IMPLEMENTED); |
| 1229 | } |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 1230 | |
| 1231 | // TODO Remove this once events are working. |
| 1232 | static jvmtiError RetransformClassWithHook(jvmtiEnv* env, |
| 1233 | jclass klass, |
| 1234 | jvmtiEventClassFileLoadHook hook) { |
| 1235 | std::vector<jclass> classes; |
| 1236 | classes.push_back(klass); |
| 1237 | return RetransformClassesWithHook(reinterpret_cast<ArtJvmTiEnv*>(env), classes, hook); |
| 1238 | } |
| 1239 | |
| 1240 | // TODO This will be called by the event handler for the art::ti Event Load Event |
| 1241 | static jvmtiError RetransformClassesWithHook(ArtJvmTiEnv* env, |
| 1242 | const std::vector<jclass>& classes, |
| 1243 | jvmtiEventClassFileLoadHook hook) { |
| 1244 | if (!IsValidEnv(env)) { |
| 1245 | return ERR(INVALID_ENVIRONMENT); |
| 1246 | } |
Alex Light | a01de59 | 2016-11-15 10:43:06 -0800 | [diff] [blame] | 1247 | jvmtiError res = OK; |
| 1248 | std::string error; |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 1249 | for (jclass klass : classes) { |
| 1250 | JNIEnv* jni_env = nullptr; |
| 1251 | jobject loader = nullptr; |
| 1252 | std::string name; |
| 1253 | jobject protection_domain = nullptr; |
| 1254 | jint data_len = 0; |
| 1255 | unsigned char* dex_data = nullptr; |
| 1256 | jvmtiError ret = OK; |
| 1257 | std::string location; |
| 1258 | if ((ret = GetTransformationData(env, |
| 1259 | klass, |
| 1260 | /*out*/&location, |
| 1261 | /*out*/&jni_env, |
| 1262 | /*out*/&loader, |
| 1263 | /*out*/&name, |
| 1264 | /*out*/&protection_domain, |
| 1265 | /*out*/&data_len, |
| 1266 | /*out*/&dex_data)) != OK) { |
| 1267 | // TODO Do something more here? Maybe give log statements? |
| 1268 | return ret; |
| 1269 | } |
| 1270 | jint new_data_len = 0; |
| 1271 | unsigned char* new_dex_data = nullptr; |
| 1272 | hook(env, |
| 1273 | jni_env, |
| 1274 | klass, |
| 1275 | loader, |
| 1276 | name.c_str(), |
| 1277 | protection_domain, |
| 1278 | data_len, |
| 1279 | dex_data, |
| 1280 | /*out*/&new_data_len, |
| 1281 | /*out*/&new_dex_data); |
| 1282 | // Check if anything actually changed. |
| 1283 | if ((new_data_len != 0 || new_dex_data != nullptr) && new_dex_data != dex_data) { |
Alex Light | 0e69273 | 2017-01-10 15:00:05 -0800 | [diff] [blame] | 1284 | jvmtiClassDefinition def = { klass, new_data_len, new_dex_data }; |
| 1285 | res = Redefiner::RedefineClasses(env, |
| 1286 | art::Runtime::Current(), |
| 1287 | art::Thread::Current(), |
| 1288 | 1, |
| 1289 | &def, |
| 1290 | &error); |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 1291 | env->Deallocate(new_dex_data); |
| 1292 | } |
| 1293 | // Deallocate the old dex data. |
| 1294 | env->Deallocate(dex_data); |
Alex Light | a01de59 | 2016-11-15 10:43:06 -0800 | [diff] [blame] | 1295 | if (res != OK) { |
| 1296 | LOG(ERROR) << "FAILURE TO REDEFINE " << error; |
| 1297 | return res; |
| 1298 | } |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 1299 | } |
| 1300 | return OK; |
| 1301 | } |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1302 | }; |
| 1303 | |
| 1304 | static bool IsJvmtiVersion(jint version) { |
| 1305 | return version == JVMTI_VERSION_1 || |
| 1306 | version == JVMTI_VERSION_1_0 || |
| 1307 | version == JVMTI_VERSION_1_1 || |
| 1308 | version == JVMTI_VERSION_1_2 || |
| 1309 | version == JVMTI_VERSION; |
| 1310 | } |
| 1311 | |
| 1312 | // Creates a jvmtiEnv and returns it with the art::ti::Env that is associated with it. new_art_ti |
| 1313 | // is a pointer to the uninitialized memory for an art::ti::Env. |
| 1314 | static void CreateArtJvmTiEnv(art::JavaVMExt* vm, /*out*/void** new_jvmtiEnv) { |
| 1315 | struct ArtJvmTiEnv* env = new ArtJvmTiEnv(vm); |
| 1316 | *new_jvmtiEnv = env; |
Andreas Gampe | 77708d9 | 2016-10-07 11:48:21 -0700 | [diff] [blame] | 1317 | |
| 1318 | gEventHandler.RegisterArtJvmTiEnv(env); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1319 | } |
| 1320 | |
| 1321 | // A hook that the runtime uses to allow plugins to handle GetEnv calls. It returns true and |
| 1322 | // places the return value in 'env' if this library can handle the GetEnv request. Otherwise |
| 1323 | // returns false and does not modify the 'env' pointer. |
| 1324 | static jint GetEnvHandler(art::JavaVMExt* vm, /*out*/void** env, jint version) { |
| 1325 | if (IsJvmtiVersion(version)) { |
| 1326 | CreateArtJvmTiEnv(vm, env); |
| 1327 | return JNI_OK; |
| 1328 | } else { |
| 1329 | printf("version 0x%x is not valid!", version); |
| 1330 | return JNI_EVERSION; |
| 1331 | } |
| 1332 | } |
| 1333 | |
| 1334 | // The plugin initialization function. This adds the jvmti environment. |
| 1335 | extern "C" bool ArtPlugin_Initialize() { |
Andreas Gampe | e08a2be | 2016-10-06 13:13:30 -0700 | [diff] [blame] | 1336 | art::Runtime* runtime = art::Runtime::Current(); |
| 1337 | runtime->GetJavaVM()->AddEnvironmentHook(GetEnvHandler); |
| 1338 | runtime->AddSystemWeakHolder(&gObjectTagTable); |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1339 | return true; |
| 1340 | } |
| 1341 | |
| 1342 | // The actual struct holding all of the entrypoints into the jvmti interface. |
| 1343 | const jvmtiInterface_1 gJvmtiInterface = { |
Alex Light | 9c20a14 | 2016-08-23 15:05:12 -0700 | [diff] [blame] | 1344 | // SPECIAL FUNCTION: RetransformClassWithHook Is normally reserved1 |
| 1345 | // TODO Remove once we have events working. |
| 1346 | reinterpret_cast<void*>(JvmtiFunctions::RetransformClassWithHook), |
| 1347 | // nullptr, // reserved1 |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1348 | JvmtiFunctions::SetEventNotificationMode, |
Alex Light | 0e69273 | 2017-01-10 15:00:05 -0800 | [diff] [blame] | 1349 | nullptr, // reserved3 |
Alex Light | 49948e9 | 2016-08-11 15:35:28 -0700 | [diff] [blame] | 1350 | JvmtiFunctions::GetAllThreads, |
| 1351 | JvmtiFunctions::SuspendThread, |
| 1352 | JvmtiFunctions::ResumeThread, |
| 1353 | JvmtiFunctions::StopThread, |
| 1354 | JvmtiFunctions::InterruptThread, |
| 1355 | JvmtiFunctions::GetThreadInfo, |
| 1356 | JvmtiFunctions::GetOwnedMonitorInfo, // 10 |
| 1357 | JvmtiFunctions::GetCurrentContendedMonitor, |
| 1358 | JvmtiFunctions::RunAgentThread, |
| 1359 | JvmtiFunctions::GetTopThreadGroups, |
| 1360 | JvmtiFunctions::GetThreadGroupInfo, |
| 1361 | JvmtiFunctions::GetThreadGroupChildren, |
| 1362 | JvmtiFunctions::GetFrameCount, |
| 1363 | JvmtiFunctions::GetThreadState, |
| 1364 | JvmtiFunctions::GetCurrentThread, |
| 1365 | JvmtiFunctions::GetFrameLocation, |
| 1366 | JvmtiFunctions::NotifyFramePop, // 20 |
| 1367 | JvmtiFunctions::GetLocalObject, |
| 1368 | JvmtiFunctions::GetLocalInt, |
| 1369 | JvmtiFunctions::GetLocalLong, |
| 1370 | JvmtiFunctions::GetLocalFloat, |
| 1371 | JvmtiFunctions::GetLocalDouble, |
| 1372 | JvmtiFunctions::SetLocalObject, |
| 1373 | JvmtiFunctions::SetLocalInt, |
| 1374 | JvmtiFunctions::SetLocalLong, |
| 1375 | JvmtiFunctions::SetLocalFloat, |
| 1376 | JvmtiFunctions::SetLocalDouble, // 30 |
| 1377 | JvmtiFunctions::CreateRawMonitor, |
| 1378 | JvmtiFunctions::DestroyRawMonitor, |
| 1379 | JvmtiFunctions::RawMonitorEnter, |
| 1380 | JvmtiFunctions::RawMonitorExit, |
| 1381 | JvmtiFunctions::RawMonitorWait, |
| 1382 | JvmtiFunctions::RawMonitorNotify, |
| 1383 | JvmtiFunctions::RawMonitorNotifyAll, |
| 1384 | JvmtiFunctions::SetBreakpoint, |
| 1385 | JvmtiFunctions::ClearBreakpoint, |
| 1386 | nullptr, // reserved40 |
| 1387 | JvmtiFunctions::SetFieldAccessWatch, |
| 1388 | JvmtiFunctions::ClearFieldAccessWatch, |
| 1389 | JvmtiFunctions::SetFieldModificationWatch, |
| 1390 | JvmtiFunctions::ClearFieldModificationWatch, |
| 1391 | JvmtiFunctions::IsModifiableClass, |
| 1392 | JvmtiFunctions::Allocate, |
| 1393 | JvmtiFunctions::Deallocate, |
| 1394 | JvmtiFunctions::GetClassSignature, |
| 1395 | JvmtiFunctions::GetClassStatus, |
| 1396 | JvmtiFunctions::GetSourceFileName, // 50 |
| 1397 | JvmtiFunctions::GetClassModifiers, |
| 1398 | JvmtiFunctions::GetClassMethods, |
| 1399 | JvmtiFunctions::GetClassFields, |
| 1400 | JvmtiFunctions::GetImplementedInterfaces, |
| 1401 | JvmtiFunctions::IsInterface, |
| 1402 | JvmtiFunctions::IsArrayClass, |
| 1403 | JvmtiFunctions::GetClassLoader, |
| 1404 | JvmtiFunctions::GetObjectHashCode, |
| 1405 | JvmtiFunctions::GetObjectMonitorUsage, |
| 1406 | JvmtiFunctions::GetFieldName, // 60 |
| 1407 | JvmtiFunctions::GetFieldDeclaringClass, |
| 1408 | JvmtiFunctions::GetFieldModifiers, |
| 1409 | JvmtiFunctions::IsFieldSynthetic, |
| 1410 | JvmtiFunctions::GetMethodName, |
| 1411 | JvmtiFunctions::GetMethodDeclaringClass, |
| 1412 | JvmtiFunctions::GetMethodModifiers, |
| 1413 | nullptr, // reserved67 |
| 1414 | JvmtiFunctions::GetMaxLocals, |
| 1415 | JvmtiFunctions::GetArgumentsSize, |
| 1416 | JvmtiFunctions::GetLineNumberTable, // 70 |
| 1417 | JvmtiFunctions::GetMethodLocation, |
| 1418 | JvmtiFunctions::GetLocalVariableTable, |
| 1419 | JvmtiFunctions::SetNativeMethodPrefix, |
| 1420 | JvmtiFunctions::SetNativeMethodPrefixes, |
| 1421 | JvmtiFunctions::GetBytecodes, |
| 1422 | JvmtiFunctions::IsMethodNative, |
| 1423 | JvmtiFunctions::IsMethodSynthetic, |
| 1424 | JvmtiFunctions::GetLoadedClasses, |
| 1425 | JvmtiFunctions::GetClassLoaderClasses, |
| 1426 | JvmtiFunctions::PopFrame, // 80 |
| 1427 | JvmtiFunctions::ForceEarlyReturnObject, |
| 1428 | JvmtiFunctions::ForceEarlyReturnInt, |
| 1429 | JvmtiFunctions::ForceEarlyReturnLong, |
| 1430 | JvmtiFunctions::ForceEarlyReturnFloat, |
| 1431 | JvmtiFunctions::ForceEarlyReturnDouble, |
| 1432 | JvmtiFunctions::ForceEarlyReturnVoid, |
| 1433 | JvmtiFunctions::RedefineClasses, |
| 1434 | JvmtiFunctions::GetVersionNumber, |
| 1435 | JvmtiFunctions::GetCapabilities, |
| 1436 | JvmtiFunctions::GetSourceDebugExtension, // 90 |
| 1437 | JvmtiFunctions::IsMethodObsolete, |
| 1438 | JvmtiFunctions::SuspendThreadList, |
| 1439 | JvmtiFunctions::ResumeThreadList, |
| 1440 | nullptr, // reserved94 |
| 1441 | nullptr, // reserved95 |
| 1442 | nullptr, // reserved96 |
| 1443 | nullptr, // reserved97 |
| 1444 | nullptr, // reserved98 |
| 1445 | nullptr, // reserved99 |
| 1446 | JvmtiFunctions::GetAllStackTraces, // 100 |
| 1447 | JvmtiFunctions::GetThreadListStackTraces, |
| 1448 | JvmtiFunctions::GetThreadLocalStorage, |
| 1449 | JvmtiFunctions::SetThreadLocalStorage, |
| 1450 | JvmtiFunctions::GetStackTrace, |
| 1451 | nullptr, // reserved105 |
| 1452 | JvmtiFunctions::GetTag, |
| 1453 | JvmtiFunctions::SetTag, |
| 1454 | JvmtiFunctions::ForceGarbageCollection, |
| 1455 | JvmtiFunctions::IterateOverObjectsReachableFromObject, |
| 1456 | JvmtiFunctions::IterateOverReachableObjects, // 110 |
| 1457 | JvmtiFunctions::IterateOverHeap, |
| 1458 | JvmtiFunctions::IterateOverInstancesOfClass, |
| 1459 | nullptr, // reserved113 |
| 1460 | JvmtiFunctions::GetObjectsWithTags, |
| 1461 | JvmtiFunctions::FollowReferences, |
| 1462 | JvmtiFunctions::IterateThroughHeap, |
| 1463 | nullptr, // reserved117 |
| 1464 | nullptr, // reserved118 |
| 1465 | nullptr, // reserved119 |
| 1466 | JvmtiFunctions::SetJNIFunctionTable, // 120 |
| 1467 | JvmtiFunctions::GetJNIFunctionTable, |
| 1468 | JvmtiFunctions::SetEventCallbacks, |
| 1469 | JvmtiFunctions::GenerateEvents, |
| 1470 | JvmtiFunctions::GetExtensionFunctions, |
| 1471 | JvmtiFunctions::GetExtensionEvents, |
| 1472 | JvmtiFunctions::SetExtensionEventCallback, |
| 1473 | JvmtiFunctions::DisposeEnvironment, |
| 1474 | JvmtiFunctions::GetErrorName, |
| 1475 | JvmtiFunctions::GetJLocationFormat, |
| 1476 | JvmtiFunctions::GetSystemProperties, // 130 |
| 1477 | JvmtiFunctions::GetSystemProperty, |
| 1478 | JvmtiFunctions::SetSystemProperty, |
| 1479 | JvmtiFunctions::GetPhase, |
| 1480 | JvmtiFunctions::GetCurrentThreadCpuTimerInfo, |
| 1481 | JvmtiFunctions::GetCurrentThreadCpuTime, |
| 1482 | JvmtiFunctions::GetThreadCpuTimerInfo, |
| 1483 | JvmtiFunctions::GetThreadCpuTime, |
| 1484 | JvmtiFunctions::GetTimerInfo, |
| 1485 | JvmtiFunctions::GetTime, |
| 1486 | JvmtiFunctions::GetPotentialCapabilities, // 140 |
| 1487 | nullptr, // reserved141 |
| 1488 | JvmtiFunctions::AddCapabilities, |
| 1489 | JvmtiFunctions::RelinquishCapabilities, |
| 1490 | JvmtiFunctions::GetAvailableProcessors, |
| 1491 | JvmtiFunctions::GetClassVersionNumbers, |
| 1492 | JvmtiFunctions::GetConstantPool, |
| 1493 | JvmtiFunctions::GetEnvironmentLocalStorage, |
| 1494 | JvmtiFunctions::SetEnvironmentLocalStorage, |
| 1495 | JvmtiFunctions::AddToBootstrapClassLoaderSearch, |
| 1496 | JvmtiFunctions::SetVerboseFlag, // 150 |
| 1497 | JvmtiFunctions::AddToSystemClassLoaderSearch, |
| 1498 | JvmtiFunctions::RetransformClasses, |
| 1499 | JvmtiFunctions::GetOwnedMonitorStackDepthInfo, |
| 1500 | JvmtiFunctions::GetObjectSize, |
| 1501 | JvmtiFunctions::GetLocalInstance, |
| 1502 | }; |
| 1503 | |
| 1504 | }; // namespace openjdkjvmti |