|
|
8f84c8 |
# HG changeset patch
|
|
|
8f84c8 |
# User dsamersoff
|
|
|
8f84c8 |
# Date 1409228402 25200
|
|
|
8f84c8 |
# Thu Aug 28 05:20:02 2014 -0700
|
|
|
8f84c8 |
# Node ID f4c9545cd8a56a5fab74c95de3573623ba2b83c4
|
|
|
8f84c8 |
# Parent 13411144d46b50d0087f35eca2b8e827aae558f1
|
|
|
8f84c8 |
8049226, PR2960: com/sun/jdi/OptionTest.java test times out again
|
|
|
8f84c8 |
Summary: Don't call jni_FatalError if transport initialization fails
|
|
|
8f84c8 |
Reviewed-by: sspitsyn, sla
|
|
|
8f84c8 |
|
|
|
8f84c8 |
diff -r 13411144d46b -r f4c9545cd8a5 src/share/back/debugInit.c
|
|
|
8f84c8 |
--- openjdk/jdk/src/share/back/debugInit.c Wed Jun 18 03:29:58 2014 -0700
|
|
|
8f84c8 |
+++ openjdk/jdk/src/share/back/debugInit.c Thu Aug 28 05:20:02 2014 -0700
|
|
|
8f84c8 |
@@ -1013,7 +1013,7 @@
|
|
|
8f84c8 |
atexit_finish_logging(void)
|
|
|
8f84c8 |
{
|
|
|
8f84c8 |
/* Normal exit(0) (not _exit()) may only reach here */
|
|
|
8f84c8 |
- finish_logging(0); /* Only first call matters */
|
|
|
8f84c8 |
+ finish_logging(); /* Only first call matters */
|
|
|
8f84c8 |
}
|
|
|
8f84c8 |
|
|
|
8f84c8 |
static jboolean
|
|
|
8f84c8 |
@@ -1301,43 +1301,49 @@
|
|
|
8f84c8 |
void
|
|
|
8f84c8 |
debugInit_exit(jvmtiError error, const char *msg)
|
|
|
8f84c8 |
{
|
|
|
8f84c8 |
- int exit_code = 0;
|
|
|
8f84c8 |
+ enum exit_codes { EXIT_NO_ERRORS = 0, EXIT_JVMTI_ERROR = 1, EXIT_TRANSPORT_ERROR = 2 };
|
|
|
8f84c8 |
|
|
|
8f84c8 |
- /* Pick an error code */
|
|
|
8f84c8 |
- if ( error != JVMTI_ERROR_NONE ) {
|
|
|
8f84c8 |
- exit_code = 1;
|
|
|
8f84c8 |
- if ( docoredump ) {
|
|
|
8f84c8 |
- LOG_MISC(("Dumping core as requested by command line"));
|
|
|
8f84c8 |
- finish_logging(exit_code);
|
|
|
8f84c8 |
- abort();
|
|
|
8f84c8 |
- }
|
|
|
8f84c8 |
+ // Prepare to exit. Log error and finish logging
|
|
|
8f84c8 |
+ LOG_MISC(("Exiting with error %s(%d): %s", jvmtiErrorText(error), error,
|
|
|
8f84c8 |
+ ((msg == NULL) ? "" : msg)));
|
|
|
8f84c8 |
+
|
|
|
8f84c8 |
+ // coredump requested by command line. Keep JVMTI data dirty
|
|
|
8f84c8 |
+ if (error != JVMTI_ERROR_NONE && docoredump) {
|
|
|
8f84c8 |
+ LOG_MISC(("Dumping core as requested by command line"));
|
|
|
8f84c8 |
+ finish_logging();
|
|
|
8f84c8 |
+ abort();
|
|
|
8f84c8 |
}
|
|
|
8f84c8 |
|
|
|
8f84c8 |
- if ( msg==NULL ) {
|
|
|
8f84c8 |
- msg = "";
|
|
|
8f84c8 |
- }
|
|
|
8f84c8 |
+ finish_logging();
|
|
|
8f84c8 |
|
|
|
8f84c8 |
- LOG_MISC(("Exiting with error %s(%d): %s", jvmtiErrorText(error), error, msg));
|
|
|
8f84c8 |
-
|
|
|
8f84c8 |
+ // Cleanup the JVMTI if we have one
|
|
|
8f84c8 |
if (gdata != NULL) {
|
|
|
8f84c8 |
gdata->vmDead = JNI_TRUE;
|
|
|
8f84c8 |
-
|
|
|
8f84c8 |
- /* Let's try and cleanup the JVMTI, if we even have one */
|
|
|
8f84c8 |
- if ( gdata->jvmti != NULL ) {
|
|
|
8f84c8 |
- /* Dispose of jvmti (gdata->jvmti becomes NULL) */
|
|
|
8f84c8 |
+ if (gdata->jvmti != NULL) {
|
|
|
8f84c8 |
+ // Dispose of jvmti (gdata->jvmti becomes NULL)
|
|
|
8f84c8 |
disposeEnvironment(gdata->jvmti);
|
|
|
8f84c8 |
}
|
|
|
8f84c8 |
}
|
|
|
8f84c8 |
|
|
|
8f84c8 |
- /* Finish up logging. We reach here if JDWP is doing the exiting. */
|
|
|
8f84c8 |
- finish_logging(exit_code); /* Only first call matters */
|
|
|
8f84c8 |
-
|
|
|
8f84c8 |
- /* Let's give the JNI a FatalError if non-exit 0, which is historic way */
|
|
|
8f84c8 |
- if ( exit_code != 0 ) {
|
|
|
8f84c8 |
- JNIEnv *env = NULL;
|
|
|
8f84c8 |
- jniFatalError(env, msg, error, exit_code);
|
|
|
8f84c8 |
+ // We are here with no errors. Kill entire process and exit with zero exit code
|
|
|
8f84c8 |
+ if (error == JVMTI_ERROR_NONE) {
|
|
|
8f84c8 |
+ forceExit(EXIT_NO_ERRORS);
|
|
|
8f84c8 |
+ return;
|
|
|
8f84c8 |
}
|
|
|
8f84c8 |
|
|
|
8f84c8 |
- /* Last chance to die, this kills the entire process. */
|
|
|
8f84c8 |
- forceExit(exit_code);
|
|
|
8f84c8 |
+ // No transport initilized.
|
|
|
8f84c8 |
+ // As we don't have any details here exiting with separate exit code
|
|
|
8f84c8 |
+ if (error == AGENT_ERROR_TRANSPORT_INIT) {
|
|
|
8f84c8 |
+ forceExit(EXIT_TRANSPORT_ERROR);
|
|
|
8f84c8 |
+ return;
|
|
|
8f84c8 |
+ }
|
|
|
8f84c8 |
+
|
|
|
8f84c8 |
+ // We have JVMTI error. Call hotspot jni_FatalError handler
|
|
|
8f84c8 |
+ jniFatalError(NULL, msg, error, EXIT_JVMTI_ERROR);
|
|
|
8f84c8 |
+
|
|
|
8f84c8 |
+ // hotspot calls os:abort() so we should never reach code below,
|
|
|
8f84c8 |
+ // but guard against possible hotspot changes
|
|
|
8f84c8 |
+
|
|
|
8f84c8 |
+ // Last chance to die, this kills the entire process.
|
|
|
8f84c8 |
+ forceExit(EXIT_JVMTI_ERROR);
|
|
|
8f84c8 |
}
|
|
|
8f84c8 |
diff -r 13411144d46b -r f4c9545cd8a5 src/share/back/log_messages.c
|
|
|
8f84c8 |
--- openjdk/jdk/src/share/back/log_messages.c Wed Jun 18 03:29:58 2014 -0700
|
|
|
8f84c8 |
+++ openjdk/jdk/src/share/back/log_messages.c Thu Aug 28 05:20:02 2014 -0700
|
|
|
8f84c8 |
@@ -230,7 +230,7 @@
|
|
|
8f84c8 |
|
|
|
8f84c8 |
/* Finish up logging, flush output to the logfile. */
|
|
|
8f84c8 |
void
|
|
|
8f84c8 |
-finish_logging(int exit_code)
|
|
|
8f84c8 |
+finish_logging()
|
|
|
8f84c8 |
{
|
|
|
8f84c8 |
#ifdef JDWP_LOGGING
|
|
|
8f84c8 |
MUTEX_LOCK(my_mutex);
|
|
|
8f84c8 |
diff -r 13411144d46b -r f4c9545cd8a5 src/share/back/log_messages.h
|
|
|
8f84c8 |
--- openjdk/jdk/src/share/back/log_messages.h Wed Jun 18 03:29:58 2014 -0700
|
|
|
8f84c8 |
+++ openjdk/jdk/src/share/back/log_messages.h Thu Aug 28 05:20:02 2014 -0700
|
|
|
8f84c8 |
@@ -29,7 +29,7 @@
|
|
|
8f84c8 |
/* LOG: Must be called like: LOG_category(("anything")) or LOG_category((format,args)) */
|
|
|
8f84c8 |
|
|
|
8f84c8 |
void setup_logging(const char *, unsigned);
|
|
|
8f84c8 |
-void finish_logging(int);
|
|
|
8f84c8 |
+void finish_logging();
|
|
|
8f84c8 |
|
|
|
8f84c8 |
#define LOG_NULL ((void)0)
|
|
|
8f84c8 |
|