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_stack.cc b/openjdkjvmti/ti_stack.cc
index 1279f3b..5de4a81 100644
--- a/openjdkjvmti/ti_stack.cc
+++ b/openjdkjvmti/ti_stack.cc
@@ -57,6 +57,7 @@
#include "nativehelper/scoped_local_ref.h"
#include "scoped_thread_state_change-inl.h"
#include "stack.h"
+#include "ti_logging.h"
#include "ti_thread.h"
#include "thread-current-inl.h"
#include "thread_list.h"
@@ -1097,7 +1098,7 @@
} while (true);
}
-jvmtiError StackUtil::PopFrame(jvmtiEnv* env ATTRIBUTE_UNUSED, jthread thread) {
+jvmtiError StackUtil::PopFrame(jvmtiEnv* env, jthread thread) {
art::Thread* self = art::Thread::Current();
art::Thread* target;
do {
@@ -1131,9 +1132,10 @@
tls_data->disable_pop_frame_depth != JvmtiGlobalTLSData::kNoDisallowedPopFrame &&
tls_data->disable_pop_frame_depth == art::StackVisitor::ComputeNumFrames(target,
kWalkKind)) {
- LOG(WARNING) << "Disallowing frame pop due to in-progress class-load/prepare. Frame at depth "
- << tls_data->disable_pop_frame_depth << " was marked as un-poppable by the "
- << "jvmti plugin. See b/117615146 for more information.";
+ JVMTI_LOG(WARNING, env) << "Disallowing frame pop due to in-progress class-load/prepare. "
+ << "Frame at depth " << tls_data->disable_pop_frame_depth << " was "
+ << "marked as un-poppable by the jvmti plugin. See b/117615146 for "
+ << "more information.";
return ERR(OPAQUE_FRAME);
}
// We hold the user_code_suspension_lock_ so the target thread is staying suspended until we are