public static void calculateAllTracesFromFunction(String sSignature, TreeNodeCollection tncTraces, List<String> lFunctionsCalled, String sFilter_Signature, String sFilter_Parameter, bool bUseIsCalledBy, ICirDataAnalysis fcdAnalysis) { TreeNode tnNewTreeNode = O2Forms.newTreeNode(sSignature, sSignature, 0, sSignature); tncTraces.Add(tnNewTreeNode); if (fcdAnalysis.dCirFunction_bySignature.ContainsKey(sSignature)) { ICirFunction cfCirFunction = fcdAnalysis.dCirFunction_bySignature[sSignature]; List<ICirFunction> lsFunctions = new List<ICirFunction>(); if (bUseIsCalledBy) foreach(var cirFunctionCall in cfCirFunction.FunctionIsCalledBy) lsFunctions.Add(cirFunctionCall.cirFunction); else lsFunctions.AddRange(cfCirFunction.FunctionsCalledUniqueList); foreach (ICirFunction cirFunction in lsFunctions) if (false == lFunctionsCalled.Contains(cirFunction.FunctionSignature)) { lFunctionsCalled.Add(cirFunction.FunctionSignature); calculateAllTracesFromFunction(cirFunction.FunctionSignature, tnNewTreeNode.Nodes, lFunctionsCalled, sFilter_Signature, sFilter_Parameter, bUseIsCalledBy, fcdAnalysis); } else tnNewTreeNode.Nodes.Add("(Circular ref) : " + cirFunction.FunctionSignature); } }
public static ICirDataSearchResult executeSearch(ICirDataAnalysis cirDataAnalysis) { var fcdSearchResult = new CirDataSearchResult(cirDataAnalysis); CirSearch.executeSearch(fcdSearchResult); return(fcdSearchResult); }
public static KM_CirAction setCirDataAnalysis(ICirDataAnalysis cirDataAnalysis) { var kmCirAction = new KM_CirAction(); kmCirAction.CirDataAnalysis = cirDataAnalysis; kmCirAction.CirAction = IM_CirActions.setCirDataAnalysis; return kmCirAction; }
public void loadCirDataAnalysisObject(ICirDataAnalysis _cirDataAnalysis) { _cirDataAnalysis.onlyShowExternalFunctionsThatAreInvokedFromCFG = cirDataAnalysis.onlyShowExternalFunctionsThatAreInvokedFromCFG; _cirDataAnalysis.onlyShowFunctionsOrClassesWithControlFlowGraphs = cirDataAnalysis.onlyShowFunctionsOrClassesWithControlFlowGraphs; _cirDataAnalysis.onlyShowFunctionsWithCallersOrCallees = cirDataAnalysis.onlyShowFunctionsWithCallersOrCallees; cirDataAnalysis = _cirDataAnalysis; }
public static ICirData addO2CirDataFile(ICirDataAnalysis cirDataAnalysis, String sO2CirFileToAdd, bool useCachedVersionIfAvailable) { ICirData cirData; if (useCachedVersionIfAvailable && cirDataAnalysis.dCirDataFilesLoaded.ContainsKey(sO2CirFileToAdd)) { //DI.log.debug("O2CirData file already loaded: {0}", sO2CirFileToAdd); cirData = cirDataAnalysis.dCirDataFilesLoaded[sO2CirFileToAdd]; } else { // vars.set_(sO2CirFileToAdd, null); // force reload of the o2cirdata file //cirDataAnalysis.dCirDataFilesLoaded.Clear(); cirData = CirLoad.loadFile(sO2CirFileToAdd); if (cirData == null || cirData.dClasses_bySignature == null) // || cirData.lFiles.Count == 0) { return(null); } // add to main list if (cirDataAnalysis.dCirDataFilesLoaded.ContainsKey(sO2CirFileToAdd)) { cirDataAnalysis.dCirDataFilesLoaded[sO2CirFileToAdd] = cirData; } else { cirDataAnalysis.dCirDataFilesLoaded.Add(sO2CirFileToAdd, cirData); } } return(addO2CirDataFile(cirDataAnalysis, cirData)); }
public static void removeO2CirDataFile(ICirDataAnalysis cirDataAnalysis, String sO2CirDataFileToRemove) { if (cirDataAnalysis.dCirDataFilesLoaded.ContainsKey(sO2CirDataFileToRemove)) { ICirData fcdCirData = cirDataAnalysis.dCirDataFilesLoaded[sO2CirDataFileToRemove]; cirDataAnalysis.dCirDataFilesLoaded.Remove(sO2CirDataFileToRemove); foreach (ICirClass ccCirClass in fcdCirData.dClasses_bySignature.Values) { if (cirDataAnalysis.dCirClass.ContainsKey(ccCirClass)) { cirDataAnalysis.dCirClass.Remove(ccCirClass); cirDataAnalysis.dCirClass_bySignature.Remove(ccCirClass.Signature); foreach (ICirFunction cfCirFunction in ccCirClass.dFunctions.Values) { if (cirDataAnalysis.dCirFunction.ContainsKey(cfCirFunction)) { cirDataAnalysis.dCirFunction.Remove(cfCirFunction); cirDataAnalysis.dCirFunction_bySignature.Remove(cfCirFunction.FunctionSignature); } else { } } } else { } } showStatsOfLoadedData(cirDataAnalysis); } }
public static ICirFunction getFunctionRef(ICirDataAnalysis cirDataAnalysis, ICirFunction cirFunction) { if (false == cirDataAnalysis.dCirFunction_bySignature.ContainsKey(cirFunction.FunctionSignature)) { cirDataAnalysis.dCirFunction_bySignature.Add(cirFunction.FunctionSignature, cirFunction); } return(cirDataAnalysis.dCirFunction_bySignature[cirFunction.FunctionSignature]); }
public void setO2CirDataAnalysisObject(ICirDataAnalysis _cirDataAnalysis) { cirDataAnalysis = _cirDataAnalysis; asv_CalledFunctions.setO2CirDataAnalysisObject(cirDataAnalysis); asv_IsCalledBy.setO2CirDataAnalysisObject(cirDataAnalysis); afv_Calls.setNamespaceDepth(-1); afv_IsCalledBy.setNamespaceDepth(-1); }
public static KM_CirAction setCirDataAnalysis(ICirDataAnalysis cirDataAnalysis) { var kmCirAction = new KM_CirAction(); kmCirAction.CirDataAnalysis = cirDataAnalysis; kmCirAction.CirAction = IM_CirActions.setCirDataAnalysis; return(kmCirAction); }
private void onLoad() { if (runOnLoad && false == DesignMode) { PublicDI.o2MessageQueue.onMessages += o2MessageQueue_onMessages; cirDataAnalysis = new CirDataAnalysis(); runOnLoad = false; } }
public static KM_CirAction setCirDataAnalysis(ICirDataAnalysis cirDataAnalysis) { var kmCirAction = new KM_CirAction { CirAction = IM_CirActions.setCirDataAnalysis, CirDataAnalysis = cirDataAnalysis }; return kmCirAction; }
public static void openCirDataFileInCirViewerControl(ICirDataAnalysis cirDataAnalysis, string cirViewerControlName) { if (cirDataAnalysis != null) { var ascxCirViewer = (ascx_CirDataViewer)O2AscxGUI.getAscx(cirViewerControlName); if (ascxCirViewer != null) { ascxCirViewer.loadCirDataAnalysisObject(cirDataAnalysis); ascxCirViewer.updateCirDataStats(); } } }
private void deleteAllLoadedData() { // clean current results but keep the current viewing flags cirDataAnalysis = new CirDataAnalysis { onlyShowExternalFunctionsThatAreInvokedFromCFG = cirDataAnalysis.onlyShowExternalFunctionsThatAreInvokedFromCFG, onlyShowFunctionsOrClassesWithControlFlowGraphs = cirDataAnalysis.onlyShowFunctionsOrClassesWithControlFlowGraphs, onlyShowFunctionsWithCallersOrCallees = cirDataAnalysis.onlyShowFunctionsWithCallersOrCallees }; showLoadedFunctions(); updateCirDataStats(); }
// need to check of other class values public static void mergeClasses(ICirDataAnalysis cirDataAnalysis, ICirClass classHost, ICirClass classToMerge) { foreach (var propertyInfo in DI.reflection.getProperties(typeof(ICirClass))) { if (DI.reflection.getProperty(propertyInfo.Name, classHost) == null && DI.reflection.getProperty(propertyInfo.Name, classToMerge) != null) { DI.reflection.setProperty(propertyInfo.Name, classHost, DI.reflection.getProperty(propertyInfo.Name, classToMerge)); } } addClass(cirDataAnalysis, classToMerge); }
public static void openCirDataFileInCirViewerControl(ICirDataAnalysis cirDataAnalysis, string cirViewerControlName) { if (cirDataAnalysis != null) { var ascxCirViewer = (ascx_CirDataViewer) O2AscxGUI.getAscx(cirViewerControlName); if (ascxCirViewer != null) { ascxCirViewer.loadCirDataAnalysisObject(cirDataAnalysis); ascxCirViewer.updateCirDataStats(); } } }
public static void calculateXrefs_SuperClases_recursive(ICirDataAnalysis cirDataAnalysis, String sSuperClassCustomSignature, ICirClass ccClassToFollow) { sSuperClassCustomSignature = String.Format("{0}. <- {1}", sSuperClassCustomSignature, ccClassToFollow.Signature.Replace('.', '_')); if (false == cirDataAnalysis.lCirClass_bySuperClass.Contains(sSuperClassCustomSignature)) { cirDataAnalysis.lCirClass_bySuperClass.Add(sSuperClassCustomSignature); } foreach (CirClass ccIsSuperClassedBy in ccClassToFollow.dIsSuperClassedBy.Values) { calculateXrefs_SuperClases_recursive(cirDataAnalysis, sSuperClassCustomSignature, ccIsSuperClassedBy); } }
public static ICirData createCirDataFromCirDataAnalysis(ICirDataAnalysis cirDataAnalysis) { if (cirDataAnalysis == null) { return(null); } var cirData = new CirData { dClasses_bySignature = cirDataAnalysis.dCirClass_bySignature, dFunctions_bySignature = cirDataAnalysis.dCirFunction_bySignature, }; return(cirData); }
void o2MessageQueue_onMessages(IO2Message o2Message) { if (o2Message is IM_CirAction) { var cirAction = (IM_CirAction)o2Message; switch (cirAction.CirAction) { case IM_CirActions.setCirDataAnalysis: cirDataAnalysis = cirAction.CirDataAnalysis; LoadClassInfo(); break; } } }
public static void remapSuperClassesXrefs(ICirDataAnalysis cirDataAnalysis) { // first clear all xrefs foreach (ICirClass cirClass in cirDataAnalysis.dCirClass_bySignature.Values.ToList()) { cirClass.dIsSuperClassedBy = new Dictionary <string, ICirClass>(); } // now map the supperclases and IsSuperClassedBy foreach (ICirClass cirClass in cirDataAnalysis.dCirClass_bySignature.Values.ToList()) { foreach (string superClassSignature in cirClass.dSuperClasses.Keys.ToList()) { // make sure the dSuperClasses is mapped //if (cirClass.dSuperClasses[superClassSignature] == null) if (cirDataAnalysis.dCirClass_bySignature.ContainsKey(superClassSignature)) { if (cirClass.dSuperClasses[superClassSignature] == null) { cirClass.dSuperClasses[superClassSignature] = cirDataAnalysis.dCirClass_bySignature[superClassSignature]; } else { if (cirClass.dSuperClasses[superClassSignature] != cirDataAnalysis.dCirClass_bySignature[superClassSignature]) { } } } else { cirDataAnalysis.dCirClass_bySignature.Add(superClassSignature, new CirClass(superClassSignature)); cirClass.dSuperClasses[superClassSignature] = cirDataAnalysis.dCirClass_bySignature[superClassSignature]; } // now map dIsSuperClassedBy cirDataAnalysis.dCirClass_bySignature[superClassSignature].dIsSuperClassedBy.Add(cirClass.Signature, cirClass); } } /*foreach (ICirClass cirClass in cirDataAnalysis.dCirClass_bySignature.Values.ToList()) * foreach (string superClassSignature in cirClass.dSuperClasses.Keys.ToList()) * if (cirClass.dSuperClasses[superClassSignature] == null) * if (cirDataAnalysis.dCirClass_bySignature.ContainsKey(superClassSignature)) * cirClass.dSuperClasses[superClassSignature] = cirDataAnalysis.dCirClass_bySignature[superClassSignature]; * else * { * cirDataAnalysis.dCirClass_bySignature.Add(superClassSignature, new CirClass(superClassSignature)); * cirClass.dSuperClasses[superClassSignature] = cirDataAnalysis.dCirClass_bySignature[superClassSignature]; * }*/ }
public static string createO2AssessmentWithCallFlowTraces(ICirDataAnalysis cirDataAnalysis) { DI.log.info("Creating O2Assessment With Call Flow Traces"); var timer = new O2Timer("Created list of finding").start(); var cirFunctionsToProcess = cirDataAnalysis.dCirFunction_bySignature.Values; var o2Findings = createO2FindingsFromCirFunctions(cirFunctionsToProcess); timer.stop(); timer = new O2Timer("Saved Assessment").start(); var o2Assessment = new O2Assessment(); o2Assessment.o2Findings = o2Findings; var savedFile = o2Assessment.save(new O2AssessmentSave_OunceV6()); DI.log.info("Saved O2Asssessment file created: {0}", savedFile); timer.stop(); return savedFile; }
public static string createO2AssessmentWithCallFlowTraces(ICirDataAnalysis cirDataAnalysis) { DI.log.info("Creating O2Assessment With Call Flow Traces"); var timer = new O2Timer("Created list of finding").start(); var cirFunctionsToProcess = cirDataAnalysis.dCirFunction_bySignature.Values; var o2Findings = createO2FindingsFromCirFunctions(cirFunctionsToProcess); timer.stop(); timer = new O2Timer("Saved Assessment").start(); var o2Assessment = new O2Assessment(); o2Assessment.o2Findings = o2Findings; var savedFile = o2Assessment.save(new O2AssessmentSave_OunceV6()); DI.log.info("Saved O2Asssessment file created: {0}", savedFile); timer.stop(); return(savedFile); }
public static void remapXrefs(ICirDataAnalysis cirDataAnalysis) { DI.log.debug("Remapping Methods and Classes XReferences"); var timer = new O2Timer("Remapping XRefs took: {0}").start(); remapIsCalledByXrefs(cirDataAnalysis); // make sure everythings is pointing to the correct place calculateXrefs_SuperClases(cirDataAnalysis); // ensure all the methods are mapped to the correct class foreach (var cirClass in cirDataAnalysis.dCirClass_bySignature.Values) { foreach (var cirFunction in cirClass.dFunctions.Values) { cirFunction.ParentClass = cirClass; cirFunction.ParentClassFullName = cirClass.FullName; cirFunction.ParentClassName = cirClass.Name; } } timer.stop(); }
private static void addClass(ICirDataAnalysis cirDataAnalysis, ICirClass ccCirClass) { if (cirDataAnalysis.dCirClass_bySignature.ContainsKey(ccCirClass.Signature)) { var mainRefCirClass = cirDataAnalysis.dCirClass_bySignature[ccCirClass.Signature]; if (mainRefCirClass != ccCirClass) // if they are diferent we need to sync the superclasses dictionary { foreach (var superclass in ccCirClass.dSuperClasses.Keys) { if (false == mainRefCirClass.dSuperClasses.ContainsKey(superclass)) { mainRefCirClass.dSuperClasses.Add(superclass, ccCirClass.dSuperClasses[superclass]); } } } } else { } foreach (ICirFunction cfCirFunction in ccCirClass.dFunctions.Values) // if (cfCirFunction.HasControlFlowGraph) { if (false == cirDataAnalysis.dCirFunction.ContainsKey(cfCirFunction)) { cirDataAnalysis.dCirFunction.Add(cfCirFunction, ccCirClass); } // we need this cross check with ccCirClass since we will it to resolve cfCirFunction data if (false == cirDataAnalysis.dCirFunction_bySignature.ContainsKey(cfCirFunction.FunctionSignature)) { addFunction(cirDataAnalysis, cfCirFunction); } else { var functionHost = cirDataAnalysis.dCirFunction_bySignature[cfCirFunction.FunctionSignature]; var functionToMerge = cfCirFunction; mergeFunctions(cirDataAnalysis, functionHost, functionToMerge); } } }
public static void calculateAllTracesFromFunction(String sSignature, TreeNodeCollection tncTraces, List <String> lFunctionsCalled, String sFilter_Signature, String sFilter_Parameter, bool bUseIsCalledBy, ICirDataAnalysis fcdAnalysis) { TreeNode tnNewTreeNode = O2Forms.newTreeNode(sSignature, sSignature, 0, sSignature); tncTraces.Add(tnNewTreeNode); if (fcdAnalysis.dCirFunction_bySignature.ContainsKey(sSignature)) { ICirFunction cfCirFunction = fcdAnalysis.dCirFunction_bySignature[sSignature]; List <ICirFunction> lsFunctions = new List <ICirFunction>(); if (bUseIsCalledBy) { foreach (var cirFunctionCall in cfCirFunction.FunctionIsCalledBy) { lsFunctions.Add(cirFunctionCall.cirFunction); } } else { lsFunctions.AddRange(cfCirFunction.FunctionsCalledUniqueList); } foreach (ICirFunction cirFunction in lsFunctions) { if (false == lFunctionsCalled.Contains(cirFunction.FunctionSignature)) { lFunctionsCalled.Add(cirFunction.FunctionSignature); calculateAllTracesFromFunction(cirFunction.FunctionSignature, tnNewTreeNode.Nodes, lFunctionsCalled, sFilter_Signature, sFilter_Parameter, bUseIsCalledBy, fcdAnalysis); } else { tnNewTreeNode.Nodes.Add("(Circular ref) : " + cirFunction.FunctionSignature); } } } }
private static ICirFunction syncFunctions(ICirDataAnalysis cirDataAnalysis, ICirFunction cirFunctionToSync) { try { var functionRef = getFunctionRef(cirDataAnalysis, cirFunctionToSync); //var functionCalled = cirFunction.FunctionsCalledSequence[i]; if (cirFunctionToSync.GetHashCode() != functionRef.GetHashCode()) { mergeFunctions(cirDataAnalysis, functionRef, cirFunctionToSync); } //cirFunction.FunctionsCalledSequence[i] = functionRef; return(functionRef); } catch (Exception ex) { DI.log.error("in CirDataAnalysisUtils.syncFunctions, for function {1} : {1}", cirFunctionToSync.FunctionSignature, ex.Message); } return(cirFunctionToSync); }
public static ICirData addO2CirDataFile(ICirDataAnalysis cirDataAnalysis, String sO2CirFileToAdd, bool useCachedVersionIfAvailable) { ICirData cirData; if (useCachedVersionIfAvailable && cirDataAnalysis.dCirDataFilesLoaded.ContainsKey(sO2CirFileToAdd)) { //DI.log.debug("O2CirData file already loaded: {0}", sO2CirFileToAdd); cirData = cirDataAnalysis.dCirDataFilesLoaded[sO2CirFileToAdd]; } else { // vars.set_(sO2CirFileToAdd, null); // force reload of the o2cirdata file //cirDataAnalysis.dCirDataFilesLoaded.Clear(); cirData = CirLoad.loadFile(sO2CirFileToAdd); if (cirData == null || cirData.dClasses_bySignature == null) // || cirData.lFiles.Count == 0) return null; // add to main list if (cirDataAnalysis.dCirDataFilesLoaded.ContainsKey(sO2CirFileToAdd)) cirDataAnalysis.dCirDataFilesLoaded[sO2CirFileToAdd] = cirData; else cirDataAnalysis.dCirDataFilesLoaded.Add(sO2CirFileToAdd, cirData); } return addO2CirDataFile(cirDataAnalysis, cirData); }
private void clearLoadedData() { cirDataAnalysis = new CirDataAnalysis(); raiseSetCirDataAnalysisO2Message(); }
public static ICirFunction getFunctionRef(ICirDataAnalysis cirDataAnalysis, ICirFunction cirFunction) { if (false == cirDataAnalysis.dCirFunction_bySignature.ContainsKey(cirFunction.FunctionSignature)) cirDataAnalysis.dCirFunction_bySignature.Add(cirFunction.FunctionSignature, cirFunction); return cirDataAnalysis.dCirFunction_bySignature[cirFunction.FunctionSignature]; }
public static void loadFileIntoCirDataAnalysisObject(string sFileToLoad, ICirDataAnalysis cirDataAnalysis, bool decompileCodeIfNoPdb) { loadFileIntoCirDataAnalysisObject(sFileToLoad, cirDataAnalysis, true, true /*useCachedVersionIfAvailable*/ , true /*runRemapXrefs*/, decompileCodeIfNoPdb); }
public static void saveCirDataAnalysisObjectAsCirDataFile(ICirDataAnalysis cirDataAnalysis, string savedCirDataFile) { var cirData = createCirDataFromCirDataAnalysis(cirDataAnalysis); CirDataUtils.saveSerializedO2CirDataObjectToFile(cirData, savedCirDataFile); }
public static void removeO2CirDataFile(ICirDataAnalysis cirDataAnalysis, String sO2CirDataFileToRemove) { if (cirDataAnalysis.dCirDataFilesLoaded.ContainsKey(sO2CirDataFileToRemove)) { ICirData fcdCirData = cirDataAnalysis.dCirDataFilesLoaded[sO2CirDataFileToRemove]; cirDataAnalysis.dCirDataFilesLoaded.Remove(sO2CirDataFileToRemove); foreach (ICirClass ccCirClass in fcdCirData.dClasses_bySignature.Values) if (cirDataAnalysis.dCirClass.ContainsKey(ccCirClass)) { cirDataAnalysis.dCirClass.Remove(ccCirClass); cirDataAnalysis.dCirClass_bySignature.Remove(ccCirClass.Signature); foreach (ICirFunction cfCirFunction in ccCirClass.dFunctions.Values) if (cirDataAnalysis.dCirFunction.ContainsKey(cfCirFunction)) { cirDataAnalysis.dCirFunction.Remove(cfCirFunction); cirDataAnalysis.dCirFunction_bySignature.Remove(cfCirFunction.FunctionSignature); } else { } } else { } showStatsOfLoadedData(cirDataAnalysis); } }
public static ICirDataSearchResult executeSearch(ICirDataAnalysis cirDataAnalysis) { var fcdSearchResult = new CirDataSearchResult(cirDataAnalysis); CirSearch.executeSearch(fcdSearchResult); return fcdSearchResult; }
public static ICirData addO2CirDataFile(ICirDataAnalysis cirDataAnalysis, ICirData cirData) { return addO2CirDataFile(cirDataAnalysis, cirData, true /* runRemapXrefs */); }
public static ICirData addO2CirDataFile(ICirDataAnalysis cirDataAnalysis, ICirData cirData, bool runRemapXrefs) { if (cirData == null) return null; // check for sDbId (will be needed to get data from Ounce Db if (!String.IsNullOrEmpty(cirDataAnalysis.sDb_Id) && cirDataAnalysis.sDb_Id != cirData.sDbId) DI.log.error( "The O2CirData files have different Db_Ids, The rules creation will use the last one loaded:{0}", cirData.sDbId); if (String.IsNullOrEmpty(cirDataAnalysis.sDb_Id)) cirDataAnalysis.sDb_Id = cirData.sDbId; // add classes with ControlFlowGraphs to list of classes to process var sClasses = new List<string>(cirData.dClasses_bySignature.Keys); sClasses.Sort(); //cirDataAnalysis.dCirClass.Clear(); foreach (ICirClass ccCirClass in cirData.dClasses_bySignature.Values) { //if (ccCirClass.bClassHasMethodsWithControlFlowGraphs && false == cirDataAnalysis.dCirClass.ContainsKey(ccCirClass)) try { // if (false == cirDataAnalysis.dCirClass.ContainsKey(ccCirClass)) // cirDataAnalysis.dCirClass.Add(ccCirClass, cirData); if (false == cirDataAnalysis.dCirClass_bySignature.ContainsKey(ccCirClass.Signature)) { cirDataAnalysis.dCirClass_bySignature.Add(ccCirClass.Signature, ccCirClass); addClass(cirDataAnalysis, ccCirClass); if (false == cirDataAnalysis.dCirClass.ContainsKey(ccCirClass)) cirDataAnalysis.dCirClass.Add(ccCirClass, cirData); } else { var classHost = cirDataAnalysis.dCirClass_bySignature[ccCirClass.Signature]; var classToMerge = ccCirClass; mergeClasses(cirDataAnalysis, classHost, classToMerge); } } catch (Exception ex) { DI.log.debug("in addO2CirDataFile : {0}", ex.Message); //DC: to-do: debug the cases where this exception is triggered } } /* var methodtofind = "System.Data!System.Int32 System.Data.IDataRecord::GetOrdinal(System.String)"; if (cirData.dFunctions_bySignature.ContainsKey(methodtofind)) { } if (cirDataAnalysis.dCirFunction_bySignature.ContainsKey(methodtofind)) { }*/ //if (true) if (runRemapXrefs) { remapXrefs(cirDataAnalysis); showStatsOfLoadedData(cirDataAnalysis); } else // if we are not remapping the XRefs then remove any FunctionIsCalledBy that are there (since some might be wrong) { foreach (var cirFunction in cirData.dFunctions_bySignature.Values) cirFunction.FunctionIsCalledBy = new List<ICirFunctionCall>(); } return cirData; }
private static void addFunction(ICirDataAnalysis cirDataAnalysis, ICirFunction cirFunction) { cirDataAnalysis.dCirFunction_bySignature.Add(cirFunction.FunctionSignature, cirFunction); }
public static void remapSuperClassesXrefs(ICirDataAnalysis cirDataAnalysis) { // first clear all xrefs foreach (ICirClass cirClass in cirDataAnalysis.dCirClass_bySignature.Values.ToList()) { cirClass.dIsSuperClassedBy = new Dictionary<string, ICirClass>(); } // now map the supperclases and IsSuperClassedBy foreach (ICirClass cirClass in cirDataAnalysis.dCirClass_bySignature.Values.ToList()) { foreach (string superClassSignature in cirClass.dSuperClasses.Keys.ToList()) { // make sure the dSuperClasses is mapped //if (cirClass.dSuperClasses[superClassSignature] == null) if (cirDataAnalysis.dCirClass_bySignature.ContainsKey(superClassSignature)) if (cirClass.dSuperClasses[superClassSignature] == null) cirClass.dSuperClasses[superClassSignature] = cirDataAnalysis.dCirClass_bySignature[superClassSignature]; else { if (cirClass.dSuperClasses[superClassSignature] != cirDataAnalysis.dCirClass_bySignature[superClassSignature]) { } } else { cirDataAnalysis.dCirClass_bySignature.Add(superClassSignature, new CirClass(superClassSignature)); cirClass.dSuperClasses[superClassSignature] = cirDataAnalysis.dCirClass_bySignature[superClassSignature]; } // now map dIsSuperClassedBy cirDataAnalysis.dCirClass_bySignature[superClassSignature].dIsSuperClassedBy.Add(cirClass.Signature, cirClass); } } /*foreach (ICirClass cirClass in cirDataAnalysis.dCirClass_bySignature.Values.ToList()) foreach (string superClassSignature in cirClass.dSuperClasses.Keys.ToList()) if (cirClass.dSuperClasses[superClassSignature] == null) if (cirDataAnalysis.dCirClass_bySignature.ContainsKey(superClassSignature)) cirClass.dSuperClasses[superClassSignature] = cirDataAnalysis.dCirClass_bySignature[superClassSignature]; else { cirDataAnalysis.dCirClass_bySignature.Add(superClassSignature, new CirClass(superClassSignature)); cirClass.dSuperClasses[superClassSignature] = cirDataAnalysis.dCirClass_bySignature[superClassSignature]; }*/ }
public static void showStatsOfLoadedData(ICirDataAnalysis cirDataAnalysis) { DI.log.debug("There are {0} CirData files loaded with {1} classes and {2} functions", cirDataAnalysis.dCirDataFilesLoaded.Count, cirDataAnalysis.dCirClass.Count, cirDataAnalysis.dCirFunction.Count); }
public static void loadFileIntoCirDataAnalysisObject(string sFileToLoad, ICirDataAnalysis cirDataAnalysis) { loadFileIntoCirDataAnalysisObject(sFileToLoad, cirDataAnalysis, false /*decompileCodeIfNoPdb*/); }
public static void loadFileIntoCirDataAnalysisObject(string sFileToLoad, ICirDataAnalysis cirDataAnalysis, bool showNotSupportedExtensionError, bool useCachedVersionIfAvailable, bool runRemapXrefs, bool decompileCodeIfNoPdb) { try { switch (Path.GetExtension(sFileToLoad).ToLower()) { case ".cirdata": addO2CirDataFile(cirDataAnalysis, sFileToLoad, useCachedVersionIfAvailable); break; case ".dll": case ".exe": if (CecilUtils.isDotNetAssembly(sFileToLoad, false)) { ICirData assemblyCirData = new CirData(); new CirFactory().processAssemblyDefinition(assemblyCirData, CecilUtils.getAssembly(sFileToLoad), sFileToLoad, decompileCodeIfNoPdb); if (assemblyCirData.dClasses_bySignature.Count == 0) { DI.log.error("There were no classes imporeted from the file: {0}", sFileToLoad); } else { var fileName = Path.GetFileName(sFileToLoad); if (false == cirDataAnalysis.dCirDataFilesLoaded.ContainsKey(fileName)) { cirDataAnalysis.dCirDataFilesLoaded.Add(Path.GetFileName(sFileToLoad), assemblyCirData); } addO2CirDataFile(cirDataAnalysis, assemblyCirData, runRemapXrefs); } } else { DI.log.error("Droped *.exe or *.dll file was not a .Net assembly: {0}", sFileToLoad); } break; case "*.xml": if (CirLoad.isFileACirDumpFile(sFileToLoad)) { addO2CirDataFile(cirDataAnalysis, sFileToLoad, useCachedVersionIfAvailable); } break; default: if (showNotSupportedExtensionError) { DI.log.error( "Could not process file dropped (it it not a CirData file or a .NET assembly: {0}", sFileToLoad); } break; } } catch (Exception ex) { DI.log.error( "in loadFileIntoCirDataAnalysisObject, error {0} while loading {1} : ", sFileToLoad, ex.Message); } }
public static void loadFileIntoCirDataAnalysisObject(string sFileToLoad, ICirDataAnalysis cirDataAnalysis, bool decompileCodeIfNoPdb) { loadFileIntoCirDataAnalysisObject(sFileToLoad, cirDataAnalysis, true, true /*useCachedVersionIfAvailable*/, true /*runRemapXrefs*/, decompileCodeIfNoPdb); }
public static void calculateXrefs_SuperClases(ICirDataAnalysis cirDataAnalysis) { try { // first make sure the super classes are pointing to null /* foreach (ICirClass cirClass in cirDataAnalysis.dCirClass_bySignature.Values.ToList()) foreach (string superClassSignature in cirClass.dSuperClasses.Keys.ToList()) if (cirClass.dSuperClasses[superClassSignature] == null) if (cirDataAnalysis.dCirClass_bySignature.ContainsKey(superClassSignature)) cirClass.dSuperClasses[superClassSignature] = cirDataAnalysis.dCirClass_bySignature[superClassSignature]; else { cirDataAnalysis.dCirClass_bySignature.Add(superClassSignature,new CirClass(superClassSignature)); cirClass.dSuperClasses[superClassSignature] = cirDataAnalysis.dCirClass_bySignature[superClassSignature]; }*/ bool ignoreJavaLangObjectCount = true; int iIgnoredJavaLangObjectCount = 0; foreach (ICirClass ccCirClass in cirDataAnalysis.dCirClass_bySignature.Values) foreach (ICirClass ccSuperClass in ccCirClass.dSuperClasses.Values) { if (ignoreJavaLangObjectCount && (ccSuperClass.Signature == "java.lang.Object" || ccSuperClass.Signature == "System.Object")) iIgnoredJavaLangObjectCount++; else { calculateXrefs_SuperClases_recursive(cirDataAnalysis, ccSuperClass.Signature, ccCirClass); //dCirClass_bySuperClass_Simple[sSuperClassCustomSignature].Add(ccCirClass); // foreach (CirClass ccIsSuperClassedBy in ccSuperClass.dIsSuperClassedBy.Values) // { // String sIsSuperClassedByCustomSignature = String.Format("{0}.<-.{1}", sSuperClassCustomSignature, ccIsSuperClassedBy.FunctionSignature.Replace('.', '_')); // dCirClass_bySuperClass_Simple.Add(sIsSuperClassedByCustomSignature, null); // } } /* if (false == dCirClass_bySuperClass_Recursive.ContainsKey(ccSuperClass.FunctionSignature)) dCirClass_bySuperClass_Recursive.Add(ccSuperClass.FunctionSignature, new List<CirClass>()); dCirClass_bySuperClass_Recursive[ccSuperClass.FunctionSignature].Add(ccCirClass); */ // calculateXrefs_SuperClases_recursive(sSuperClass); } if (iIgnoredJavaLangObjectCount > 0) DI.log.debug("# of Ignored java.lang.Object:{0}", iIgnoredJavaLangObjectCount); if (cirDataAnalysis.lCirClass_bySuperClass.Count > 0) DI.log.debug("# of SuperClass mappings:{0}", cirDataAnalysis.lCirClass_bySuperClass.Count); } catch (Exception ex) { DI.log.error("in calculateXrefs_SuperClases:{0}", ex.Message); } }
public static ICirData addO2CirDataFile(ICirDataAnalysis cirDataAnalysis, ICirData cirData, bool runRemapXrefs) { if (cirData == null) { return(null); } // check for sDbId (will be needed to get data from Ounce Db if (!String.IsNullOrEmpty(cirDataAnalysis.sDb_Id) && cirDataAnalysis.sDb_Id != cirData.sDbId) { DI.log.error( "The O2CirData files have different Db_Ids, The rules creation will use the last one loaded:{0}", cirData.sDbId); } if (String.IsNullOrEmpty(cirDataAnalysis.sDb_Id)) { cirDataAnalysis.sDb_Id = cirData.sDbId; } // add classes with ControlFlowGraphs to list of classes to process var sClasses = new List <string>(cirData.dClasses_bySignature.Keys); sClasses.Sort(); //cirDataAnalysis.dCirClass.Clear(); foreach (ICirClass ccCirClass in cirData.dClasses_bySignature.Values) { //if (ccCirClass.bClassHasMethodsWithControlFlowGraphs && false == cirDataAnalysis.dCirClass.ContainsKey(ccCirClass)) try { // if (false == cirDataAnalysis.dCirClass.ContainsKey(ccCirClass)) // cirDataAnalysis.dCirClass.Add(ccCirClass, cirData); if (false == cirDataAnalysis.dCirClass_bySignature.ContainsKey(ccCirClass.Signature)) { cirDataAnalysis.dCirClass_bySignature.Add(ccCirClass.Signature, ccCirClass); addClass(cirDataAnalysis, ccCirClass); if (false == cirDataAnalysis.dCirClass.ContainsKey(ccCirClass)) { cirDataAnalysis.dCirClass.Add(ccCirClass, cirData); } } else { var classHost = cirDataAnalysis.dCirClass_bySignature[ccCirClass.Signature]; var classToMerge = ccCirClass; mergeClasses(cirDataAnalysis, classHost, classToMerge); } } catch (Exception ex) { DI.log.debug("in addO2CirDataFile : {0}", ex.Message); //DC: to-do: debug the cases where this exception is triggered } } /* var methodtofind = "System.Data!System.Int32 System.Data.IDataRecord::GetOrdinal(System.String)"; * if (cirData.dFunctions_bySignature.ContainsKey(methodtofind)) * { * } * if (cirDataAnalysis.dCirFunction_bySignature.ContainsKey(methodtofind)) * { * }*/ //if (true) if (runRemapXrefs) { remapXrefs(cirDataAnalysis); showStatsOfLoadedData(cirDataAnalysis); } else // if we are not remapping the XRefs then remove any FunctionIsCalledBy that are there (since some might be wrong) { foreach (var cirFunction in cirData.dFunctions_bySignature.Values) { cirFunction.FunctionIsCalledBy = new List <ICirFunctionCall>(); } } return(cirData); }
public static void remapIsCalledByXrefs(ICirDataAnalysis cirDataAnalysis) { try { remapSuperClassesXrefs(cirDataAnalysis); var timer = new O2Timer("remapIsCalledByXrefs").start(); // first clear all Xref foreach (var cirFunction in cirDataAnalysis.dCirFunction_bySignature.Values) cirFunction.FunctionIsCalledBy = new List<ICirFunctionCall>(); // make sure all FunctionsCalledUniqueList and FunctionsCalled are syncronized with dCirFunction_bySignature var functionsToMap = cirDataAnalysis.dCirFunction_bySignature.Values.ToList().Count; var functionsProcessed = 0; foreach (var cirFunction in cirDataAnalysis.dCirFunction_bySignature.Values.ToList()) { for (int i = 0; i < cirFunction.FunctionsCalledUniqueList.Count; i++) cirFunction.FunctionsCalledUniqueList[i] = syncFunctions(cirDataAnalysis, cirFunction.FunctionsCalledUniqueList[i]); for (int i = 0; i < cirFunction.FunctionsCalled.Count; i++) cirFunction.FunctionsCalled[i].cirFunction = syncFunctions(cirDataAnalysis, cirFunction.FunctionsCalled[i].cirFunction); if ((functionsProcessed++) % 500 == 0) DI.log.info(" processed {0} / {1}", functionsProcessed, functionsToMap); } // check the FunctionsCalledUniqueList is calledby mappngs foreach (var cirFunction in cirDataAnalysis.dCirFunction_bySignature.Values) foreach (var functionCalled in cirFunction.FunctionsCalled) { var functionCalledXref = getFunctionRef(cirDataAnalysis, functionCalled.cirFunction); /*if (false == cirDataAnalysis.dCirFunction_bySignature.ContainsValue(functionCalled)) DI.log.error("in remapIsCalledByXrefs something is wrong because the called fucntions does not have a cirFunction mapping: {0}", functionCalled.FunctionSignature); else //{*/ bool found = false; foreach (var functionCall in functionCalled.cirFunction.FunctionIsCalledBy) if (functionCall.cirFunction == functionCalledXref) found = true; if (found == false) functionCalled.cirFunction.FunctionIsCalledBy.Add(new CirFunctionCall(cirFunction, functionCalled.fileName, functionCalled.lineNumber)); //if (false == functionCalledXref.FunctionIsCalledBy.Contains(cirFunction)) // functionCalledXref.FunctionIsCalledBy.Add(cirFunction); } // make sure all functions are syncronized with dCirFunction_bySignature foreach (var cirFunction in cirDataAnalysis.dCirFunction_bySignature.Values) for (int i = 0; i < cirFunction.FunctionsCalledUniqueList.Count; i++) cirFunction.FunctionsCalledUniqueList[i] = syncFunctions(cirDataAnalysis, cirFunction.FunctionsCalledUniqueList[i]); // endure all iscalledby are correcly mapped foreach (var cirFunction in cirDataAnalysis.dCirFunction_bySignature.Values) for (int i = 0; i < cirFunction.FunctionIsCalledBy.Count; i++) cirFunction.FunctionIsCalledBy[i].cirFunction = syncFunctions(cirDataAnalysis, cirFunction.FunctionIsCalledBy[i].cirFunction); // make sure there is a reference to this function on the Classes Dictionanry foreach (var cirFunction in cirDataAnalysis.dCirFunction_bySignature.Values) foreach (var functionCalled in cirFunction.FunctionsCalled) if (functionCalled.cirFunction.ParentClass == null) { var functionSignature = new FilteredSignature(functionCalled.cirFunction.FunctionSignature); var parentClassName = functionSignature.sFunctionClass; if (false == cirDataAnalysis.dCirClass_bySignature.ContainsKey(parentClassName)) cirDataAnalysis.dCirClass_bySignature.Add(parentClassName, new CirClass(parentClassName)); var parentCirClass = cirDataAnalysis.dCirClass_bySignature[parentClassName]; var functionAlreadyMappedToClass = false; foreach (var cirFunctionMappedToClass in parentCirClass.dFunctions.Values) if (cirFunctionMappedToClass.FunctionSignature == functionCalled.cirFunction.FunctionSignature) functionAlreadyMappedToClass = true; if (false == functionAlreadyMappedToClass) parentCirClass.dFunctions.Add(functionCalled.cirFunction.FunctionSignature, functionCalled.cirFunction); functionCalled.cirFunction.ParentClass = parentCirClass; functionCalled.cirFunction.ParentClassName = parentCirClass.Name; functionCalled.cirFunction.ParentClassFullName = parentCirClass.FullName; } timer.stop(); } catch (Exception ex) { DI.log.error("in remapIsCalledByXrefs: {0}", ex.Message); } }
public static Thread setCirDataAnalysis(ICirDataAnalysis cirDataAnalysis) { return(DI.o2MessageQueue.sendMessage(KM_CirAction.setCirDataAnalysis(cirDataAnalysis))); }
private static ICirFunction syncFunctions(ICirDataAnalysis cirDataAnalysis, ICirFunction cirFunctionToSync) { try { var functionRef = getFunctionRef(cirDataAnalysis, cirFunctionToSync); //var functionCalled = cirFunction.FunctionsCalledSequence[i]; if (cirFunctionToSync.GetHashCode() != functionRef.GetHashCode()) mergeFunctions(cirDataAnalysis, functionRef, cirFunctionToSync); //cirFunction.FunctionsCalledSequence[i] = functionRef; return functionRef; } catch (Exception ex) { DI.log.error("in CirDataAnalysisUtils.syncFunctions, for function {1} : {1}", cirFunctionToSync.FunctionSignature, ex.Message); } return cirFunctionToSync; }
public void setO2CirDataAnalysisObject(ICirDataAnalysis _cirDataAnalysis) { cirDataAnalysis = _cirDataAnalysis; }
public static void calculateXrefs_SuperClases_recursive(ICirDataAnalysis cirDataAnalysis, String sSuperClassCustomSignature, ICirClass ccClassToFollow) { sSuperClassCustomSignature = String.Format("{0}. <- {1}", sSuperClassCustomSignature, ccClassToFollow.Signature.Replace('.', '_')); if (false == cirDataAnalysis.lCirClass_bySuperClass.Contains(sSuperClassCustomSignature)) cirDataAnalysis.lCirClass_bySuperClass.Add(sSuperClassCustomSignature); foreach (CirClass ccIsSuperClassedBy in ccClassToFollow.dIsSuperClassedBy.Values) calculateXrefs_SuperClases_recursive(cirDataAnalysis, sSuperClassCustomSignature, ccIsSuperClassedBy); }
public static void remapXrefs(ICirDataAnalysis cirDataAnalysis) { DI.log.debug("Remapping Methods and Classes XReferences"); var timer = new O2Timer("Remapping XRefs took: {0}").start(); remapIsCalledByXrefs(cirDataAnalysis); // make sure everythings is pointing to the correct place calculateXrefs_SuperClases(cirDataAnalysis); // ensure all the methods are mapped to the correct class foreach(var cirClass in cirDataAnalysis.dCirClass_bySignature.Values) foreach(var cirFunction in cirClass.dFunctions.Values) { cirFunction.ParentClass = cirClass; cirFunction.ParentClassFullName = cirClass.FullName; cirFunction.ParentClassName = cirClass.Name; } timer.stop(); }
private static void addClass(ICirDataAnalysis cirDataAnalysis, ICirClass ccCirClass) { if (cirDataAnalysis.dCirClass_bySignature.ContainsKey(ccCirClass.Signature)) { var mainRefCirClass = cirDataAnalysis.dCirClass_bySignature[ccCirClass.Signature]; if (mainRefCirClass != ccCirClass) // if they are diferent we need to sync the superclasses dictionary { foreach (var superclass in ccCirClass.dSuperClasses.Keys) if (false == mainRefCirClass.dSuperClasses.ContainsKey(superclass)) mainRefCirClass.dSuperClasses.Add(superclass, ccCirClass.dSuperClasses[superclass]); } } else { } foreach (ICirFunction cfCirFunction in ccCirClass.dFunctions.Values) // if (cfCirFunction.HasControlFlowGraph) { if (false == cirDataAnalysis.dCirFunction.ContainsKey(cfCirFunction)) cirDataAnalysis.dCirFunction.Add(cfCirFunction, ccCirClass); // we need this cross check with ccCirClass since we will it to resolve cfCirFunction data if (false == cirDataAnalysis.dCirFunction_bySignature.ContainsKey(cfCirFunction.FunctionSignature)) addFunction(cirDataAnalysis, cfCirFunction); else { var functionHost = cirDataAnalysis.dCirFunction_bySignature[cfCirFunction.FunctionSignature]; var functionToMerge = cfCirFunction; mergeFunctions(cirDataAnalysis, functionHost, functionToMerge); } } }
// need to check of other class values public static void mergeClasses(ICirDataAnalysis cirDataAnalysis, ICirClass classHost, ICirClass classToMerge) { foreach (var propertyInfo in DI.reflection.getProperties(typeof(ICirClass))) if (DI.reflection.getProperty(propertyInfo.Name, classHost) == null && DI.reflection.getProperty(propertyInfo.Name, classToMerge) != null) DI.reflection.setProperty(propertyInfo.Name, classHost, DI.reflection.getProperty(propertyInfo.Name, classToMerge)); addClass(cirDataAnalysis, classToMerge); }
public static void loadFileIntoCirDataAnalysisObject(string sFileToLoad, ICirDataAnalysis cirDataAnalysis, bool showNotSupportedExtensionError, bool useCachedVersionIfAvailable, bool runRemapXrefs, bool decompileCodeIfNoPdb) { try { switch (Path.GetExtension(sFileToLoad).ToLower()) { case ".cirdata": addO2CirDataFile(cirDataAnalysis, sFileToLoad, useCachedVersionIfAvailable); break; case ".dll": case ".exe": if (CecilUtils.isDotNetAssembly(sFileToLoad, false)) { ICirData assemblyCirData = new CirData(); new CirFactory().processAssemblyDefinition(assemblyCirData, CecilUtils.getAssembly(sFileToLoad), sFileToLoad, decompileCodeIfNoPdb); if (assemblyCirData.dClasses_bySignature.Count == 0) DI.log.error("There were no classes imporeted from the file: {0}", sFileToLoad); else { var fileName = Path.GetFileName(sFileToLoad); if (false == cirDataAnalysis.dCirDataFilesLoaded.ContainsKey(fileName)) { cirDataAnalysis.dCirDataFilesLoaded.Add(Path.GetFileName(sFileToLoad), assemblyCirData); } addO2CirDataFile(cirDataAnalysis, assemblyCirData, runRemapXrefs); } } else DI.log.error("Droped *.exe or *.dll file was not a .Net assembly: {0}", sFileToLoad); break; case "*.xml": if (CirLoad.isFileACirDumpFile(sFileToLoad)) addO2CirDataFile(cirDataAnalysis, sFileToLoad,useCachedVersionIfAvailable); break; default: if (showNotSupportedExtensionError) DI.log.error( "Could not process file dropped (it it not a CirData file or a .NET assembly: {0}", sFileToLoad); break; } } catch (Exception ex) { DI.log.error( "in loadFileIntoCirDataAnalysisObject, error {0} while loading {1} : ", sFileToLoad, ex.Message); } }
// for now only add the mappings, but need to check for all other variables public static void mergeFunctions(ICirDataAnalysis cirDataAnalysis, ICirFunction functionHost, ICirFunction functionToMerge) { // map properties foreach (var propertyInfo in DI.reflection.getProperties(typeof(ICirFunction))) // assign value if for this property: // functionHost == null && functionToMerge != null // functionHost == false && functionToMerge == true if ((DI.reflection.getProperty(propertyInfo.Name, functionHost) == null && DI.reflection.getProperty(propertyInfo.Name, functionToMerge) != null) || (DI.reflection.getProperty(propertyInfo.Name, functionHost) != null && DI.reflection.getProperty(propertyInfo.Name, functionHost) is bool && (bool)DI.reflection.getProperty(propertyInfo.Name, functionHost) == false && DI.reflection.getProperty(propertyInfo.Name, functionToMerge) != null && (bool)DI.reflection.getProperty(propertyInfo.Name, functionToMerge) == true)) DI.reflection.setProperty(propertyInfo.Name, functionHost, DI.reflection.getProperty(propertyInfo.Name, functionToMerge)); // ensure the class bClassHasMethodsWithControlFlowGraphs value is uptodate if (functionHost.HasControlFlowGraph && functionHost.ParentClass != null) functionHost.ParentClass.bClassHasMethodsWithControlFlowGraphs = true; for (int i = 0; i < functionToMerge.FunctionIsCalledBy.Count; i++) { var isCalledBy = functionToMerge.FunctionIsCalledBy[i]; var cirFunctionRef = getFunctionRef(cirDataAnalysis, isCalledBy.cirFunction); // big change here when isCalledBy was changed to be a CirFunctionCall object (check if this works ok) bool found = false; foreach (var functionCall in functionHost.FunctionIsCalledBy) if (functionCall.cirFunction == cirFunctionRef) found = true; if (found == false) functionHost.FunctionIsCalledBy.Add(new CirFunctionCall(cirFunctionRef)); // make sure the is calledBy is there //if (false == functionHost.FunctionIsCalledBy.Contains(cirFunctionRef)) // functionHost.FunctionIsCalledBy.Add(cirFunctionRef); /* if (isCalledBy != cirFunctionRef) // means they are different and we need to fix the xRef functionToMerge.FunctionIsCalledBy[i] = cirFunctionRef;*/ } if (functionToMerge.FunctionsCalled.Count > 0 && functionHost.FunctionsCalled.Count != functionToMerge.FunctionsCalled.Count) { if (functionHost.FunctionsCalled.Count == 0) functionHost.FunctionsCalled = functionToMerge.FunctionsCalled; else DI.log.error("something is wrong in mergeFunctions (on functionHost.FunctionsCalledSequence.Count == 0) for {0}", functionHost.FunctionSignature); } if (functionToMerge.FunctionsCalledUniqueList.Count > 0 && functionHost.FunctionsCalledUniqueList.Count != functionToMerge.FunctionsCalledUniqueList.Count) { if (functionHost.FunctionsCalledUniqueList.Count == 0) functionHost.FunctionsCalledUniqueList = functionToMerge.FunctionsCalledUniqueList; else DI.log.error("something is wrong in mergeFunctions (on functionHost.FunctionsCalledUniqueList.Count == 0) for {0}", functionHost.FunctionSignature); } /*foreach (var isCalledBy in functionToMerge.) { var cirFunctionRef = getFunctionRef(cirDataAnalysis, isCalledBy); if (false == functionHost.FunctionIsCalledBy.Contains(cirFunctionRef)) functionHost.FunctionIsCalledBy.Add(cirFunctionRef); }*/ }
public static ICirData createCirDataFromCirDataAnalysis(ICirDataAnalysis cirDataAnalysis) { if (cirDataAnalysis == null) return null; var cirData = new CirData { dClasses_bySignature = cirDataAnalysis.dCirClass_bySignature, dFunctions_bySignature = cirDataAnalysis.dCirFunction_bySignature, }; return cirData; }
public void setO2CirDataAnalysisObject(ICirDataAnalysis cirDataAalysis) { fcdAnalysis = cirDataAalysis; }