/// <summary> /// A depth first search algorithm on a directed graph /// </summary> /// <param name="g">The graph to traverse</param> /// <exception cref="ArgumentNullException">g is null</exception> public DepthFirstTraversal(InstructionGraph g) { if (g == null) throw new ArgumentNullException("g"); m_VisitedGraph = g; m_Colors = new Dictionary<IVertex, GraphColor>(); }
/// <summary> /// Generates a set of instruction graphs /// </summary> public static void GenerateInstructionGraphXML(string filename, List<Method> methodList) { using (StreamWriter sw = new StreamWriter(filename)) { sw.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); sw.WriteLine("<cfglist>"); foreach (var method in methodList) { InstructionGraph ig = new InstructionGraph(method); ig.DumpToXMLFile(sw); } sw.WriteLine("</cfglist>"); } }
public InstructionGraph GetInstructionGraph(Method method) { //to prevent storing all graphs and avoid memory issues if (this.igCache.Count > DUCoverConstants.MAX_INSTRUCTIONGRAPH_IN_CACHE) this.igCache.Clear(); InstructionGraph ig; if (this.igCache.TryGetValue(method.GlobalIndex, out ig)) return ig; ig = new InstructionGraph(method); this.igCache[method.GlobalIndex] = ig; return ig; }