mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-09 18:08:31 +00:00
6988950: JDWP exit error JVMTI_ERROR_WRONG_PHASE(112)
Synchronize the jdwp VirtualMachine command functions with the VM_DEATH event Reviewed-by: dcubed, dsamersoff, dholmes
This commit is contained in:
parent
935c33a50c
commit
cc2452b769
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2014, 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
|
||||
@ -45,7 +45,7 @@ struct PacketList {
|
||||
|
||||
static volatile struct PacketList *cmdQueue;
|
||||
static jrawMonitorID cmdQueueLock;
|
||||
static jrawMonitorID resumeLock;
|
||||
static jrawMonitorID vmDeathLock;
|
||||
static jboolean transportError;
|
||||
|
||||
static jboolean
|
||||
@ -60,28 +60,17 @@ lastCommand(jdwpCmdPacket *cmd)
|
||||
}
|
||||
}
|
||||
|
||||
static jboolean
|
||||
resumeCommand(jdwpCmdPacket *cmd)
|
||||
{
|
||||
if ( (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)) &&
|
||||
(cmd->cmd == JDWP_COMMAND(VirtualMachine, Resume)) ) {
|
||||
return JNI_TRUE;
|
||||
} else {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
debugLoop_initialize(void)
|
||||
{
|
||||
resumeLock = debugMonitorCreate("JDWP Resume Lock");
|
||||
vmDeathLock = debugMonitorCreate("JDWP VM_DEATH Lock");
|
||||
}
|
||||
|
||||
void
|
||||
debugLoop_sync(void)
|
||||
{
|
||||
debugMonitorEnter(resumeLock);
|
||||
debugMonitorExit(resumeLock);
|
||||
debugMonitorEnter(vmDeathLock);
|
||||
debugMonitorExit(vmDeathLock);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -136,14 +125,14 @@ debugLoop_run(void)
|
||||
jboolean replyToSender = JNI_TRUE;
|
||||
|
||||
/*
|
||||
* For VirtualMachine.Resume commands we hold the resumeLock
|
||||
* For VirtualMachine commands we hold the vmDeathLock
|
||||
* while executing and replying to the command. This ensures
|
||||
* that a Resume after VM_DEATH will be allowed to complete
|
||||
* that a VM command after VM_DEATH will be allowed to complete
|
||||
* before the thread posting the VM_DEATH continues VM
|
||||
* termination.
|
||||
*/
|
||||
if (resumeCommand(cmd)) {
|
||||
debugMonitorEnter(resumeLock);
|
||||
if (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)){
|
||||
debugMonitorEnter(vmDeathLock);
|
||||
}
|
||||
|
||||
/* Initialize the input and output streams */
|
||||
@ -181,10 +170,10 @@ debugLoop_run(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Release the resumeLock as the reply has been posted.
|
||||
* Release the vmDeathLock as the reply has been posted.
|
||||
*/
|
||||
if (resumeCommand(cmd)) {
|
||||
debugMonitorExit(resumeLock);
|
||||
if (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)){
|
||||
debugMonitorExit(vmDeathLock);
|
||||
}
|
||||
|
||||
inStream_destroy(&in);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user