From: John L. <jr...@us...> - 2006-05-14 07:48:13
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv1343/wxLua/modules/wxluadebug/src Modified Files: staktree.cpp Log Message: Add classinfo to the encapsulated classes for showing what they are in stacktree show the tracked class types in the stack tree use long for memory pointers not int in AddToTrackedMemory Index: staktree.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/staktree.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** staktree.cpp 4 May 2006 02:47:34 -0000 1.22 --- staktree.cpp 14 May 2006 07:48:09 -0000 1.23 *************** *** 375,393 **** wxCHECK_RET(wxlState.Ok(), wxT("Invalid wxLuaState")); ! int derivedCount = 0, ! trackedCount = 0, ! eventHandlerCount = 0, ! windowCount = 0; ! derivedCount = wxlState.GetLuaStateData()->m_pDerivedList.size(); ! trackedCount = wxlState.GetLuaStateData()->m_pTrackedList.size(); ! eventHandlerCount = wxlState.GetLuaStateData()->m_eventHandlerList.GetCount(); ! windowCount = wxlState.GetLuaStateData()->m_windowList.GetCount(); ! treeControl->AppendItem(rootItem, wxT("Derived List"), 1, 1, new wxLuaDebugDataItem(_("Derived List"), wxT("wxLuaData"), wxT(""), wxString::Format(wxT("%d"), derivedCount), LUA_NOREF, 0)); ! treeControl->AppendItem(rootItem, wxT("Tracked List"), 1, 1, new wxLuaDebugDataItem(_("Tracked List"), wxT("wxLuaData"), wxT(""), wxString::Format(wxT("%d"), trackedCount), LUA_NOREF, 0)); ! treeControl->AppendItem(rootItem, wxT("Event Handler List"), 1, 1, new wxLuaDebugDataItem(_("Event Handler List"), wxT("wxLuaData"), wxT(""), wxString::Format(wxT("%d"), eventHandlerCount), LUA_NOREF, 0)); ! treeControl->AppendItem(rootItem, wxT("wxWindow List"), 1, 1, new wxLuaDebugDataItem(_("wxWindow List"), wxT("wxLuaData"), wxT(""), wxString::Format(wxT("%d"), windowCount), LUA_NOREF, 0)); } --- 375,395 ---- wxCHECK_RET(wxlState.Ok(), wxT("Invalid wxLuaState")); ! int derivedCount = wxlState.GetLuaStateData()->m_pDerivedList.size(); ! int trackedCount = wxlState.GetLuaStateData()->m_pTrackedList.size(); ! int eventHandlerCount = wxlState.GetLuaStateData()->m_eventHandlerList.GetCount(); ! int windowCount = wxlState.GetLuaStateData()->m_windowList.GetCount(); ! wxLuaDebugDataItem* derivedItem = new wxLuaDebugDataItem(_("Derived List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), derivedCount), wxT(""), LUA_NOREF, 0); ! wxLuaDebugDataItem* trackedItem = new wxLuaDebugDataItem(_("Tracked List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), trackedCount), wxT(""), LUA_NOREF, 0); ! wxLuaDebugDataItem* eventHandlerItem = new wxLuaDebugDataItem(_("Event Handler List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), eventHandlerCount), wxT(""), LUA_NOREF, 0); ! wxLuaDebugDataItem* windowItem = new wxLuaDebugDataItem(_("wxWindow List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), windowCount), wxT(""), LUA_NOREF, 0); ! treeControl->AppendItem(rootItem, wxT("Derived List"), 1, 1, derivedItem); ! wxTreeItemId treeNode = treeControl->AppendItem(rootItem, wxT("Tracked List"), 1, 1, trackedItem); ! if (trackedCount > 0) m_treeControl->SetItemHasChildren(treeNode); ! ! treeControl->AppendItem(rootItem, wxT("Event Handler List"), 1, 1, eventHandlerItem); ! treeControl->AppendItem(rootItem, wxT("wxWindow List"), 1, 1, windowItem); } *************** *** 402,431 **** { wxLuaDebugDataItem *pDebugData = (wxLuaDebugDataItem *)m_treeControl->GetItemData(itemNode); ! if (pDebugData != NULL) { int nRef = pDebugData->GetReference(); if (nRef != LUA_NOREF) { int nIndex = pDebugData->GetIndex() + 1; - if (!pDebugData->IsExpanded()) - { - pDebugData->SetExpanded(true); ! if (m_luaInterface->IsDebugServer()) { ! m_luaInterface->EnumerateTable(nRef, nIndex, (long)itemNode.m_pItem); } ! else { ! // insert items ! wxLuaDebugData *pSortedList = m_luaInterface->EnumerateTable(nRef, nIndex); ! if (pSortedList != NULL) { ! FillTableEntry(itemNode, pSortedList); ! delete pSortedList; } } } ! } } } --- 404,468 ---- { wxLuaDebugDataItem *pDebugData = (wxLuaDebugDataItem *)m_treeControl->GetItemData(itemNode); ! if ((pDebugData != NULL) && !pDebugData->IsExpanded()) { + pDebugData->SetExpanded(true); + int nRef = pDebugData->GetReference(); if (nRef != LUA_NOREF) { int nIndex = pDebugData->GetIndex() + 1; ! if (m_luaInterface->IsDebugServer()) ! { ! m_luaInterface->EnumerateTable(nRef, nIndex, (long)itemNode.m_pItem); ! } ! else ! { ! // insert items ! wxLuaDebugData *pSortedList = m_luaInterface->EnumerateTable(nRef, nIndex); ! if (pSortedList != NULL) { ! FillTableEntry(itemNode, pSortedList); ! delete pSortedList; } ! } ! } ! else if (m_luaInterface->GetwxLuaState().Ok() && ! (pDebugData->GetName() == _("Tracked List"))) ! { ! wxLuaState wxlState(m_luaInterface->GetwxLuaState()); ! ! wxLongToLongHashMap::iterator it; ! wxLongToLongHashMap* hashMap = &wxlState.GetLuaStateRefData()->m_wxlStateData->m_pTrackedList; ! wxArrayString names; ! wxArrayInt counts; ! for (it = hashMap->begin(); it != hashMap->end(); ++it) ! { ! wxObject* obj = (wxObject*)it->second; ! if (obj && obj->GetClassInfo() && obj->GetClassInfo()->GetClassName()) { ! wxString name(obj->GetClassInfo()->GetClassName()); ! int idx = names.Index(name); ! if (idx == wxNOT_FOUND) { ! names.Add(name); ! counts.Add(1); } + else + counts[idx]++; } } ! ! wxLuaDebugData* dataArr = new wxLuaDebugData; ! size_t n, count = names.GetCount(); ! for (n = 0; n < count; n++) ! { ! wxLuaDebugDataItem *item = new wxLuaDebugDataItem(names[n], wxT("wxLuaData"), wxString::Format(wxT("%d"), counts[n]), wxT(""), LUA_NOREF, pDebugData->GetIndex() + 1); ! dataArr->Add(item); ! } ! ! FillTableEntry(itemNode, dataArr); ! delete dataArr; ! } } } |