13f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe/* 23f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe * Copyright (C) 2017 The Android Open Source Project 33f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe * 43f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe * Licensed under the Apache License, Version 2.0 (the "License"); 53f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe * you may not use this file except in compliance with the License. 63f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe * You may obtain a copy of the License at 73f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe * 83f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe * http://www.apache.org/licenses/LICENSE-2.0 93f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe * 103f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe * Unless required by applicable law or agreed to in writing, software 113f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe * distributed under the License is distributed on an "AS IS" BASIS, 123f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 133f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe * See the License for the specific language governing permissions and 143f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe * limitations under the License. 153f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe */ 163f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe 173f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe#include "jvmti_helper.h" 1847d49b842a87823df6ffda30bb21bd6d8e4d8641Alex Light#include "test_env.h" 193f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe 203f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe#include <dlfcn.h> 218cf9cb386cd9286d67e879f1ee501ec00d72a4e1Andreas Gampe 228cf9cb386cd9286d67e879f1ee501ec00d72a4e1Andreas Gampe#include <algorithm> 238cf9cb386cd9286d67e879f1ee501ec00d72a4e1Andreas Gampe#include <cstdio> 248cf9cb386cd9286d67e879f1ee501ec00d72a4e1Andreas Gampe#include <cstring> 253f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe#include <sstream> 263f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe 273f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe#include "android-base/logging.h" 283f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe#include "scoped_local_ref.h" 293f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe 303f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampenamespace art { 313f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe 323f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampevoid CheckJvmtiError(jvmtiEnv* env, jvmtiError error) { 333f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe if (error != JVMTI_ERROR_NONE) { 343f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe char* error_name; 353f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe jvmtiError name_error = env->GetErrorName(error, &error_name); 363f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe if (name_error != JVMTI_ERROR_NONE) { 373f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe LOG(FATAL) << "Unable to get error name for " << error; 383f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe } 393f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe LOG(FATAL) << "Unexpected error: " << error_name; 403f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe } 413f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe} 423f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe 433d324fdb9b43742d851aec681846b67203a536f0Alex Light// These are a set of capabilities we will enable in all situations. These are chosen since they 443d324fdb9b43742d851aec681846b67203a536f0Alex Light// will not affect the runtime in any significant way if they are enabled. 453d324fdb9b43742d851aec681846b67203a536f0Alex Lightstatic const jvmtiCapabilities standard_caps = { 463d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_tag_objects = 1, 473d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_field_modification_events = 1, 483d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_field_access_events = 1, 493d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_get_bytecodes = 1, 503d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_get_synthetic_attribute = 1, 513d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_get_owned_monitor_info = 0, 5241006c6e8c0c5132a22bb7e100b6cd545dbb55a6Alex Light .can_get_current_contended_monitor = 1, 53ce56864b347983155a6b810c19eaa8297d77be96Alex Light .can_get_monitor_info = 1, 543d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_pop_frame = 0, 553d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_redefine_classes = 1, 5654d39dc42630cd83f2d1bec5704805febb894819Alex Light .can_signal_thread = 1, 573d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_get_source_file_name = 1, 583d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_get_line_numbers = 1, 593d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_get_source_debug_extension = 1, 603d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_access_local_variables = 0, 61b566fed9ac194014c5caed40c32730bd7c5d7242Alex Light .can_maintain_original_method_order = 1, 623d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_single_step_events = 1, 633d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_exception_events = 0, 643d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_frame_pop_events = 0, 653d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_breakpoint_events = 1, 663d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_suspend = 1, 673d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_redefine_any_class = 0, 683d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_get_current_thread_cpu_time = 0, 693d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_get_thread_cpu_time = 0, 703d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_method_entry_events = 1, 713d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_method_exit_events = 1, 723d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_all_class_hook_events = 0, 733d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_compiled_method_load_events = 0, 743d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_monitor_events = 0, 753d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_vm_object_alloc_events = 1, 763d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_native_method_bind_events = 1, 773d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_garbage_collection_events = 1, 783d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_object_free_events = 1, 793d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_force_early_return = 0, 803d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_get_owned_monitor_stack_depth_info = 0, 813d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_get_constant_pool = 0, 823d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_set_native_method_prefix = 0, 833d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_retransform_classes = 1, 843d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_retransform_any_class = 0, 853d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_resource_exhaustion_heap_events = 0, 863d324fdb9b43742d851aec681846b67203a536f0Alex Light .can_generate_resource_exhaustion_threads_events = 0, 873d324fdb9b43742d851aec681846b67203a536f0Alex Light}; 883d324fdb9b43742d851aec681846b67203a536f0Alex Light 893d324fdb9b43742d851aec681846b67203a536f0Alex LightjvmtiCapabilities GetStandardCapabilities() { 903d324fdb9b43742d851aec681846b67203a536f0Alex Light return standard_caps; 913d324fdb9b43742d851aec681846b67203a536f0Alex Light} 923d324fdb9b43742d851aec681846b67203a536f0Alex Light 933d324fdb9b43742d851aec681846b67203a536f0Alex Lightvoid SetStandardCapabilities(jvmtiEnv* env) { 9447d49b842a87823df6ffda30bb21bd6d8e4d8641Alex Light if (IsJVM()) { 9547d49b842a87823df6ffda30bb21bd6d8e4d8641Alex Light // RI is more strict about adding capabilities at runtime then ART so just give it everything. 9647d49b842a87823df6ffda30bb21bd6d8e4d8641Alex Light SetAllCapabilities(env); 9747d49b842a87823df6ffda30bb21bd6d8e4d8641Alex Light return; 9847d49b842a87823df6ffda30bb21bd6d8e4d8641Alex Light } 993d324fdb9b43742d851aec681846b67203a536f0Alex Light jvmtiCapabilities caps = GetStandardCapabilities(); 1003d324fdb9b43742d851aec681846b67203a536f0Alex Light CheckJvmtiError(env, env->AddCapabilities(&caps)); 1013d324fdb9b43742d851aec681846b67203a536f0Alex Light} 1023d324fdb9b43742d851aec681846b67203a536f0Alex Light 1033f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampevoid SetAllCapabilities(jvmtiEnv* env) { 1043f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe jvmtiCapabilities caps; 1053d324fdb9b43742d851aec681846b67203a536f0Alex Light CheckJvmtiError(env, env->GetPotentialCapabilities(&caps)); 1063d324fdb9b43742d851aec681846b67203a536f0Alex Light CheckJvmtiError(env, env->AddCapabilities(&caps)); 1073f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe} 1083f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe 10947d49b842a87823df6ffda30bb21bd6d8e4d8641Alex Lightbool JvmtiErrorToException(JNIEnv* env, jvmtiEnv* jvmtienv, jvmtiError error) { 1103f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe if (error == JVMTI_ERROR_NONE) { 1113f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return false; 1123f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe } 1133f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe 1143f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe ScopedLocalRef<jclass> rt_exception(env, env->FindClass("java/lang/RuntimeException")); 1153f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe if (rt_exception.get() == nullptr) { 1163f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe // CNFE should be pending. 1173f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return true; 1183f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe } 1193f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe 1203f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe char* err; 12147d49b842a87823df6ffda30bb21bd6d8e4d8641Alex Light CheckJvmtiError(jvmtienv, jvmtienv->GetErrorName(error, &err)); 1223f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe 1233f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe env->ThrowNew(rt_exception.get(), err); 1243f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe 12547d49b842a87823df6ffda30bb21bd6d8e4d8641Alex Light Deallocate(jvmtienv, err); 1263f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return true; 1273f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe} 1283f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe 1293f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampestd::ostream& operator<<(std::ostream& os, const jvmtiError& rhs) { 1303f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe switch (rhs) { 1313f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_NONE: 1323f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "NONE"; 1333f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_INVALID_THREAD: 1343f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "INVALID_THREAD"; 1353f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_INVALID_THREAD_GROUP: 1363f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "INVALID_THREAD_GROUP"; 1373f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_INVALID_PRIORITY: 1383f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "INVALID_PRIORITY"; 1393f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_THREAD_NOT_SUSPENDED: 1403f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "THREAD_NOT_SUSPENDED"; 1413f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_THREAD_SUSPENDED: 1423f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "THREAD_SUSPENDED"; 1433f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_THREAD_NOT_ALIVE: 1443f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "THREAD_NOT_ALIVE"; 1453f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_INVALID_OBJECT: 1463f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "INVALID_OBJECT"; 1473f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_INVALID_CLASS: 1483f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "INVALID_CLASS"; 1493f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_CLASS_NOT_PREPARED: 1503f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "CLASS_NOT_PREPARED"; 1513f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_INVALID_METHODID: 1523f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "INVALID_METHODID"; 1533f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_INVALID_LOCATION: 1543f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "INVALID_LOCATION"; 1553f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_INVALID_FIELDID: 1563f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "INVALID_FIELDID"; 1573f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_NO_MORE_FRAMES: 1583f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "NO_MORE_FRAMES"; 1593f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_OPAQUE_FRAME: 1603f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "OPAQUE_FRAME"; 1613f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_TYPE_MISMATCH: 1623f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "TYPE_MISMATCH"; 1633f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_INVALID_SLOT: 1643f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "INVALID_SLOT"; 1653f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_DUPLICATE: 1663f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "DUPLICATE"; 1673f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_NOT_FOUND: 1683f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "NOT_FOUND"; 1693f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_INVALID_MONITOR: 1703f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "INVALID_MONITOR"; 1713f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_NOT_MONITOR_OWNER: 1723f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "NOT_MONITOR_OWNER"; 1733f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_INTERRUPT: 1743f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "INTERRUPT"; 1753f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_INVALID_CLASS_FORMAT: 1763f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "INVALID_CLASS_FORMAT"; 1773f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION: 1783f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "CIRCULAR_CLASS_DEFINITION"; 1793f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_FAILS_VERIFICATION: 1803f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "FAILS_VERIFICATION"; 1813f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED: 1823f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "UNSUPPORTED_REDEFINITION_METHOD_ADDED"; 1833f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED: 1843f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED"; 1853f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_INVALID_TYPESTATE: 1863f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "INVALID_TYPESTATE"; 1873f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED: 1883f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED"; 1893f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED: 1903f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "UNSUPPORTED_REDEFINITION_METHOD_DELETED"; 1913f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_UNSUPPORTED_VERSION: 1923f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "UNSUPPORTED_VERSION"; 1933f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_NAMES_DONT_MATCH: 1943f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "NAMES_DONT_MATCH"; 1953f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED: 1963f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED"; 1973f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED: 1983f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED"; 1993f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_UNMODIFIABLE_CLASS: 2003f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "JVMTI_ERROR_UNMODIFIABLE_CLASS"; 2013f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_NOT_AVAILABLE: 2023f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "NOT_AVAILABLE"; 2033f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_MUST_POSSESS_CAPABILITY: 2043f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "MUST_POSSESS_CAPABILITY"; 2053f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_NULL_POINTER: 2063f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "NULL_POINTER"; 2073f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_ABSENT_INFORMATION: 2083f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "ABSENT_INFORMATION"; 2093f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_INVALID_EVENT_TYPE: 2103f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "INVALID_EVENT_TYPE"; 2113f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_ILLEGAL_ARGUMENT: 2123f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "ILLEGAL_ARGUMENT"; 2133f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_NATIVE_METHOD: 2143f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "NATIVE_METHOD"; 2153f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED: 2163f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "CLASS_LOADER_UNSUPPORTED"; 2173f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_OUT_OF_MEMORY: 2183f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "OUT_OF_MEMORY"; 2193f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_ACCESS_DENIED: 2203f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "ACCESS_DENIED"; 2213f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_WRONG_PHASE: 2223f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "WRONG_PHASE"; 2233f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_INTERNAL: 2243f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "INTERNAL"; 2253f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_UNATTACHED_THREAD: 2263f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "UNATTACHED_THREAD"; 2273f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe case JVMTI_ERROR_INVALID_ENVIRONMENT: 2283f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe return os << "INVALID_ENVIRONMENT"; 2293f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe } 2303f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe LOG(FATAL) << "Unexpected error type " << static_cast<int>(rhs); 2313f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe __builtin_unreachable(); 2323f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe} 2333f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe 2343f46c96568bef650ba6d9ce6ac8835d30877f243Andreas Gampe} // namespace art 235