From 15b61200bd178a93957f0a06f735d8333c206229 Mon Sep 17 00:00:00 2001 From: Abdalla Date: Fri, 25 Oct 2024 08:39:28 +0200 Subject: [PATCH] add func name to identify correct function to analyze --- src/analyzer.py | 2 +- src/inliner.py | 4 ++-- src/smt_solver/smt.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/analyzer.py b/src/analyzer.py index bba2c0c..602ff23 100644 --- a/src/analyzer.py +++ b/src/analyzer.py @@ -244,7 +244,7 @@ def _run_inliner(self, input_file: str, additional_files: str): input_files = [input_file] + additional_files inlined_file = inliner.inline_functions(input_files, self.project_config.location_temp_dir, - f"{self.project_config.name_orig_no_extension}gt-inlined") + f"{self.project_config.name_orig_no_extension}gt-inlined", self.project_config.func) if not inlined_file: diff --git a/src/inliner.py b/src/inliner.py index f2bd37c..8275552 100644 --- a/src/inliner.py +++ b/src/inliner.py @@ -130,7 +130,7 @@ def generate_cfg(input_file): print(f" Inlined bitcode: {inlined_bc}") print("CFG files generated in the current directory.") -def inline_functions(bc_filepaths: list[str], output_file_folder: str, output_name: str) -> str: +def inline_functions(bc_filepaths: list[str], output_file_folder: str, output_name: str, analyzed_function: str) -> str: output_file: str = os.path.join(output_file_folder, f"{output_name}.bc") combined_bc = "combined.bc" @@ -148,7 +148,7 @@ def inline_functions(bc_filepaths: list[str], output_file_folder: str, output_na disassemble_bitcode(combined_bc, combined_ll) # Step 4: Modify the LLVM IR file - modify_llvm_ir(combined_ll, combined_mod_ll, "test") + modify_llvm_ir(combined_ll, combined_mod_ll, analyzed_function) # Step 5: Assemble the modified LLVM IR back to bitcode assemble_bitcode(combined_mod_ll, combined_mod_bc) diff --git a/src/smt_solver/smt.py b/src/smt_solver/smt.py index 9ea9a6f..3a1accd 100644 --- a/src/smt_solver/smt.py +++ b/src/smt_solver/smt.py @@ -44,9 +44,9 @@ def compile_and_run_cplusplus(modify_bit_code_cpp_file, modify_bit_code_exec_fil if project_config.inlined : compiled_additional_files = [] if additional_files: - compiled_additional_files = clang_helper.compile_list_to_llvm_for_analysis(additional_files, output_dir, "helper_smt", project_config.included, project_config.compile_flags) + compiled_additional_files = clang_helper.compile_list_to_llvm_for_analysis(additional_files, output_dir) compiled_files = [compiled_file] + compiled_additional_files - input_bc_file = inliner.inline_functions(compiled_files, output_dir, f"{c_filename}_inlined") + input_bc_file = inliner.inline_functions(compiled_files, output_dir, f"{c_filename}_inlined", func_name) else: input_bc_file = compiled_file # input_bc_file = clang_helper.unroll_loops(inlined_file, output_dir,