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