Add a get_last_error_message JVMTI extension.
This adds a com.android.art.misc.get_last_error_message and
com.android.art.misc.clear_last_error_message extension functions.
These allow one to get some error messages that were previously only
exposed through logcat. Not all error messages are exposed. Only
exposes error messages associated with the exact jvmtiEnv used. Errors
must be cleared manually. Not all error conditions will update the
saved error-message.
Bug: 117234143
Test: ./test.py --host
Change-Id: I75b6de9029791035f56c0c63d8958edea500715d
diff --git a/openjdkjvmti/ti_search.cc b/openjdkjvmti/ti_search.cc
index 427869e..2187825 100644
--- a/openjdkjvmti/ti_search.cc
+++ b/openjdkjvmti/ti_search.cc
@@ -52,6 +52,7 @@
#include "scoped_thread_state_change-inl.h"
#include "thread-current-inl.h"
#include "thread_list.h"
+#include "ti_logging.h"
#include "ti_phase.h"
#include "well_known_classes.h"
@@ -213,7 +214,7 @@
runtime->GetRuntimeCallbacks()->RemoveRuntimePhaseCallback(&gSearchCallback);
}
-jvmtiError SearchUtil::AddToBootstrapClassLoaderSearch(jvmtiEnv* env ATTRIBUTE_UNUSED,
+jvmtiError SearchUtil::AddToBootstrapClassLoaderSearch(jvmtiEnv* env,
const char* segment) {
art::Runtime* current = art::Runtime::Current();
if (current == nullptr) {
@@ -235,7 +236,8 @@
/* verify_checksum= */ true,
&error_msg,
&dex_files)) {
- LOG(WARNING) << "Could not open " << segment << " for boot classpath extension: " << error_msg;
+ JVMTI_LOG(WARNING, env) << "Could not open " << segment << " for boot classpath extension: "
+ << error_msg;
return ERR(ILLEGAL_ARGUMENT);
}