// Find all blocks that reach the block containing the indirect jump void IndirectControlFlowAnalyzer::GetAllReachableBlock() { reachable.clear(); queue<Block*> q; q.push(block); while (!q.empty()) { ParseAPI::Block *cur = q.front(); q.pop(); if (reachable.find(cur) != reachable.end()) continue; reachable.insert(cur); for (auto eit = cur->sources().begin(); eit != cur->sources().end(); ++eit) if ((*eit)->intraproc()) q.push((*eit)->src()); } }
// Find all blocks that reach the block containing the indirect jump void IndirectControlFlowAnalyzer::GetAllReachableBlock() { reachable.clear(); queue<Block*> q; q.push(block); while (!q.empty()) { ParseAPI::Block *cur = q.front(); q.pop(); if (reachable.find(cur) != reachable.end()) continue; reachable.insert(cur); boost::lock_guard<Block> g(*cur); for (auto eit = cur->sources().begin(); eit != cur->sources().end(); ++eit) if ((*eit)->intraproc()) { if ((*eit)->src() == NULL) { fprintf(stderr, "edge type = %d, target block [%lx, %lx)\n", (*eit)->type(), cur->start(), cur->end()); } q.push((*eit)->src()); } } }