提交 1b57d6c2 编写于 作者: S sspitsyn

6988950: JDWP exit error JVMTI_ERROR_WRONG_PHASE(112)

Summary: Synchronize the jdwp VirtualMachine command functions with the VM_DEATH event
Reviewed-by: dcubed, dsamersoff, dholmes
上级 4268378d
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册