/* * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
/* save last debugee status */
agent_data.last_debuggee_status = debuggeeStatus;
/* we don't enter if-stmt in second call */ if (agent_data.thread_state == NEW) { if (run_agent_thread(jni_env, jvmti_env) == NULL) { return result;
}
/* SP2.2-w - wait for agent thread */ while (agent_data.thread_state == NEW) {
monitor_locker.wait();
}
}
/* wait for sync permit */ /* we don't enter loop in first call */ while (agent_data.thread_state != WAITING && agent_data.thread_state != TERMINATED) { /* SP4.2-w - second wait for agent thread */
monitor_locker.wait();
}
if (agent_data.thread_state != TERMINATED) {
agent_data.thread_state = SUSPENDED; /* SP3.2-n - notify to start test */ /* SP6.2-n - notify to end test */
monitor_locker.notify();
} else {
COMPLAIN("Debuggee status sync aborted because agent thread has finished\n"); return result;
}
/* update status from debuggee */ if (debuggeeStatus != STATUS_PASSED) {
printf("FAIL: Status is %d\n", debuggeeStatus);
set_agent_fail_status();
}
while (agent_data.thread_state == SUSPENDED) { /* SP5.2-w - wait while testing */ /* SP7.2 - wait for agent end */
monitor_locker.wait();
}
agent_data.last_debuggee_status = get_agent_status();
result = agent_data.last_debuggee_status; return result;
}
/** Native function for Java code to provide sync point. */
JNIEXPORT jint JNICALL
Java_jdk_test_lib_jvmti_DebugeeClass_checkStatus(JNIEnv* jni_env, jclass cls, jint debuggeeStatus) {
jint status;
printf("Synchronization point checkStatus(%d) called.\n", debuggeeStatus);
status = sync_debuggee_status(jni_env, agent_jvmti_env, debuggeeStatus); return status;
}
/** Native function for Java code to reset agent data. */
JNIEXPORT void JNICALL
Java_jdk_test_lib_jvmti_DebugeeClass_resetAgentData(JNIEnv* jni, jclass cls) {
RawMonitorLocker monitor_locker(agent_jvmti_env, jni, agent_data.monitor); /* wait for agent_thread_wrapper() to finish */ while (agent_data.thread_state != TERMINATED) {
monitor_locker.wait(10);
}
agent_data.thread_state = NEW;
agent_data.last_debuggee_status = STATUS_PASSED;
}
}
#endif
Messung V0.5
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.