Exemple #1
0
	bool dumpTo(const ProgramPtr& program, const std::string& dir) {
		// first of all, we want to dump the callgraph
		auto callgraph = analysis::callgraph::getCallGraph(program);
		if (!dumpTo(dir + "/callgraph.dot", toString(callgraph))) return false;
		// finally, generate a file for each function
		for (const auto& fun : program->getFunctions()) {
			if (!dumpTo(dir + "/" + analysis::callgraph::getFunctionName(fun) + ".dot", toString(*fun))) return false;
		}
		return true;
	}
void DebugManager::onDumpDataStore(Event *e)
{
	if (!e || !e->hasData())
		return;
	
	DataStoreDump *dump = static_cast <DataStoreDump *>(e->getData());
	
	for (List<SOCKET>::iterator it = client_sockets.begin(); it != client_sockets.end(); it++) {
		dumpTo(*it, dump);
		kernel->unregisterWatchable(*it);
		CLOSE_SOCKET(*it);
	}
	client_sockets.clear();
	
	delete dump;
}