ProDebug: An Automated Debugging System for Prolog

Read full text
Authors: Ricardo Brancas, Vasco M. Manquinho, Ruben Martins
Cited by: 0

Abstract

ProDebug ProDebug (previously named ProFix) is a complete tool for fault localization and repair of Prolog programs. Installation Prerequisites Python >= 3.11, < 3.13 SWI-Prolog >= 9.1, recommended 9.3 C++ Compiler (optional, used for native extension that speeds up Prolog parsing) Setup Run the following command to install the package in editable mode: pip install -e . Additionally, pyproject.toml lists the optional dependencies required to fine-tune and run the LLM parts of ProDebug. However, specific steps will depend on the GPU setup. Usage ProFix provides several modules for working with Prolog programs: Fault Localization: Identify potential bugs in your Prolog programs. Repair: Automated repair suggestions for Prolog code. Running the Tool To run ProFix, use the profix.integrated module. You need to provide an input file containing the Prolog program and test cases. python -m profix.integrated --input-file You can configure the fault localization and repair strategies using command-line arguments or a configuration file. Example: python -m profix.integrated --input-file instances/my_program.pl --fl-type sbfl --repair-type mutation Configuration Options ProFix supports various configuration options. Here are some key parameters: --input-file: Path to the input file (required). --fl-type: Type of fault localization to use (sbfl, mbfl, llm, simulated, hybrid). Default: sbfl. --repair-type: Type of repair to use (mutation, llm, combined, none). Default: llm. --logging-level: Logging level (e.g., DEBUG, INFO). Default: DEBUG. --test-timeout: Timeout for each unit test in seconds. Default: 1. Fault Localization Parameters: SBFL: --sbfl-formula: Formula to use (e.g., ochiai). --sbfl-ranker: Ranker to use (e.g., position). --sbfl-granularity: Granularity (clause or term). MBFL: --mbfl-mutant-generation-n: Number of mutants to generate per element. --mbfl-formula: Formula to use (e.g., metallaxis). HybridFL: --hybridfl-alpha: Weighting for SBFL and MBFL results. LLM Parameters: --llm-url: URL for the LLM API. --llm-timeout: Timeout for LLM requests. --llm-fl-n-attempts: Number of attempts for LLM fault localization. --llm-repair-n-attempts: Number of attempts for LLM repair. For a full list of arguments and options, run: python -m profix.integrated --help Benchmarking The scripts/bench_integrated.py script can be used to run all instances in the instances/ folder. python scripts/bench_integrated.py Where is the name of the result file (without extension). The results will be saved in analysis/data/ .csv. Project Structure profix/: Main source code directory. fl/: Fault localization modules (SBFL, MBFL, LLM, Hybrid). repair/: Repair modules (Mutation, LLM). prolog/: Prolog language handling and parsing. utils/: Utility functions. integrated.py: Main entry point for the integrated tool. ProFixNative/: Native C++ extensions for performance. grammar/: ANTLR4 grammar files for Prolog. datasets/: Datasets used for training or evaluation. scripts/: Helper scripts. analysis/: Result analysis script. analysis/data/: Log files and results from the evaluation. Grammar Compilation These steps only need to be executed when the grammar files in grammar/ are modified. Prerequisites ANTLR4 Steps Run antlr4 -Dlanguage=Cpp -visitor -no-listener -o cpp_src Prolog.g4 in grammar folder Run antlr4 -Dlanguage=Python3 -visitor -no-listener -o . Prolog.g4 in grammar folder Copy grammar/cpp_src to ProfixNative/src/profix_native/antlr/cpp_src Copy grammar/Prolog* to profix/prolog/antlr/

Fields of Study & Subjects

Software Testing and Debugging Techniques Software Engineering Research Logic programming and type systems

Publication details

Journal / source
Zenodo (CERN European Organization for Nuclear Research)
Publication date
7 February 2026