From: John L. <jr...@us...> - 2006-09-07 22:42:23
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv4262/wxLua/modules/wxluasocket/src Modified Files: dservice.cpp wxldserv.cpp wxldtarg.cpp wxlsock.cpp wxluasocket.cpp wxluasocket_bind.cpp Log Message: make wxLuaDebugData derived from wxObject and ref counted so we don't have to remember to delete it or check NULL make the wxTread in wxLuaDebugServer part of the class as wxLuaDebugTarget does Index: dservice.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/dservice.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** dservice.cpp 6 Sep 2006 22:23:20 -0000 1.19 --- dservice.cpp 7 Sep 2006 22:42:19 -0000 1.20 *************** *** 528,532 **** // Debugger Notification ! bool wxLuaDebugService::NotifyStackEnumeration(wxLuaDebugData *pDebugData) { bool result = false; --- 528,532 ---- // Debugger Notification ! bool wxLuaDebugService::NotifyStackEnumeration(const wxLuaDebugData& debugData) { bool result = false; *************** *** 539,543 **** wxLuaDebugSocket* dSocket = m_debuggerSocketList[i]; dSocket->WriteByte(wxLUA_EVENT_DEBUG_STACK_ENUM); ! dSocket->WriteDebugData(pDebugData); if (!dSocket->Error()) --- 539,543 ---- wxLuaDebugSocket* dSocket = m_debuggerSocketList[i]; dSocket->WriteByte(wxLUA_EVENT_DEBUG_STACK_ENUM); ! dSocket->WriteDebugData(debugData); if (!dSocket->Error()) *************** *** 545,555 **** } - delete pDebugData; - return result; } // Debugger Notification ! bool wxLuaDebugService::NotifyStackEntryEnumeration(int entryRef, wxLuaDebugData *pDebugData) { bool result = false; --- 545,553 ---- } return result; } // Debugger Notification ! bool wxLuaDebugService::NotifyStackEntryEnumeration(int entryRef, const wxLuaDebugData& debugData) { bool result = false; *************** *** 563,567 **** dSocket->WriteByte(wxLUA_EVENT_DEBUG_STACK_ENTRY_ENUM); dSocket->WriteInt(entryRef); ! dSocket->WriteDebugData(pDebugData); if (!dSocket->Error()) --- 561,565 ---- dSocket->WriteByte(wxLUA_EVENT_DEBUG_STACK_ENTRY_ENUM); dSocket->WriteInt(entryRef); ! dSocket->WriteDebugData(debugData); if (!dSocket->Error()) *************** *** 569,579 **** } - delete pDebugData; - return result; } // Debugger Notification ! bool wxLuaDebugService::NotifyTableEnumeration(long itemNode, wxLuaDebugData *pDebugData) { bool result = false; --- 567,575 ---- } return result; } // Debugger Notification ! bool wxLuaDebugService::NotifyTableEnumeration(long itemNode, const wxLuaDebugData& debugData) { bool result = false; *************** *** 587,591 **** dSocket->WriteByte(wxLUA_EVENT_DEBUG_TABLE_ENUM); dSocket->WriteLong(itemNode); ! dSocket->WriteDebugData(pDebugData); if (!dSocket->Error()) --- 583,587 ---- dSocket->WriteByte(wxLUA_EVENT_DEBUG_TABLE_ENUM); dSocket->WriteLong(itemNode); ! dSocket->WriteDebugData(debugData); if (!dSocket->Error()) *************** *** 593,598 **** } - delete pDebugData; - return result; } --- 589,592 ---- *************** *** 1120,1158 **** bool wxLuaDebuggee::EnumerateStack() { ! wxLuaDebugData *pSortedList = new wxLuaDebugData(); ! if (pSortedList == NULL) ! return false; wxLuaHandler::GetHandler().EnterLuaCriticalSection(); ! pSortedList->EnumerateStack(m_wxlState); wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); ! return m_debugService->NotifyStackEnumeration(pSortedList); } bool wxLuaDebuggee::EnumerateStackEntry(int stackRef) { ! wxLuaDebugData *pSortedList = new wxLuaDebugData; ! if (pSortedList == NULL) ! return false; wxLuaHandler::GetHandler().EnterLuaCriticalSection(); ! pSortedList->EnumerateStackEntry(m_wxlState, stackRef, m_references); wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); ! return m_debugService->NotifyStackEntryEnumeration(stackRef, pSortedList); } bool wxLuaDebuggee::EnumerateTable(int tableRef, int nIndex, long nItemNode) { ! wxLuaDebugData *pSortedList = new wxLuaDebugData(); ! if (pSortedList == NULL) ! return false; wxLuaHandler::GetHandler().EnterLuaCriticalSection(); ! pSortedList->EnumerateTable(m_wxlState, tableRef, nIndex, m_references); wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); ! return m_debugService->NotifyTableEnumeration(nItemNode, pSortedList); } --- 1114,1146 ---- bool wxLuaDebuggee::EnumerateStack() { ! wxLuaDebugData debugData; wxLuaHandler::GetHandler().EnterLuaCriticalSection(); ! debugData.EnumerateStack(m_wxlState); wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); ! return m_debugService->NotifyStackEnumeration(debugData); } bool wxLuaDebuggee::EnumerateStackEntry(int stackRef) { ! wxLuaDebugData debugData; wxLuaHandler::GetHandler().EnterLuaCriticalSection(); ! debugData.EnumerateStackEntry(m_wxlState, stackRef, m_references); wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); ! return m_debugService->NotifyStackEntryEnumeration(stackRef, debugData); } bool wxLuaDebuggee::EnumerateTable(int tableRef, int nIndex, long nItemNode) { ! wxLuaDebugData debugData; wxLuaHandler::GetHandler().EnterLuaCriticalSection(); ! debugData.EnumerateTable(m_wxlState, tableRef, nIndex, m_references); wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); ! return m_debugService->NotifyTableEnumeration(nItemNode, debugData); } Index: wxluasocket.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxluasocket.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wxluasocket.cpp 6 Sep 2006 22:23:20 -0000 1.3 --- wxluasocket.cpp 7 Sep 2006 22:42:19 -0000 1.4 *************** *** 343,371 **** // ------------------------------------------------------------------------------------------------- - // Bind class wxLuaDebugData - // ------------------------------------------------------------------------------------------------- - - // Lua MetaTable Tag for Class 'wxLuaDebugData' - int s_wxluatag_wxLuaDebugData = -1; - - static int LUACALL wxLua_wxLuaDebugData_destructor(lua_State *) - { - return 0; - } - - - - - - // Map Lua Class Methods to C Binding Functions - static WXLUAMETHOD s_wxLuaDebugData_methods[] = { - { LuaDelete, "wxLuaDebugData", wxLua_wxLuaDebugData_destructor, 0, 0, {0} }, - }; - - // Extern accessor to class method map - WXLUAMETHOD* wxLuaDebugData_methods = s_wxLuaDebugData_methods; - int wxLuaDebugData_methodCount = sizeof(s_wxLuaDebugData_methods)/sizeof(s_wxLuaDebugData_methods[0]); - - // ------------------------------------------------------------------------------------------------- // Bind class wxLuaDebugEvent // ------------------------------------------------------------------------------------------------- --- 343,346 ---- *************** *** 434,452 **** } - // const wxLuaDebugData *GetDebugData() const - static int LUACALL wxLua_wxLuaDebugEvent_GetDebugData(lua_State *L) - { - wxLuaState wxlState(L); - const wxLuaDebugData *returns; - // get this - wxLuaDebugEvent * self = (wxLuaDebugEvent *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaDebugEvent); - // call GetDebugData - returns = self->GetDebugData(); - // push the result datatype - wxlState.PushUserDataType(s_wxluatag_wxLuaDebugData, returns); - - return 1; - } - static int LUACALL wxLua_wxLuaDebugEvent_destructor(lua_State *L) { --- 409,412 ---- *************** *** 484,488 **** { LuaMethod, "GetFileName", wxLua_wxLuaDebugEvent_GetFileName, 0, 0, { 0 } }, { LuaMethod, "GetMessage", wxLua_wxLuaDebugEvent_GetMessage, 0, 0, { 0 } }, - { LuaMethod, "GetDebugData", wxLua_wxLuaDebugEvent_GetDebugData, 0, 0, { 0 } }, { LuaDelete, "wxLuaDebugEvent", wxLua_wxLuaDebugEvent_destructor, 0, 0, {0} }, { LuaMethod, "Delete", wxLua_wxLuaDebugEvent_Delete, 0, 0, {0} }, --- 444,447 ---- Index: wxluasocket_bind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxluasocket_bind.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wxluasocket_bind.cpp 9 Jun 2006 22:51:34 -0000 1.3 --- wxluasocket_bind.cpp 7 Sep 2006 22:42:19 -0000 1.4 *************** *** 127,131 **** static WXLUACLASS classList[] = { - { "wxLuaDebugData", wxLuaDebugData_methods, wxLuaDebugData_methodCount, -1, NULL, &s_wxluatag_wxLuaDebugData, NULL }, { "wxLuaDebugEvent", wxLuaDebugEvent_methods, wxLuaDebugEvent_methodCount, -1, CLASSINFO(wxLuaDebugEvent), &s_wxluatag_wxLuaDebugEvent, "wxEvent" }, { "wxLuaDebugServer", wxLuaDebugServer_methods, wxLuaDebugServer_methodCount, -1, NULL, &s_wxluatag_wxLuaDebugServer, NULL }, --- 127,130 ---- Index: wxldserv.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxldserv.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** wxldserv.cpp 7 Sep 2006 04:20:54 -0000 1.17 --- wxldserv.cpp 7 Sep 2006 22:42:19 -0000 1.18 *************** *** 63,70 **** m_nReference = event.m_nReference; m_fEnabledFlag = event.m_fEnabledFlag; - m_pDebugData = NULL; ! if (event.GetDebugData() != NULL) ! SetDebugData(event.GetReference(), event.GetDebugData()->Clone()); } --- 63,68 ---- m_nReference = event.m_nReference; m_fEnabledFlag = event.m_fEnabledFlag; ! SetDebugData(event.GetReference(), event.GetDebugData().Copy()); } *************** *** 79,89 **** m_nReference = -1; m_fEnabledFlag = enabledFlag; - m_pDebugData = NULL; } wxLuaDebugEvent::~wxLuaDebugEvent() { - if (m_pDebugData != NULL) - delete m_pDebugData; } --- 77,84 ---- *************** *** 94,102 **** } ! void wxLuaDebugEvent::SetDebugData(long nReference, wxLuaDebugData *pData) { - wxCHECK_RET(m_pDebugData == NULL, wxT("Setting wxLuaDebugData twice")); m_nReference = nReference; ! m_pDebugData = pData; } --- 89,96 ---- } ! void wxLuaDebugEvent::SetDebugData(long nReference, const wxLuaDebugData& debugData) { m_nReference = nReference; ! m_debugData = debugData; } *************** *** 120,154 **** } ! wxLuaDebugData* wxLuaDebugServerInterface::EnumerateStack() { m_pServer->EnumerateStack(); ! return NULL; } ! wxLuaDebugData* wxLuaDebugServerInterface::EnumerateStackEntry(int nEntry) { m_pServer->EnumerateStackEntry(nEntry); ! return NULL; } ! wxLuaDebugData* wxLuaDebugServerInterface::EnumerateTable(int nRef, int nEntry, long data) { m_pServer->EnumerateTable(nRef, nEntry, data); ! return NULL; ! } ! ! wxLuaDebugData* wxLuaDebugServerInterface::GetGlobalData() ! { ! return NULL; } ! // ---------------------------------------------------------------------------- ! // wxLuaDebugServerThread ! // ---------------------------------------------------------------------------- ! ! void *wxLuaDebugServerThread::Entry() { ! m_pServer->ThreadFunction(); ! return 0; } --- 114,138 ---- } ! wxLuaDebugData wxLuaDebugServerInterface::EnumerateStack() { m_pServer->EnumerateStack(); ! return wxLuaDebugData(); } ! wxLuaDebugData wxLuaDebugServerInterface::EnumerateStackEntry(int nEntry) { m_pServer->EnumerateStackEntry(nEntry); ! return wxLuaDebugData(); } ! wxLuaDebugData wxLuaDebugServerInterface::EnumerateTable(int nRef, int nEntry, long data) { m_pServer->EnumerateTable(nRef, nEntry, data); ! return wxLuaDebugData(); } ! wxLuaDebugData wxLuaDebugServerInterface::GetGlobalData() { ! return wxLuaDebugData(); } *************** *** 565,573 **** case wxLUA_EVENT_DEBUG_STACK_ENUM: { ! wxLuaDebugData *pDebugData = GetSocketBase()->ReadDebugData(); wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_STACK_ENUM); ! if (pDebugData != NULL) ! debugEvent.SetDebugData(-1, pDebugData); wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); break; --- 549,556 ---- case wxLUA_EVENT_DEBUG_STACK_ENUM: { ! wxLuaDebugData debugData = GetSocketBase()->ReadDebugData(); wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_STACK_ENUM); ! debugEvent.SetDebugData(-1, debugData); wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); break; *************** *** 575,584 **** case wxLUA_EVENT_DEBUG_STACK_ENTRY_ENUM: { ! int stackRef = GetSocketBase()->ReadInt(); ! wxLuaDebugData *pDebugData = GetSocketBase()->ReadDebugData(); wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_STACK_ENTRY_ENUM); ! if (pDebugData != NULL) ! debugEvent.SetDebugData(stackRef, pDebugData); wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); break; --- 558,566 ---- case wxLUA_EVENT_DEBUG_STACK_ENTRY_ENUM: { ! int stackRef = GetSocketBase()->ReadInt(); ! wxLuaDebugData debugData = GetSocketBase()->ReadDebugData(); wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_STACK_ENTRY_ENUM); ! debugEvent.SetDebugData(stackRef, debugData); wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); break; *************** *** 586,595 **** case wxLUA_EVENT_DEBUG_TABLE_ENUM: { ! long itemNode = GetSocketBase()->ReadLong(); ! wxLuaDebugData *pDebugData = GetSocketBase()->ReadDebugData(); wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_TABLE_ENUM); ! if (pDebugData != NULL) ! debugEvent.SetDebugData(itemNode, pDebugData); wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); break; --- 568,576 ---- case wxLUA_EVENT_DEBUG_TABLE_ENUM: { ! long itemNode = GetSocketBase()->ReadLong(); ! wxLuaDebugData debugData = GetSocketBase()->ReadDebugData(); wxLuaDebugEvent debugEvent(wxEVT_WXLUA_DEBUG_TABLE_ENUM); ! debugEvent.SetDebugData(itemNode, debugData); wxLuaHandler::GetHandler().AddPendingEvent(debugEvent); break; *************** *** 632,635 **** --- 613,626 ---- // ---------------------------------------------------------------------------- + // wxLuaDebugServer::LuaThread + // ---------------------------------------------------------------------------- + + void *wxLuaDebugServer::LuaThread::Entry() + { + m_pServer->ThreadFunction(); + return 0; + } + + // ---------------------------------------------------------------------------- // wxLuaDebugServer // ---------------------------------------------------------------------------- *************** *** 695,699 **** if (!m_fShutdown) { ! m_pThread = new wxLuaDebugServerThread(this); return ((m_pThread != NULL) && --- 686,690 ---- if (!m_fShutdown) { ! m_pThread = new wxLuaDebugServer::LuaThread(this); return ((m_pThread != NULL) && Index: wxlsock.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxlsock.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** wxlsock.cpp 6 Sep 2006 22:23:20 -0000 1.9 --- wxlsock.cpp 7 Sep 2006 22:42:19 -0000 1.10 *************** *** 99,105 **** } ! wxLuaDebugData *wxLuaSocketBase::ReadDebugData() { ! wxLuaDebugData *pSortedList = new wxLuaDebugData(); try --- 99,105 ---- } ! wxLuaDebugData wxLuaSocketBase::ReadDebugData() { ! wxLuaDebugData debugData; try *************** *** 140,144 **** nIndex, fExpanded); ! pSortedList->Add(pItem); delete[] pBuffer; --- 140,144 ---- nIndex, fExpanded); ! debugData.GetDataArray().Add(pItem); delete[] pBuffer; *************** *** 148,156 **** catch(wxLuaSocketException & /*e*/) { - delete pSortedList; - pSortedList = NULL; } ! return pSortedList; } --- 148,154 ---- catch(wxLuaSocketException & /*e*/) { } ! return debugData; } *************** *** 215,222 **** } ! bool wxLuaSocketBase::WriteDebugData(const wxLuaDebugData *pSortedList) { bool result = false; ! int idx, idxMax = pSortedList->Count(); Write((const char *) &idxMax, sizeof(int)); --- 213,220 ---- } ! bool wxLuaSocketBase::WriteDebugData(const wxLuaDebugData& debugData) { bool result = false; ! int idx, idxMax = debugData.GetDataArray().Count(); Write((const char *) &idxMax, sizeof(int)); *************** *** 226,230 **** try { ! const wxLuaDebugDataItem *item = pSortedList->Item(idx); int nameLength = item->GetName().Length() + 1; --- 224,228 ---- try { ! const wxLuaDebugDataItem *item = debugData.GetDataArray().Item(idx); int nameLength = item->GetName().Length() + 1; Index: wxldtarg.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxldtarg.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** wxldtarg.cpp 6 Sep 2006 05:33:09 -0000 1.18 --- wxldtarg.cpp 7 Sep 2006 22:42:19 -0000 1.19 *************** *** 40,43 **** --- 40,53 ---- // ---------------------------------------------------------------------------- + // wxLuaDebugTarget::LuaThread + // ---------------------------------------------------------------------------- + + void *wxLuaDebugTarget::LuaThread::Entry() + { + m_pTarget->ThreadFunction(); + return 0; + } + + // ---------------------------------------------------------------------------- // wxLuaDebugTarget - Handles Debugger/Debuggee IO // ---------------------------------------------------------------------------- *************** *** 49,55 **** m_portNumber(portNumber), m_serverName(serverName), - #if wxCHECK_VERSION(2, 3, 3) m_debugCondition(m_debugMutex), - #endif m_forceBreak(false), m_resetRequested(false), --- 59,63 ---- *************** *** 59,65 **** m_fErrorsSeen(false), m_nFramesUntilBreak(0), - #if wxCHECK_VERSION(2, 3, 3) m_runCondition(m_runMutex), - #endif m_pThread(NULL) { --- 67,71 ---- *************** *** 163,181 **** } - void *wxLuaDebugTarget::LuaThread::Entry() - { - m_pTarget->ThreadFunction(); - return 0; - } - - void wxLuaDebugTarget::LuaThread::OnExit() - { - } - - bool wxLuaDebugTarget::LuaThread::TestDestroy() - { - return wxThread::TestDestroy(); - } - void wxLuaDebugTarget::ThreadFunction() { --- 169,172 ---- *************** *** 197,220 **** { wxLuaDebugCommands_Type debugCommand = (wxLuaDebugCommands_Type)m_clientSocket.ReadByte(); ! switch(debugCommand) { case wxLUA_CMD_ADD_BREAKPOINT: ! { ! wxString fileName = m_clientSocket.ReadString(); ! int lineNumber = m_clientSocket.ReadInt(); ! AddBreakPoint(fileName, lineNumber); ! } break; ! case wxLUA_CMD_REMOVE_BREAKPOINT: ! { ! wxString fileName = m_clientSocket.ReadString(); ! int lineNumber = m_clientSocket.ReadInt(); ! RemoveBreakPoint(fileName, lineNumber); ! } break; ! case wxLUA_CMD_CLEAR_ALL_BREAKPOINTS: ClearAllBreakPoints(); --- 188,209 ---- { wxLuaDebugCommands_Type debugCommand = (wxLuaDebugCommands_Type)m_clientSocket.ReadByte(); ! switch (debugCommand) { case wxLUA_CMD_ADD_BREAKPOINT: ! { ! wxString fileName = m_clientSocket.ReadString(); ! int lineNumber = m_clientSocket.ReadInt(); ! AddBreakPoint(fileName, lineNumber); break; ! } case wxLUA_CMD_REMOVE_BREAKPOINT: ! { ! wxString fileName = m_clientSocket.ReadString(); ! int lineNumber = m_clientSocket.ReadInt(); ! RemoveBreakPoint(fileName, lineNumber); break; ! } case wxLUA_CMD_CLEAR_ALL_BREAKPOINTS: ClearAllBreakPoints(); *************** *** 222,233 **** case wxLUA_CMD_RUN_BUFFER: ! { ! wxString fileName = m_clientSocket.ReadString(); ! wxString buffer = m_clientSocket.ReadString(); ! Run(fileName, buffer); ! } break; ! case wxLUA_CMD_DEBUG_STEP: Step(); --- 211,221 ---- case wxLUA_CMD_RUN_BUFFER: ! { ! wxString fileName = m_clientSocket.ReadString(); ! wxString buffer = m_clientSocket.ReadString(); ! Run(fileName, buffer); break; ! } case wxLUA_CMD_DEBUG_STEP: Step(); *************** *** 255,273 **** case wxLUA_CMD_ENUMERATE_STACK_ENTRY: ! { ! int stackRef = m_clientSocket.ReadInt(); ! EnumerateStackEntry(stackRef); ! } break; ! case wxLUA_CMD_ENUMERATE_TABLE_REF: ! { ! int tableRef = m_clientSocket.ReadInt(); ! int index = m_clientSocket.ReadInt(); ! long itemNode = m_clientSocket.ReadLong(); ! EnumerateTable(tableRef, index, itemNode); ! } break; ! case wxLUA_CMD_RESET: Reset(); --- 243,259 ---- case wxLUA_CMD_ENUMERATE_STACK_ENTRY: ! { ! int stackRef = m_clientSocket.ReadInt(); ! EnumerateStackEntry(stackRef); break; ! } case wxLUA_CMD_ENUMERATE_TABLE_REF: ! { ! int tableRef = m_clientSocket.ReadInt(); ! int index = m_clientSocket.ReadInt(); ! long itemNode = m_clientSocket.ReadLong(); ! EnumerateTable(tableRef, index, itemNode); break; ! } case wxLUA_CMD_RESET: Reset(); *************** *** 275,296 **** case wxLUA_CMD_EVALUATE_EXPR: ! { ! int exprRef = m_clientSocket.ReadInt(); ! wxString buffer = m_clientSocket.ReadString(); ! EvaluateExpr(exprRef, buffer); ! } break; ! case wxLUA_CMD_CLEAR_DEBUG_REFERENCES: { ! size_t idx, idxMax = m_references.GetCount(); ! for (idx = 0; idx < idxMax; ++idx) ! { ! int iItem = m_references.Item(idx); ! m_wxlState.tremove(iItem); ! } } break; ! case wxLUA_CMD_DISABLE_BREAKPOINT: break; --- 261,280 ---- case wxLUA_CMD_EVALUATE_EXPR: ! { ! int exprRef = m_clientSocket.ReadInt(); ! wxString buffer = m_clientSocket.ReadString(); ! EvaluateExpr(exprRef, buffer); break; ! } case wxLUA_CMD_CLEAR_DEBUG_REFERENCES: + { + size_t idx, idxMax = m_references.GetCount(); + for (idx = 0; idx < idxMax; ++idx) { ! int iItem = m_references.Item(idx); ! m_wxlState.tremove(iItem); } break; ! } case wxLUA_CMD_DISABLE_BREAKPOINT: break; *************** *** 309,318 **** { wxCriticalSectionLocker locker(m_breakPointListCriticalSection); ! ! wxString breakPoint; ! breakPoint = breakPoint.Format(wxT("%u:"), lineNumber) + fileName; ! ! m_breakPointList.Add(breakPoint); ! return false; } --- 293,297 ---- { wxCriticalSectionLocker locker(m_breakPointListCriticalSection); ! m_breakPointList.Add(wxString::Format(wxT("%u:"), lineNumber) + fileName); return false; } *************** *** 321,330 **** { wxCriticalSectionLocker locker(m_breakPointListCriticalSection); ! ! wxString breakPoint; ! breakPoint = breakPoint.Format(wxT("%u:"), lineNumber) + fileName; ! ! m_breakPointList.Remove(breakPoint); ! return true; } --- 300,304 ---- { wxCriticalSectionLocker locker(m_breakPointListCriticalSection); ! m_breakPointList.Remove(wxString::Format(wxT("%u:"), lineNumber) + fileName); return true; } *************** *** 420,458 **** bool wxLuaDebugTarget::EnumerateStack() { ! wxLuaDebugData *pSortedList = new wxLuaDebugData(); ! if (pSortedList == NULL) ! return false; wxLuaHandler::GetHandler().EnterLuaCriticalSection(); ! pSortedList->EnumerateStack(m_wxlState); wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); ! return NotifyStackEnumeration(pSortedList); } bool wxLuaDebugTarget::EnumerateStackEntry(int stackRef) { ! wxLuaDebugData *pSortedList = new wxLuaDebugData; ! if (pSortedList == NULL) ! return false; wxLuaHandler::GetHandler().EnterLuaCriticalSection(); ! pSortedList->EnumerateStackEntry(m_wxlState, stackRef, m_references); wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); ! return NotifyStackEntryEnumeration(stackRef, pSortedList); } bool wxLuaDebugTarget::EnumerateTable(int tableRef, int nIndex, long nItemNode) { ! wxLuaDebugData *pSortedList = new wxLuaDebugData(); ! if (pSortedList == NULL) ! return false; wxLuaHandler::GetHandler().EnterLuaCriticalSection(); ! pSortedList->EnumerateTable(m_wxlState, tableRef, nIndex, m_references); wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); ! return NotifyTableEnumeration(nItemNode, pSortedList); } --- 394,426 ---- bool wxLuaDebugTarget::EnumerateStack() { ! wxLuaDebugData debugData; wxLuaHandler::GetHandler().EnterLuaCriticalSection(); ! debugData.EnumerateStack(m_wxlState); wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); ! return NotifyStackEnumeration(debugData); } bool wxLuaDebugTarget::EnumerateStackEntry(int stackRef) { ! wxLuaDebugData debugData; wxLuaHandler::GetHandler().EnterLuaCriticalSection(); ! debugData.EnumerateStackEntry(m_wxlState, stackRef, m_references); wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); ! return NotifyStackEntryEnumeration(stackRef, debugData); } bool wxLuaDebugTarget::EnumerateTable(int tableRef, int nIndex, long nItemNode) { ! wxLuaDebugData debugData; wxLuaHandler::GetHandler().EnterLuaCriticalSection(); ! debugData.EnumerateTable(m_wxlState, tableRef, nIndex, m_references); wxLuaHandler::GetHandler().LeaveLuaCriticalSection(); ! return NotifyTableEnumeration(nItemNode, debugData); } *************** *** 645,662 **** } ! bool wxLuaDebugTarget::NotifyStackEnumeration(wxLuaDebugData *pDebugData) { if (WaitForConnect()) { m_clientSocket.WriteByte(wxLUA_EVENT_DEBUG_STACK_ENUM); ! m_clientSocket.WriteDebugData(pDebugData); return true; } ! delete pDebugData; return false; } ! bool wxLuaDebugTarget::NotifyStackEntryEnumeration(int entryRef, ! wxLuaDebugData *pDebugData) { if (WaitForConnect()) --- 613,630 ---- } ! bool wxLuaDebugTarget::NotifyStackEnumeration(const wxLuaDebugData& debugData) { if (WaitForConnect()) { m_clientSocket.WriteByte(wxLUA_EVENT_DEBUG_STACK_ENUM); ! m_clientSocket.WriteDebugData(debugData); return true; } ! return false; } ! bool wxLuaDebugTarget::NotifyStackEntryEnumeration(int entryRef, ! const wxLuaDebugData& debugData) { if (WaitForConnect()) *************** *** 664,676 **** m_clientSocket.WriteByte(wxLUA_EVENT_DEBUG_STACK_ENTRY_ENUM); m_clientSocket.WriteInt(entryRef); ! m_clientSocket.WriteDebugData(pDebugData); return true; } ! delete pDebugData; return false; } bool wxLuaDebugTarget::NotifyTableEnumeration(long itemNode, ! wxLuaDebugData *pDebugData) { if (WaitForConnect()) --- 632,644 ---- m_clientSocket.WriteByte(wxLUA_EVENT_DEBUG_STACK_ENTRY_ENUM); m_clientSocket.WriteInt(entryRef); ! m_clientSocket.WriteDebugData(debugData); return true; } ! return false; } bool wxLuaDebugTarget::NotifyTableEnumeration(long itemNode, ! const wxLuaDebugData& debugData) { if (WaitForConnect()) *************** *** 678,685 **** m_clientSocket.WriteByte(wxLUA_EVENT_DEBUG_TABLE_ENUM); m_clientSocket.WriteLong(itemNode); ! m_clientSocket.WriteDebugData(pDebugData); return true; } ! delete pDebugData; return false; } --- 646,653 ---- m_clientSocket.WriteByte(wxLUA_EVENT_DEBUG_TABLE_ENUM); m_clientSocket.WriteLong(itemNode); ! m_clientSocket.WriteDebugData(debugData); return true; } ! return false; } *************** *** 741,754 **** { case DEBUG_STEP: ! { ! int lineNumber = 0; ! wxString fileName = GetDebugInfo(lineNumber); ! if (NotifyBreak(fileName, lineNumber)) ! fWait = true; ! } ! break; case DEBUG_STEPOVER: if (m_nFramesUntilBreak == 0) { --- 709,723 ---- { case DEBUG_STEP: ! { ! int lineNumber = 0; ! wxString fileName = GetDebugInfo(lineNumber); ! if (NotifyBreak(fileName, lineNumber)) ! fWait = true; + break; + } case DEBUG_STEPOVER: + { if (m_nFramesUntilBreak == 0) { *************** *** 760,775 **** } break; ! case DEBUG_GO: default: ! { ! int lineNumber = 0; ! wxString fileName = GetDebugInfo(lineNumber); - if (AtBreakPoint(fileName, lineNumber) && - NotifyBreak(fileName, lineNumber)) - fWait = true; - } break; } } --- 729,745 ---- } break; ! } case DEBUG_GO: default: ! { ! int lineNumber = 0; ! wxString fileName = GetDebugInfo(lineNumber); ! ! if (AtBreakPoint(fileName, lineNumber) && ! NotifyBreak(fileName, lineNumber)) ! fWait = true; break; + } } } |