Exemple #1
0
    def run(self):
        """The main function that will be called by command-line execution
        of the tool.

        """
        analysis = self._analysis

        # Dynamically decorate each analysis step
        for step in analysis.pipeline:
            # Time step plus redirect stdout to /dev/null
            step.apply = task_timing(step.message)(stdout_redirected()(
                step.apply))

        # Run analysis while timing each step, plus total time
        with task_timing('total time'):
            analysis.run()

        # Print statistics
        print "\n\n[Statistics]\n"
        print analysis.stats
Exemple #2
0
    def _analyze(cls, filename):
        # Get paths to source and bitcode file
        srcfile = os.path.join(cls.SOURCES_DIR, filename)
        bcfile = rt.FileManager().mktemp(suffix='.bc')

        # Compile bitcode
        compile_bitcode(srcfile, bcfile)

        # Create temporary directory for analysis
        tmpdir = rt.FileManager().mkdtemp()

        try:
            # Run analysis
            config = AnalysisConfig(bcfile, output_dir=tmpdir)
            analysis = Analysis(config)

            with stdout_redirected():
                analysis.enable_exports()
                analysis.run()
        finally:
            os.remove(bcfile)

        return analysis
Exemple #3
0
    def run(self):
        """The main function that will be called by command-line execution
        of the tool.

        """
        analysis = self._analysis

        # Dynamically decorate each analysis step
        for step in analysis.pipeline:
            # Time step plus redirect stdout to /dev/null
            step.apply = task_timing(step.message)(
                stdout_redirected()(
                    step.apply
                )
            )

        # Run analysis while timing each step, plus total time
        with task_timing('total time'):
            analysis.run()

        # Print statistics
        print "\n\n[Statistics]\n"
        print analysis.stats