Published October 30, 2025 | Version FM2024-v3
Software Open

CFaults: Model-Based Diagnosis for Fault Localization in C with Multiple Test Cases

  • 1. ROR icon Instituto Superior Técnico
  • 2. ROR icon Instituto de Engenharia de Sistemas e Computadores Investigação e Desenvolvimento
  • 3. Universidade de Lisboa
  • 4. Czech Institute of of Informatics, Robotics and Cybernetics (CIIRC)
  • 5. ROR icon Czech Technical University in Prague

Description

CFaults

This is the Docker image and code implementation for the paper "CFaults: Model-Based Diagnosis for Fault Localization in C with Multiple Test Cases", published in the 26th International Symposium on Formal Methods (FM 2024).

CFaults introduces a novel formula-based fault localization (FBFL) technique for C programs capable of addressing any number of faults. Leveraging Model-Based Diagnosis (MBD) with multiple observations, CFaults consolidates all failing test cases into a unified Maximum Satisfiability (MaxSAT) formula, ensuring consistency in the fault localization process. In our paper, we show that CFaults only generates minimal diagnoses of faulty statements, while other formula-based fault localization methods tend to produce redundant diagnoses.

Keywords

Fault Localization, Model-Based Diagnosis, Formula-based Fault Localization, Debugging, and Maximum Satisfiability.

MOTIVATING EXAMPLE

To run the motivating example from our paper:
(Each FBFL tool should take less than one minute to process the motivating example)

- CFaults [1]:

```
./CFaults.sh -i examples/fm2024_example.c -o motivating_example_CFaults -nu 3 -e lab02/ex01 -v -hw
```

- CFaults-Refined [1]:

```
./CFaults.sh -i examples/fm2024_example.c -o motivating_example_CFaults-Refined -nu 3 -e lab02/ex01 -ss -v -hw
```

- BugAssist [2]:

```
./BugAssist.sh -i examples/fm2024_example.c -o motivating_example_BugAssist -nu 3 -e lab02/ex01 -v -hw
```

- SNIPER [3]:

```
./SNIPER.sh -i examples/fm2024_example.c -o motivating_example_SNIPER -nu 3 -e lab02/ex01 -v -hw
```

FM 2024 Reproducibility Instructions

See the "FM2024_reproducibility_instructions.md" file for the full list of experiments and step-by-step guidance to reproduce all results from our paper.

Maintenance, Support && Collaborations

CFaults is actively maintained and used in ongoing research. We continue to develop the tool and build upon it, and we are open to collaborations.

If you run into a problem, please open an issue on our GitHub repository [4] and/or (optionally) email us so we do not miss it!

Citation

If you use CFaults in your research, please cite the following paper:

```
@inproceedings{DBLP:conf/fm/OrvalhoJM24,
  author     = {Pedro Orvalho and
                      Mikol{\'{a}}s Janota and
                      Vasco M. Manquinho},
  title          = {{CFaults: Model-Based Diagnosis for Fault Localization in C with
                        Multiple Test Cases}},
  booktitle  = {Formal Methods - 26th International Symposium, {FM} 2024},
  series       = {Lecture Notes in Computer Science},
  volume     = {14933},
  pages       = {463--481},
  publisher  = {Springer},
  year          = {2024},
  doi            = {10.1007/978-3-031-71162-6\_24},
  bibsource = {dblp computer science bibliography, https://dblp.org}
}
```

Versions

  • v3 : FM2024-v3 — minor update. Added flags to toggle: (1) hierarchical weights (-hw) across all FBFL methods; and (2) maximum coverage (-mc), which maps each statement S to every other statement that would be executed if S is executed. Note: enabling -mc may compromise the minimality of the reported diagnoses. This flag is useful when evaluating localisation methods on finding the injected bugs in TCAS rather than on finding minimal bugs.
  • v2 : FM2024-v2 - minor fix on localizing bugs on uninitialized global variables, and fixed CFaults' enum_all flag (legacy, this flag should not be used).
  • v1 : FM2024.

References

[1] P. Orvalho, M. Janota, and V. Manquinho. CFaults: Model-Based Diagnosis for Fault Localization in C with Multiple Test Cases. The 26th International Symposium on Formal Methods, FM 2024. https://arxiv.org/pdf/2407.09337

[2] Jose, M., Majumdar, R.: Cause clue clauses: error localization using maximum satisfiability. In: Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2011.
 
[3] Lamraoui, S., Nakajima, S.: A formula-based approach for automatic fault localization of multi-fault programs. J. Inf. Process. 24(1), 88–98 (2016).
 
[4] https://github.com/pmorvalho/CFaults

Files

CFaults-Zenodo-FM2024-v3.zip

Files (4.4 GB)

Name Size Download all
md5:f18f20563c19cb50f9c559ca9d6fa2ee
4.4 GB Preview Download

Additional details

Related works

Software

Repository URL
https://github.com/pmorvalho/CFaults
Programming language
C , C++
Development Status
Active