提交 7c7adb0a 编写于 作者: D dsamersoff

8049226: com/sun/jdi/OptionTest.java test times out again

Summary: Don't call jni_FatalError if transport initialization fails
Reviewed-by: sspitsyn, sla
上级 2142fd35
...@@ -1013,7 +1013,7 @@ static void ...@@ -1013,7 +1013,7 @@ static void
atexit_finish_logging(void) atexit_finish_logging(void)
{ {
/* Normal exit(0) (not _exit()) may only reach here */ /* Normal exit(0) (not _exit()) may only reach here */
finish_logging(0); /* Only first call matters */ finish_logging(); /* Only first call matters */
} }
static jboolean static jboolean
...@@ -1301,43 +1301,49 @@ bad_option_no_msg: ...@@ -1301,43 +1301,49 @@ bad_option_no_msg:
void void
debugInit_exit(jvmtiError error, const char *msg) debugInit_exit(jvmtiError error, const char *msg)
{ {
int exit_code = 0; enum exit_codes { EXIT_NO_ERRORS = 0, EXIT_JVMTI_ERROR = 1, EXIT_TRANSPORT_ERROR = 2 };
/* Pick an error code */ // Prepare to exit. Log error and finish logging
if ( error != JVMTI_ERROR_NONE ) { LOG_MISC(("Exiting with error %s(%d): %s", jvmtiErrorText(error), error,
exit_code = 1; ((msg == NULL) ? "" : msg)));
if ( docoredump ) {
// coredump requested by command line. Keep JVMTI data dirty
if (error != JVMTI_ERROR_NONE && docoredump) {
LOG_MISC(("Dumping core as requested by command line")); LOG_MISC(("Dumping core as requested by command line"));
finish_logging(exit_code); finish_logging();
abort(); abort();
} }
}
if ( msg==NULL ) { finish_logging();
msg = "";
}
LOG_MISC(("Exiting with error %s(%d): %s", jvmtiErrorText(error), error, msg));
// Cleanup the JVMTI if we have one
if (gdata != NULL) { if (gdata != NULL) {
gdata->vmDead = JNI_TRUE; gdata->vmDead = JNI_TRUE;
if (gdata->jvmti != NULL) {
/* Let's try and cleanup the JVMTI, if we even have one */ // Dispose of jvmti (gdata->jvmti becomes NULL)
if ( gdata->jvmti != NULL ) {
/* Dispose of jvmti (gdata->jvmti becomes NULL) */
disposeEnvironment(gdata->jvmti); disposeEnvironment(gdata->jvmti);
} }
} }
/* Finish up logging. We reach here if JDWP is doing the exiting. */ // We are here with no errors. Kill entire process and exit with zero exit code
finish_logging(exit_code); /* Only first call matters */ if (error == JVMTI_ERROR_NONE) {
forceExit(EXIT_NO_ERRORS);
return;
}
/* Let's give the JNI a FatalError if non-exit 0, which is historic way */ // No transport initilized.
if ( exit_code != 0 ) { // As we don't have any details here exiting with separate exit code
JNIEnv *env = NULL; if (error == AGENT_ERROR_TRANSPORT_INIT) {
jniFatalError(env, msg, error, exit_code); forceExit(EXIT_TRANSPORT_ERROR);
return;
} }
/* Last chance to die, this kills the entire process. */ // We have JVMTI error. Call hotspot jni_FatalError handler
forceExit(exit_code); jniFatalError(NULL, msg, error, EXIT_JVMTI_ERROR);
// hotspot calls os:abort() so we should never reach code below,
// but guard against possible hotspot changes
// Last chance to die, this kills the entire process.
forceExit(EXIT_JVMTI_ERROR);
} }
...@@ -230,7 +230,7 @@ setup_logging(const char *filename, unsigned flags) ...@@ -230,7 +230,7 @@ setup_logging(const char *filename, unsigned flags)
/* Finish up logging, flush output to the logfile. */ /* Finish up logging, flush output to the logfile. */
void void
finish_logging(int exit_code) finish_logging()
{ {
#ifdef JDWP_LOGGING #ifdef JDWP_LOGGING
MUTEX_LOCK(my_mutex); MUTEX_LOCK(my_mutex);
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
/* LOG: Must be called like: LOG_category(("anything")) or LOG_category((format,args)) */ /* LOG: Must be called like: LOG_category(("anything")) or LOG_category((format,args)) */
void setup_logging(const char *, unsigned); void setup_logging(const char *, unsigned);
void finish_logging(int); void finish_logging();
#define LOG_NULL ((void)0) #define LOG_NULL ((void)0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册