void CFlowNode_WatchCodeCheckpoint::ResolveCheckpointStatus() { if(!m_pCheckPoint) { ICodeCheckpointMgr *pCodeCheckpointMgr = gEnv->pCodeCheckpointMgr; if(pCodeCheckpointMgr) { // If handle is invalid (indicates first update) if(m_checkPointIdx == ~0) { string name(GetPortString(&m_actInfo, eInputPorts_Name)); // And we have a name if(!name.empty()) { // Query the code checkpoint manager for a handle to the CCCPOINT m_checkPointIdx = pCodeCheckpointMgr->GetCheckpointIndex(name.c_str()); m_checkpointName = name; m_pCheckPoint = pCodeCheckpointMgr->GetCheckpoint(m_checkPointIdx); } } // Ensure we have a valid handle (GetHandle() should always return a valid handle) CRY_ASSERT(m_checkPointIdx != ~0); // If no checkpoint instance yet resolved if(!m_pCheckPoint) { // Query the manager for checkpoint using the handle m_pCheckPoint = pCodeCheckpointMgr->GetCheckpoint(m_checkPointIdx); } } } //Inform the code checkpoint debug manager that we want to observe this point if(!m_watchRequested) { CCodeCheckpointDebugMgr::RetrieveCodeCheckpointDebugMgr()->RegisterWatchPoint(m_checkpointName); m_watchRequested = true; } }
void CCodeCheckpointDebugMgr::UpdateRecords() { //Retrieve the latest snapshot ICodeCheckpointMgr* pCodeCheckpointMgr = gEnv->pCodeCheckpointMgr; if (pCodeCheckpointMgr) { size_t nextSnapshotCount = pCodeCheckpointMgr->GetTotalCount(); size_t currIdx = 0; TCheckpointDebugList::iterator unwatchedIt = m_unwatchedPoints.begin(),watchedIt = m_watchedPoints.begin(); ///Update existing points with their snapshot size_t currSnapShotcount = m_watchedPoints.size() + m_unwatchedPoints.size(); while( currIdx < currSnapShotcount && currIdx < nextSnapshotCount) { string name = pCodeCheckpointMgr->GetCheckPointName(currIdx); const CCodeCheckpoint* pCheckpoint = pCodeCheckpointMgr->GetCheckpoint(currIdx); ///Check if we are a watched point if(watchedIt != m_watchedPoints.end() && (name == watchedIt->m_name)) { CheckpointDebugRecord& currentRec = *watchedIt; UpdateRecord(pCheckpoint, currentRec); ++watchedIt; } //Otherwise checked if we are unwatched point else if(unwatchedIt != m_unwatchedPoints.end() && (name == unwatchedIt->m_name)) { CheckpointDebugRecord& currentRec = *unwatchedIt; UpdateRecord(pCheckpoint, currentRec); ++unwatchedIt; } ///This should never happen, as each existing point should already have been inserted into either the watched or unwatched vector. else { CRY_ASSERT(false); } ++currIdx; } ///Add entities that are new to this snapshot while(currIdx < nextSnapshotCount) { const char* name = pCodeCheckpointMgr->GetCheckPointName(currIdx); const CCodeCheckpoint* pCheckpoint = pCodeCheckpointMgr->GetCheckpoint(currIdx); CheckpointDebugRecord newRecord(pCheckpoint, name, currIdx); //If we have a current request to watch this point, make sure it goes into watched points TBookmarkMap::iterator bookmarkedIt = m_bookmarkedNames.find(name); if(bookmarkedIt != m_bookmarkedNames.end()) { newRecord.UpdateWatched(bookmarkedIt->second); m_watchedPoints.push_back(newRecord); //Clean up the bookmark as its already been hit m_bookmarkedNames.erase(bookmarkedIt); } else m_unwatchedPoints.push_back(newRecord); ++currIdx; } } }