def setup_basic_blame_experiment( experiment: VersionExperiment, project: Project, report_type: tp.Type[BaseReport] ) -> None: """ Setup the project for a blame experiment. - run time extensions - compile time extensions - prepare compiler - configure C/CXX flags """ # Add the required runtime extensions to the project(s). project.runtime_extension = run.RuntimeExtension(project, experiment) \ << time.RunWithTime() # Add the required compiler extensions to the project(s). project.compiler_extension = compiler.RunCompiler(project, experiment) \ << RunWLLVM() \ << run.WithTimeout() # Add own error handler to compile step. project.compile = get_default_compile_error_wrapped( experiment.get_handle(), project, report_type ) # This c-flag is provided by VaRA and it suggests to use the git-blame # annotation. project.cflags += ["-fvara-GB"]
def actions_for_project( self, project: Project) -> tp.MutableSequence[actions.Step]: """Returns the specified steps to run the project(s) specified in the call in a fixed order.""" # Add the required runtime extensions to the project(s). project.runtime_extension = run.RuntimeExtension(project, self) \ << time.RunWithTime() # Add the required compiler extensions to the project(s). project.compiler_extension = compiler.RunCompiler(project, self) \ << RunWLLVM() \ << run.WithTimeout() # Add own error handler to compile step. project.compile = get_default_compile_error_wrapped( self.get_handle(), project, CR) # This c-flag is provided by VaRA and it suggests to use the git-blame # annotation. project.cflags = ["-fvara-GB"] analysis_actions = [] analysis_actions += get_bc_cache_actions( project, extraction_error_handler=create_default_compiler_error_handler( self.get_handle(), project, self.REPORT_SPEC.main_report)) analysis_actions.append(CRAnalysis(project, self.get_handle())) analysis_actions.append(actions.Clean(project)) return analysis_actions
def actions_for_project( self, project: Project ) -> tp.MutableSequence[actions.Step]: """ Returns the specified steps to run the project(s) specified in the call in a fixed order. Args: project: to analyze """ # Try, to build the project without optimizations to get more precise # blame annotations. Note: this does not guarantee that a project is # build without optimizations because the used build tool/script can # still add optimizations flags after the experiment specified cflags. project.cflags += ["-O1", "-Xclang", "-disable-llvm-optzns", "-g0"] bc_file_extensions = [ BCFileExtensions.NO_OPT, BCFileExtensions.TBAA, ] # Add the required runtime extensions to the project(s). project.runtime_extension = run.RuntimeExtension(project, self) \ << time.RunWithTime() # Add the required compiler extensions to the project(s). project.compiler_extension = compiler.RunCompiler(project, self) \ << RunWLLVM() \ << run.WithTimeout() # Add own error handler to compile step. project.compile = get_default_compile_error_wrapped( self.get_handle(), project, self.REPORT_SPEC.main_report ) analysis_actions = get_bc_cache_actions( project, bc_file_extensions, create_default_compiler_error_handler( self.get_handle(), project, self.REPORT_SPEC.main_report ) ) for _ in range(0, 10): analysis_actions.append( RunGlobalsTestAnalysis(project, self.get_handle(), True) ) analysis_actions.append( RunGlobalsTestAnalysis(project, self.get_handle(), False) ) # Clean up the generated files afterwards analysis_actions.append(actions.Clean(project)) return analysis_actions
def actions_for_project( self, project: Project ) -> tp.MutableSequence[actions.Step]: """ Returns the specified steps to run the project(s) specified in the call in a fixed order. Args: project: to analyze """ # Add tracing markers. fm_provider = FeatureModelProvider.create_provider_for_project(project) if fm_provider is None: raise Exception("Could not get FeatureModelProvider!") fm_path = fm_provider.get_feature_model_path(project.version_of_primary) if fm_path is None or not fm_path.exists(): raise FeatureModelNotFound(project, fm_path) # Sets vara tracing flags project.cflags += [ "-fvara-feature", f"-fvara-fm-path={fm_path.absolute()}", "-fsanitize=vara", "-fvara-instr=usdt", "-flto", "-fuse-ld=lld" ] project.ldflags += ["-flto"] # Add the required runtime extensions to the project(s). project.runtime_extension = run.RuntimeExtension(project, self) \ << bbtime.RunWithTime() # Add the required compiler extensions to the project(s). project.compiler_extension = compiler.RunCompiler(project, self) \ << run.WithTimeout() # Add own error handler to compile step. project.compile = get_default_compile_error_wrapped( self.get_handle(), project, VaraInstrumentationStatsReport ) analysis_actions = [] analysis_actions.append(actions.Compile(project)) analysis_actions.append( CaptureInstrumentationStats(project, self.get_handle()) ) analysis_actions.append(actions.Clean(project)) return analysis_actions
def actions_for_project(self, project: Project) -> tp.List[actions.Step]: """ Returns the specified steps to run the project(s) specified in the call in a fixed order. Args: project: to analyze """ # Add the required runtime extensions to the project(s). project.runtime_extension = run.RuntimeExtension(project, self) \ << time.RunWithTime() # Add the required compiler extensions to the project(s). project.compiler_extension = compiler.RunCompiler(project, self) \ << RunWLLVM() \ << run.WithTimeout() # Add own error handler to compile step. project.compile = get_default_compile_error_wrapped( self.get_handle(), project, self.REPORT_SPEC.main_report) fm_provider = FeatureModelProvider.get_provider_for_project(project) fm_path = fm_provider.get_feature_model_path( project.version_of_primary) project.cflags += [ "-O1", "-Xclang", "-disable-llvm-optzns", "-fvara-feature", "-fvara-fm-path=" + str(fm_path), "-g" ] bc_file_extensions = [ BCFileExtensions.NO_OPT, BCFileExtensions.TBAA, BCFileExtensions.FEATURE, BCFileExtensions.DEBUG ] analysis_actions = [] analysis_actions += get_bc_cache_actions( project, bc_file_extensions, extraction_error_handler=create_default_compiler_error_handler( self.get_handle(), project, self.REPORT_SPEC.main_report)) analysis_actions.append( PhASARFTACheck(project, self.get_handle(), bc_file_extensions)) analysis_actions.append(actions.Clean(project)) return analysis_actions
def actions_for_project( self, project: Project) -> tp.MutableSequence[actions.Step]: """Returns the specified steps to run the project(s) specified in the call in a fixed order.""" fm_provider = FeatureModelProvider.create_provider_for_project(project) if fm_provider is None: raise Exception("Could not get FeatureModelProvider!") fm_path = fm_provider.get_feature_model_path( project.version_of_primary) if fm_path is None or not fm_path.exists(): raise FeatureModelNotFound(project, fm_path) # We need debug info to later determine source code locations in a # utility pass. Also, include feature information. project.cflags += [ "-g", "-fvara-feature", f"-fvara-fm-path={fm_path.absolute()}" ] # Add the required runtime extensions to the project(s). project.runtime_extension = run.RuntimeExtension(project, self) \ << time.RunWithTime() # Add the required compiler extensions to the project(s). We want to # transfer the whole project into LLVM-IR. project.compiler_extension = compiler.RunCompiler(project, self) \ << RunWLLVM() \ << run.WithTimeout() project.compile = get_default_compile_error_wrapped( self.get_handle(), project, self.REPORT_SPEC.main_report) bc_file_extensions = [BCFileExtensions.DEBUG, BCFileExtensions.FEATURE] analysis_actions = [] analysis_actions.append(actions.Compile(project)) analysis_actions.append(Extract(project, bc_file_extensions)) analysis_actions.append( CollectInstrumentationPoints(project, self.get_handle())) analysis_actions.append(actions.Clean(project)) return analysis_actions
def actions_for_project( self, project: Project ) -> tp.MutableSequence[actions.Step]: """ Returns the specified steps to run the project(s) specified in the call in a fixed order. Args: project: to analyze """ # Add the required runtime extensions to the project(s). project.runtime_extension = run.RuntimeExtension(project, self) \ << time.RunWithTime() # Add the required compiler extensions to the project(s). project.compiler_extension = compiler.RunCompiler(project, self) \ << RunWLLVM() \ << run.WithTimeout() # Add own error handler to compile step. project.compile = get_default_compile_error_wrapped( self.get_handle(), project, EmptyReport ) analysis_actions = [] analysis_actions += get_bc_cache_actions( project, extraction_error_handler=create_default_compiler_error_handler( self.get_handle(), project, self.REPORT_SPEC.main_report ) ) analysis_actions.append( IDELinearConstantAnalysis(project, self.get_handle()) ) analysis_actions.append(actions.Clean(project)) return analysis_actions
def actions_for_project( self, project: Project) -> tp.MutableSequence[actions.Step]: """Returns the specified steps to run the project(s) specified in the call in a fixed order.""" # Add the required runtime extensions to the project(s). project.runtime_extension = run.RuntimeExtension(project, self) \ << time.RunWithTime() # Add the required compiler extensions to the project(s). project.compiler_extension = compiler.RunCompiler(project, self) \ << RunWLLVM() \ << run.WithTimeout() project.compile = get_default_compile_error_wrapped( self.get_handle(), project, self.REPORT_SPEC.main_report) analysis_actions = [] analysis_actions.append(actions.Compile(project)) analysis_actions.append(EmptyAnalysis(project, self.get_handle())) analysis_actions.append(actions.Clean(project)) return analysis_actions