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