public static bool loadCirDumpXmlFile(String sPathToFileToProcess, ref CommonIRDump cidCommonIrDump,
                                       bool bShowError)
 {
     try
     {
         cidCommonIrDump =
             (CommonIRDump) Serialize.getDeSerializedObjectFromXmlFile(sPathToFileToProcess, typeof (CommonIRDump));
         if (cidCommonIrDump != null)
             return true;
     }
     catch (Exception ex)
     {
         if (bShowError)
             DI.log.error("in loadCirDumpXmlFile: {0}", ex.Message);
     }
     return false;
 }
Esempio n. 2
0
        public static void populateDictionariesWithXrefs(CommonIRDump cidCirDump, ICirData cirData)
        {
            try
            {
                if (cidCirDump == null)
                    return;

                O2Timer tTimer = new O2Timer("Populate Dictionaries With Xrefs").start();

                // files
                addCompilationUnitFiles(cirData,cidCirDump.CommonIR.CompilationUnit);
                
                //addSymbolsFromCirDump_Functions(cirData,cidCirDump.CommonIR.FunctionSigType);

                // calculate the classes

                if (cidCirDump.CommonIR.ClassMethods != null)
                    foreach (CommonIRDumpCommonIRClassMethods cmClass in cidCirDump.CommonIR.ClassMethods)
                    {
                        ICirClass ccCirClass = addClass(cirData,cmClass);

                        // process static methods
                        if (null != cmClass.ClassStaticFunction)
                            foreach (
                                CommonIRDumpCommonIRClassMethodsClassStaticFunction csfStaticFunction in
                                    cmClass.ClassStaticFunction)
                            {
                                addFunction(cirData,csfStaticFunction, ccCirClass);
                            }

                        // process member methods (i.e. non static)
                        if (null != cmClass.ClassMemberFunction)
                            foreach (
                                CommonIRDumpCommonIRClassMethodsClassMemberFunction cmfMemberFunction in
                                    cmClass.ClassMemberFunction)
                            {
                                addFunction(cirData,cmfMemberFunction, ccCirClass);
                            }
                    }
                // calculate the NonClassFunction

                if (cidCirDump.CommonIR.NonClassFunction != null)
                {
                    var signatureForNoClassDef = "<no class def>";
                    var cirNoClass = new CirClass(signatureForNoClassDef);
                    cirData.dClasses_bySignature.Add(signatureForNoClassDef, cirNoClass);
                    foreach (
                        CommonIRDumpCommonIRNonClassFunction ncfNonClassFunction in cidCirDump.CommonIR.NonClassFunction
                        )
                    {
                        /*if (ncfNonClassFunction.UniqueID == "VB6_Builtin.StringConcat(...):void")
                        {
                        }
                        DI.log.debug("in populateDictionariesWithXrefs, adding NonClassdefFunction:{0}", ncfNonClassFunction.UniqueID);
                        */

                        addFunction(cirData, ncfNonClassFunction, cirNoClass);



                        // fcdCirData.addFunction(ncfNonClassFunction, null);
                    }
                }

                //   resolveIsCalledByXrefsProbs();

                // add this here since the Functions and classes signatures should be resolved by now
                addSymbolsFromCommonIr(cirData, cidCirDump.CommonIR);
                mapClassesMetadata(cirData, cidCirDump.SymbolData);
                mapFunctionsMetadata(cirData, cidCirDump.CommonIR.FunctionSigType);                

                resolveDbId(cirData);
                if (cirData.bVerbose)
                    tTimer.stop();
            }
            catch (Exception ex)
            {
                DI.log.error("in populateDictionariesWithXrefs: {0}", ex.Message);
            }
        }