Пример #1
0
// check all the function to find precedures
void MarkProcedure() {
  //check all the function if it calls wait for semwait mark it and mark all its parents as candidate
  for(map<string, Method*>::iterator iter = methods.begin();
      iter != methods.end(); iter++) {
    Method *m = iter->second;
    if (m->candidate) continue;
    for (set<string>::iterator call_iter = m->callexprs.begin();
         call_iter != m->callexprs.end(); call_iter++) {
      string callee = *call_iter;
      if (isWaitFunctionCall(callee) ||  isSemWaitCall(callee)) {
        MakeAsCandidate(m);
        break;
      }
    }
  }

  for(map<string, Method*>::iterator iter = methods.begin();
      iter != methods.end(); iter++) {
      iter->second->visit = false;
      iter->second->isProcedure = false;
  }

  //start from starting procedure traverse the call chain
  for(map<string, Method*>::iterator iter = methods.begin();
    iter != methods.end(); iter++) {
    Method *m = iter->second;
    if (m->isStartingProcedure(records)) {
      TraverseProcedure(m);
    }
  }
}