bool MachThread::ShouldStop(bool &step_more) { // See if this thread is at a breakpoint? nub_break_t breakID = CurrentBreakpoint(); if (NUB_BREAK_ID_IS_VALID(breakID)) { // This thread is sitting at a breakpoint, ask the breakpoint // if we should be stopping here. if (Process()->Breakpoints().ShouldStop(ProcessID(), ThreadID(), breakID)) return true; else { // The breakpoint said we shouldn't stop, but we may have gotten // a signal or the user may have requested to stop in some other // way. Stop if we have a valid exception (this thread won't if // another thread was the reason this process stopped) and that // exception, is NOT a breakpoint exception (a common case would // be a SIGINT signal). if (GetStopException().IsValid() && !GetStopException().IsBreakpoint()) return true; } } else { if (m_arch_ap->StepNotComplete()) { step_more = true; return false; } // The thread state is used to let us know what the thread was // trying to do. MachThread::ThreadWillResume() will set the // thread state to various values depending if the thread was // the current thread and if it was to be single stepped, or // resumed. if (GetState() == eStateRunning) { // If our state is running, then we should continue as we are in // the process of stepping over a breakpoint. return false; } else { // Stop if we have any kind of valid exception for this // thread. if (GetStopException().IsValid()) return true; } } return false; }
std::string CMultiXProcess::DebugPrint(int Level,LPCTSTR pFormat, ...) { if(Owner() && Owner()->DebugLevel() < Level) return ""; va_list args; va_start(args, pFormat); int nBuf; int Count; CMultiXDebugBuffer DebugBuf; LPCTSTR pTooLong = "Buffer size to big... unable to print !!!\n"; if((int)strlen(pFormat) > DebugBuf.Size() - 100) pFormat = pTooLong; Count = sprintf(DebugBuf.Data(),"(Process ID=%d)\n",ProcessID()); #ifdef WindowsOs nBuf = _vsnprintf(DebugBuf.Data()+Count, DebugBuf.Size()-Count-1, pFormat, args); #elif defined(TandemOs) nBuf = vsprintf(DebugBuf.Data()+Count, pFormat, args); #else nBuf = vsnprintf(DebugBuf.Data()+Count, DebugBuf.Size()-Count-1, pFormat, args); #endif if(nBuf >= 0) { DebugBuf.Data()[Count + nBuf] = 0; } else { DebugBuf.Data()[DebugBuf.Size()-1] = 0; } std::string RetVal; if(Owner()) RetVal = Owner()->DebugPrint(Level,"%s",DebugBuf.Data()); va_end(args); return RetVal; }
void CMultiXL3Process::RemoveLink(CMultiXL3Link *Link) { if(m_Links.empty()) return; for(TLinksList::iterator I = m_Links.begin();I != m_Links.end();I++) { if(*I == Link) { m_Links.erase(I); break; } } if(m_Links.empty()) { CMultiXL3Event *Event = new CMultiXL3Event(CMultiXEvent::L3ProcessDisconnected,m_pL3,m_pL3->UpperLayer()); Event->ProcID() = ProcessID(); m_pL3->MultiX().QueueEvent(Event); } return; }
CMultiXL3SendMsgReq::CMultiXL3SendMsgReq(CMultiXLayer *Origin,CMultiXLayer *Target) : CMultiXRequest(CMultiXRequest::L3SendMsg,Origin,Target) { ProcessID() = 0; MultiXMsg() = NULL; }