Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 38210 invoked from network); 18 Apr 2007 15:28:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Apr 2007 15:28:46 -0000 Received: (qmail 87650 invoked by uid 500); 18 Apr 2007 15:28:52 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 87624 invoked by uid 500); 18 Apr 2007 15:28:52 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 87611 invoked by uid 99); 18 Apr 2007 15:28:52 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Apr 2007 08:28:52 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Apr 2007 08:28:45 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 3BADD1A9842; Wed, 18 Apr 2007 08:28:25 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r530059 - in /harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core: EventDispatcher.cpp PacketDispatcher.cpp Date: Wed, 18 Apr 2007 15:28:25 -0000 To: commits@harmony.apache.org From: gshimansky@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070418152825.3BADD1A9842@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gshimansky Date: Wed Apr 18 08:28:24 2007 New Revision: 530059 URL: http://svn.apache.org/viewvc?view=rev&rev=530059 Log: Applied HARMONY-3047 [jdktools][JDWP] EUT jdtdebug suit passes with JVMTI_ERROR_unknown error Modified: harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/EventDispatcher.cpp harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/PacketDispatcher.cpp Modified: harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/EventDispatcher.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/EventDispatcher.cpp?view=diff&rev=530059&r1=530058&r2=530059 ============================================================================== --- harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/EventDispatcher.cpp (original) +++ harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/EventDispatcher.cpp Wed Apr 18 08:28:24 2007 @@ -24,6 +24,7 @@ #include "EventDispatcher.h" #include "ThreadManager.h" #include "OptionParser.h" +#include "PacketDispatcher.h" #include "Log.h" using namespace jdwp; @@ -44,27 +45,46 @@ void EventDispatcher::Run(JNIEnv* jni) { JDWP_TRACE_ENTRY("Run(" << jni << ')'); - MonitorAutoLock malCM(m_completeMonitor JDWP_FILE_LINE); - - while (!m_stopFlag) { - EventComposer *ec; - - // get next event from queue - { - MonitorAutoLock lock(m_queueMonitor JDWP_FILE_LINE); - while (m_holdFlag || m_eventQueue.empty()) { - m_queueMonitor->Wait(); - if (m_stopFlag) { - return; + try { + MonitorAutoLock malCM(m_completeMonitor JDWP_FILE_LINE); + + try { + while (!m_stopFlag) { + EventComposer *ec; + + // get next event from queue + { + MonitorAutoLock lock(m_queueMonitor JDWP_FILE_LINE); + while (m_holdFlag || m_eventQueue.empty()) { + m_queueMonitor->Wait(); + if (m_stopFlag) { + return; + } + } + ec = m_eventQueue.front(); + m_eventQueue.pop(); + m_queueMonitor->NotifyAll(); } + + // send event and suspend thread according to suspend policy + SuspendOnEvent(jni, ec); } - ec = m_eventQueue.front(); - m_eventQueue.pop(); - m_queueMonitor->NotifyAll(); } - - // send event and suspend thread according to suspend policy - SuspendOnEvent(jni, ec); + catch (const AgentException& e) + { + JDWP_ERROR("Exception in EventDispatcher thread: " + << e.what() << " [" << e.ErrCode() << "]"); + + // reset current session + JDWP_TRACE_PROG("Run: reset session after exception"); + GetPacketDispatcher().ResetAll(jni); + } + } + catch (const AgentException& e) + { + // just report an error, cannot do anything else + JDWP_ERROR("Exception in EventDispatcher synchronization: " + << e.what() << " [" << e.ErrCode() << "]"); } } Modified: harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/PacketDispatcher.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/PacketDispatcher.cpp?view=diff&rev=530059&r1=530058&r2=530059 ============================================================================== --- harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/PacketDispatcher.cpp (original) +++ harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/PacketDispatcher.cpp Wed Apr 18 08:28:24 2007 @@ -82,132 +82,140 @@ { JDWP_TRACE_ENTRY("Run(" << jni << ")"); - m_isRunning = true; - - MonitorAutoLock lock(m_completionMonitor JDWP_FILE_LINE); - TransportManager &transport = GetTransportManager(); - - try - { - // run multiplle sessions in a loop - for (; ;) + try { + m_isRunning = true; + + MonitorAutoLock lock(m_completionMonitor JDWP_FILE_LINE); + TransportManager &transport = GetTransportManager(); + + try { - // connect for new session - JDWP_TRACE_PROG("Run: start new session"); - try - { - transport.Connect(); - } - catch (const TransportException& e) + // run multiplle sessions in a loop + for (; ;) { - JDWP_TRACE_PROG("Run: Exception in connection: " - << e.what() << " [" << e.ErrCode() - << "/" << e.TransportErrorCode() << "]"); - if (!IsDead()) { - JDWP_DIE(e.what() << " [" << e.ErrCode() << "/" - << e.TransportErrorCode() << "]: " - << GetTransportManager().GetLastTransportError()); + // connect for new session + JDWP_TRACE_PROG("Run: start new session"); + try + { + transport.Connect(); } - break; - } - - // start session and execute commands - try - { - // add internal request for automatic VMDeath event with no modifiers - GetRequestManager().AddInternalRequest(jni, - new AgentEventRequest(JDWP_EVENT_VM_DEATH, JDWP_SUSPEND_NONE)); - - // release events - GetEventDispatcher().ReleaseEvents(); - - // read and execute commands - m_isProcessed = true; - while (m_isProcessed) + catch (const TransportException& e) { - // read command - try { - JDWP_TRACE_PROG("Run: handle next command"); - m_cmdParser.ReadCommand(); - if (m_cmdParser.command.GetLength() == 0) - break; + JDWP_TRACE_PROG("Run: Exception in connection: " + << e.what() << " [" << e.ErrCode() + << "/" << e.TransportErrorCode() << "]"); + if (!IsDead()) { + JDWP_DIE(e.what() << " [" << e.ErrCode() << "/" + << e.TransportErrorCode() << "]: " + << GetTransportManager().GetLastTransportError()); } - catch (const TransportException& e) + break; + } + + // start session and execute commands + try + { + // add internal request for automatic VMDeath event with no modifiers + GetRequestManager().AddInternalRequest(jni, + new AgentEventRequest(JDWP_EVENT_VM_DEATH, JDWP_SUSPEND_NONE)); + + // release events + GetEventDispatcher().ReleaseEvents(); + + // read and execute commands + m_isProcessed = true; + while (m_isProcessed) { - JDWP_TRACE_PROG("Run: Exception in reading command: " - << e.what() << " [" << e.ErrCode() - << "/" << e.TransportErrorCode() << "]"); - if (m_isProcessed && !IsDead()) + // read command + try { + JDWP_TRACE_PROG("Run: handle next command"); + m_cmdParser.ReadCommand(); + if (m_cmdParser.command.GetLength() == 0) + break; + } + catch (const TransportException& e) { - char* msg = GetTransportManager().GetLastTransportError(); - AgentAutoFree af(msg JDWP_FILE_LINE); - - if (e.TransportErrorCode() == JDWPTRANSPORT_ERROR_OUT_OF_MEMORY) { - JDWP_DIE(e.what() << " [" << e.ErrCode() << "/" - << e.TransportErrorCode() << "]: " << msg); - } else { - JDWP_ERROR(e.what() << " [" << e.ErrCode() << "/" - << e.TransportErrorCode() << "]: " << msg); + JDWP_TRACE_PROG("Run: Exception in reading command: " + << e.what() << " [" << e.ErrCode() + << "/" << e.TransportErrorCode() << "]"); + if (m_isProcessed && !IsDead()) + { + char* msg = GetTransportManager().GetLastTransportError(); + AgentAutoFree af(msg JDWP_FILE_LINE); + + if (e.TransportErrorCode() == JDWPTRANSPORT_ERROR_OUT_OF_MEMORY) { + JDWP_DIE(e.what() << " [" << e.ErrCode() << "/" + << e.TransportErrorCode() << "]: " << msg); + } else { + JDWP_ERROR(e.what() << " [" << e.ErrCode() << "/" + << e.TransportErrorCode() << "]: " << msg); + } } + break; + } + + // execute command and prevent from reset while execution + { + MonitorAutoLock lock(m_executionMonitor JDWP_FILE_LINE); + m_cmdDispatcher.ExecCommand(jni, &m_cmdParser); } - break; } - - // execute command and prevent from reset while execution - { - MonitorAutoLock lock(m_executionMonitor JDWP_FILE_LINE); - m_cmdDispatcher.ExecCommand(jni, &m_cmdParser); + } + catch (const AgentException& e) + { + JDWP_TRACE_PROG("Run: Exception in executing command: " + << e.what() << " [" << e.ErrCode() << "]"); + if (!IsDead()) { + JDWP_ERROR(e.what() << " [" << e.ErrCode() << "]"); } } - } - catch (const AgentException& e) - { - JDWP_TRACE_PROG("Run: Exception in executing command: " - << e.what() << " [" << e.ErrCode() << "]"); - if (!IsDead()) { - JDWP_ERROR(e.what() << " [" << e.ErrCode() << "]"); + + // reset all modules after session finished + JDWP_TRACE_PROG("Run: reset session"); + ResetAll(jni); + + // no more sessions if VMDeath event occured + if (IsDead()) { + JDWP_TRACE_PROG("Run: VM is dead -> shutdown"); + break; + } + + // no more sessions in attach mode + if (!GetOptionParser().GetServer()) { + JDWP_TRACE_PROG("Run: attach mode -> shutdown"); + break; } } - - // reset all modules after session finished - JDWP_TRACE_PROG("Run: reset session"); - ResetAll(jni); - - // no more sessions if VMDeath event occured - if (IsDead()) { - JDWP_TRACE_PROG("Run: VM is dead -> shutdown"); - break; - } - - // no more sessions in attach mode - if (!GetOptionParser().GetServer()) { - JDWP_TRACE_PROG("Run: attach mode -> shutdown"); - break; + } + catch (const AgentException& e) + { + JDWP_TRACE_PROG("Run: Exception in PacketDispatcher: " + << e.what() << " [" << e.ErrCode() << "]"); + if (!IsDead()) { + JDWP_DIE(e.what() << " [" << e.ErrCode() << "]"); } } - } - catch (const AgentException& e) - { - JDWP_TRACE_PROG("Run: Exception in PacketDispatcher: " - << e.what() << " [" << e.ErrCode() << "]"); - if (!IsDead()) { - JDWP_DIE(e.what() << " [" << e.ErrCode() << "]"); + + // stop also EventDispatcher thread + try + { + JDWP_TRACE_PROG("Run: stop EventDispatcher"); + GetEventDispatcher().Stop(jni); + } + catch (const AgentException& e) + { + JDWP_TRACE_PROG("Run: Exception in stopping EventDispatcher: " + << e.what() << " [" << e.ErrCode() << "]"); } - } - // stop also EventDispatcher thread - try - { - JDWP_TRACE_PROG("Run: stop EventDispatcher"); - GetEventDispatcher().Stop(jni); + m_isRunning = false; } catch (const AgentException& e) { - JDWP_TRACE_PROG("Run: Exception in stopping EventDispatcher: " + // just report an error, cannot do anything else + JDWP_ERROR("Exception in PacketDispatcher synchronization: " << e.what() << " [" << e.ErrCode() << "]"); } - - m_isRunning = false; } //-----------------------------------------------------------------------------