Diagnostic Reasoning in Software Fault Localization
Proceedings of the Eighth International Joint Conference on Artificial Intelligence. Automatic Programming. Pages 29-30.
© 1983 International Joint Conferences on Artificial Intelligence
Abstract
We present a diagnostic model of software fault localization. A diagna~tiQ approach to fault localization has proven effective in the domains of medicine and digital hardware. Applying this approach to the software domain requires two extensions: a heuristic abstraction mechanism which infers program function from structure using recognition and transformation tactics; and a search · mechanism which integrates both prototypic and causal reasoning about faults.
- Applicable fault models (rn f pr)
- Expected defects ((rn f pr-rnissing))
- Fault hypothesis (rn f-pr missing))
- Trying to recognize! m f pr
- Triggers are (read f i-s-f p r pre- sa tis- The 6. Matching rn f pr to (s6-read-transfile transbuf)
- Matching f_p_r to-(s6 read transfile transbuf)
- f p r has role f i s ~1~. Matching f i s to(s6 read transfile transbuf) 11. f i s is pr{mitive 12. Checking constraint (data-type f ile pascal fid)
- Checking constraint (data-type record pascal_rec) 14. Match for f i s succeeds
- • Matchin g rn f pr to (s24 read oldfile o1dbuf)
- Checking constraint (before f i s update-loop) R. Sedlmeyer et al. 31
- Role f i s, which is bound to g 0001!•, does not precede role update loop, which is bound to g0005 - 25. Match for f p r fails 2f.. Matching rn f pr to (s52 read transfile transbuf)
- J . DeKleer, "Local methods for localization of faults in electonic circuits," MIT-AI Memo 394, 1976 .
- M.Genesereth, "Diagnosis using hierarchic design models," PJtoc.eeding.6 o6 :the Sec.orui AAAI Con6eJr.enc.e, August, 1982.
- R. Davis, H. Shrobe, W. Harnscher, K. Wieckert, M. Shirley, and S. Polit, "Diagnosis based on description of structure and function," PJtoc.eed{_ytgJ.> o6 :the Sec.ond AAAI Con6eJr.enc.e, August, 1982 .
- R. Hartley, "How expert should an expert system be?", PJtoc.eeding.6 IJCAI-81, August 1981. IJCAI
- R. Patil, P. Szolovits, W. Schwartz, "Causal understanding of patient illness in medical diagnosis," PJtoc.eeding.6 o6 IJCAI-81, August, 1981. IJCAI
- E. Shortliffe, Compute!t Ba;..ed Medic.a.l Con6U-Ua- tion6: MYCIN, American Elsevier, New York, New York, 1976.
- B. Chandrasekaran and S. Mittal, "Deep versus compiled knowledge approaches to diagnostic problem-solving," PJtoc.eeding.6 o6 the Sec.ond AAAI Confie!tenc.e, August, 1982.
- H. Wertz, "Understanding and improving LISP programs," I JCAI -77 Pl!oc.eed.ing-6. IJCAI
- R. Ruth, "Intelligent program analysis," Altti6ic.ia.l Intettigenc.e, Vol. 7, No. 1, 1976
- C. Adam and M. "LAURA, a sys tern to debug student programs," Altti6ic.ia..e Intettigenc.e, November, 1980.
- F. "Understanding and debugging computer programs," Inte!tnationa.l JouJtn.al. o~ Man-Mac.hine Studie-6, Vol . 12, 1980, pp. 1S9=202;
- G. Sussman, A Compu;ta;ti.ona.l Model o6 S/U.U Ac.qui'->ition, American Elsevier, New York, 1975.
- Mil1er, "A structured planning and debugging environment," InteJr.nationa.l JouJtna.l o6 Man- Mac.hine Studie-6, Vol. 11. 1978.
- D. Shapiro, "Sniffer: a system that understands bug," MIT-AI Memo 638, June, 1981
- M. Weiser, "Program slices: formal, psychologi- cal, and practical investigations of an automatic program abstraction method," University of Michigan Ph .D. Thesis, 1979.
- B. Dwyer, "One more time -How to update a master file," Communic.ation6 o6 -the ACM, Vol. 24, No. 1, January 1981.
References were extracted automatically from the PDF and may contain errors.
Full text extracted automatically from the PDF; figures, tables and equations may differ. The PDF is the version of record.
DIAGNOSTIC REASONING IN SOFTWARE FAULT LOCALIZATION
Robert L. Sedlmeyer* William B. Thompson Paul E. Johnson
University of Minnesota
faults rather than of fault localization.
ABSTRACT
We present a diagnostic model of software fault localization. A diagna~tiQ approach to fault localization has proven effective in the domains of medicine and digital hardware. Apply ing this approach to the software domain requires two extensions: a heuristic abstraction mechanism which infers program function from structure using recognition and transformation tactics; and a search · mechanism which integrates both prototypic and causal reasoning about faults.
I. INTRODUCTION
In this paper we present a model of fault localization for program debugging based on a trouble-shooting paradigm [1) . Within a diagnostic framework we define the software fault localization task as follows: A 6ault exists in a program when ever its output differs from that expected by the user. These descrepancies are called 6ault mani6~tatia~. The task is to identify the cause of each manifestation which is specific enough to effect program repair.
Application of the 'trouble-shooting strategy has proven effective in constructing intelligent systems for hardware [2,3,4) and medical [5,6,7) diagnosis. In contrast to verification- based approaches (cf . [8,9,10,11) this strategy concen trates computational resources on suspect compo nents. Applying the diagnostic approach to the software domain requires two extensions: a heuristic abstraction mechanism that infers func tion from structure using recognition and transfor mation tactics; and a search mechanism that inte grates both prototypic and causal reasoning to localize faults.
Several program debugging systems evidence trouble-shooting tactics [12,13,14), but none are based on a comprehensive diagnostic theory. Sussman [1) was primarily interested in developing a theory of skill acquisition and examined the role of debugging in that context . While Miller and Goldstein [13) addressed the debugging task direct ly, the faults which MYCROFT analyzed were tightly constrained by the simplicity of the programs involved. Shapiro [14] addresses more realistic debugging environments, but formulates a theory of Our model partitions diagnostic knowledge for the software fault localization task into knowledge usPd to locate known and novei faults. For diag nosing known faults the knowledge base contains a hierarchy of faults which are known to occur in programs from a particular applications domain, and a set of empirical associations which relate fault manifestations to possible causes. For diagnosing navel faults the knowledge base contains models of implementation alternatives and execution behavior of functions indigenous to the domain. Both know ledge sources are utilized by a set of localization tactics to generate, select and test fault hypo theses.
*Current address: Department of Computer Tech . , Purdue University at Fort Wayne, Indiana 46805
II. KNOWLEDGE OF PROGRAM STRUCTURE AND FUNCTION
Knowledge of program structure and function is necessary for diagnosis of both known and novel faults. In the former case it is used to confirm expectations associated with a given fault hypo thesis; in the latter case it is used to trace violations of expected behavior to their source. In our model this knowledge is captured in 6unQtianal p~atatyp~.
A 6unQtianal p~atatype consists of four com ponents: a set of recognition triggers, a list of pre- and post-conditions describing the execution behavior, a description of prototype components and their topology, and a list of constraints among components that must hold for recognition. Proto types are defined at three levels of abstraction: the language, programming, and applications levels; and are hierarchically organized. A portion of the functional prototype hierarchy describing the com ponent topology of the "master file priming read" (MFPR) function is given in Figure 1.

The f igure shows that the MFPR consists of a single component, the file_priming_read. A file_priming_ read is only recognized as a MFPR if two con s tra ints a re me t: the input record is used as a master record and the input file is used as a mas ter file. Recognition triggers inc lude the fi l e priming read and file input stmt prototypes as well as the language keyword "read".
III. KNOWLEDGE OF FAULTS
While f unc tiona l prototypes des cribe expected program structure and function; 6autt mod~ des cribe expected defects in program structure and func tion. A 6au£t model embodies knowledge of a particular implementa tion error or c l ass of errors. This knowledge consists of conditions under whi ch the model is applicable , a set of fault hypotheses , and a set of related fault models. A fault hypo thesis is an expected defect in a functional pro totype . Defects are defined as missing prototype components or viola ted constraints. Like func tion al prototypes fault models are hierarchically organized. Figure 2 details a fault mode l fo r a master file input error.
(mas t e r file priming read error (triggered by -
1. inv~lid first master record
2. invalid firs t new mas ter re~ord
3. invalin mas ter record count)
(expec t ed defects
1. missing MFPR)
(related faults
1 . i;sert_error)
Figure 2. Sample Fault Model
IV. LOCALIZATION TACTICS
Localization is performed using three tactics: fiautt-dniven, fiunction-dniven and computation dkiven. Fautt-dniven localization directs sea;ch at f inding a particular kind of fault, such as an unexpected end of file. Function-dkiven locali zation analyzes a-particular functional prototype for an error. Computation-dniven localization concentrates search on the computation of a set of program variables. Each makes use of an abstrac tion mechanism (Section 5) to generate and test fault hypotheses.
Multiple localization tactics are desirable for three reasons . First, they enhance the pro bability of finding faults since different tactics analyze the source code from different perspectives. Secondly, tactics which best fit the available in formation can be chosen. Thirdly, each tactic is opti~al, in the sense of minimizing computational resources, for a particular localization task.
Fault-driven localization uses the fault model hierarchy to generate fault hypotheses. Output discrepancies serve as triggers for selecting a particular fault model . The more salient the trigger set the more specific the fault model and the associated fault hypotheses . Given a fault model, localization continues by first choosing
one of these fault hypotheses and then invoking the abstraction mechanism to t es t it. If the hypothesis fails then a r e l ated hypothesis can be proposed, a different fault model can be applied , or the t ac tic can be abandoned .
Func tion-driven localization uses output dis c r epancies to suggest that a particular functional prototype is improperly implemented. The abs trac tion mechanism is then invoked to identify the code which implements the prototype . If the pro totype cannot be found then the source code pro ducing the most feasible match is considered -as the intended implementation . The fault is identi fied by the statement causing failure in the match ing process. This tactic can also be directed to examine a particular abstraction level for a fault. All prototypes defined a t the chosen level are con s idered s uspect. This application of the func tion driven t ac tic i s less direc t ed and us ua lly less desirable. Only when the output disc r epancies offer no bas is fo r prototype selection does this al terna tive become a ttrac tive .
Computation-driven localization traces the computa tion of a particular set of program vari ables. The computation is analyzed by extracting from the progr am those statements that directly affec t the values of variables in the set . This extrac tion process is known as ~tieing [lS]. The computation can be followed in either a forward or reverse order of execution flow . Faults are found by using the abstraction mechani sm to inter pret sta t ements in the slice as membe r s of more abs trac t functional prototypes and comparing the expected comput a tiona l r esults to those derived .
V. PROGRAM ABSTRACTION
Progr am abstraction i s performed by matching functional prototypes to the sourc~ code . Ab straction may either be expec tation-driven or data- driven depending upon the localiza tion tactic selected . Expectation- driven abstraction ma t ches prototypes to code in a top-down manner, recursive ly matching components until a direc t match can be made against the source code or previously recog nized prototypes. Data-driven abstraction employs language-level triggers t o select prototypes for matching . Prototypes matched at lowe r levels of abstraction serve as triggers for ma tching a t higher levels. Once a functional prototype is identified the corresponding code is bound to it.
Recognition-based abstraction is an efficient technique , but it has limitations. Recognition of a functional prototype may fail for one of three reasons: a defect exists in the source code implementing the prototype, the wrong prototype is selected, or the source code represents an un familiar but correct implementation . The effec tiveness of the recognition mechanism depends on the exactness of the triggering process and the richness of the alternative implementation set. Purely structural matching is augmented by func tional matching. The behavior of a program se~ment which is inferred from language semantics, can also be compared to the functional descriptions in the prototype hierarchy .
VI. AN EXANPLE
We have implemented an initial version of the model in a program named FALOSY (FAult LOcalization SYstem). FALOSY addresses faults in master file update programs [16]. In this section we illus trate FALOSY's reasoning for the master file priming read error.
FALOSY is presented with a discrepancy list and a list representation of the program's source code. The discrepancy list formally describes differences between expected and observed output . An abridged trace of FALOSY's reasoning is given in the Appendix. Numbers in parentheses refer to line numbers jn the Appendix.
A production system, whose antecedents are sets of discrepancies, is used to select the initial localization tactic. In this case the fault-driven tactic is chosen and the master file priming read fault model is triggered (1). FALOSY hypothesizes that the priming read for the master file is missing (2). The abstraction mechanism is invoked to identify the corresponding prototype (4). A check is first made to determine if it has been previously identified. Since it has not, the recognition mechanism is invoked recursively to find the components of the master file priming read prototype.
Eventually search is carried out at the source level, and three read statements (6, 26) are selected for further matching. Constraints are now checked starting with those at the lowest level in the abstraction hierarchy. The first candidate is rejected since the file identifier is not used as the master file (20). The second and third candidates are rejecte~ ~ecause they do not cede the update loop (24,28). No candidate fies all constraints and recognition fails. original hypothesis is thus verified. pre sa tis The
APPENDIX
- Applicable fault models (rn f pr)
- Expected defects ((rn f pr-rnissing))
- 3 . Fault hypothesis (rn f-pr missing))
- 4 . Trying to recognize! m f pr
- 5 . Triggers are (read f i-s- f p r
- Matching rn f pr to (s6-read-transfile transbuf)
- rn f pr has-role f p r
- Matching f_p_r to-(s6 read transfile transbuf)
- f p r has role f i s
~1~ . Matching f is to(s6 read transfile transbuf)
- f i s is pr{mitive
- Checking constraint (data-type f ile pascal fid)
- Checking constraint (data-type record pascal_rec)
- Match for f i s succeeds
- Checking constraint (before f i s update loop)
- Trying to recognize: update-loop
-
- Recognition of update-loop succeeds
- Match for f_p_r succeeds
- Checking constraint (use file rn_f)
- Role file, which is bound to transfile, is used as a t f whereas rn f was expected
- Match for rn f pr fails
- 22 .· Matching rn f pr to (s24 read oldfile o1dbuf)
- 23 . Checking constraint (before f i s update-loop)
- 24 . Role f i s, which is bound to g 0001!·, does not precede role update loop, which is bound to g0005 -
- Match for f p r fails
- 2f.. Matching rn f pr to (s52 read transfile transbuf)
- Checking constraint (before f i s update loop)
- 28 . Role f i s, which is bound to-g00018, does not precede role update loop which is bound to g00005
- Match for f p r fails
- Recognition-of rn_ f_pr fails
- Fault hypothesjs verified
- Fault is: (rn_ f_pr missing)
BIBLIOGRAPHY
- J . DeKleer, "Local methods for localization of faults in electonic circuits," MIT-AI Memo 394, 1976 .
- M.Genesereth, "Diagnosis using hierarchic design models," PJtoc.eeding.6 o6 :the Sec.orui AAAI Con6eJr.enc.e, August, 1982.
- R. Davis, H. Shrobe, W. Harnscher, K. Wieckert, M. Shirley, and S. Polit, "Diagnosis based on description of structure and function," PJtoc.eed{_ytgJ.> o6 :the Sec.ond AAAI Con6eJr.enc.e, August, 1982 .
- R. Hartley, "How expert should an expert system be?", PJtoc.eeding.6 IJCAI-81, August 1981.
- R. Patil, P. Szolovits, W. Schwartz, "Causal understanding of patient illness in medical diagnosis," PJtoc.eeding.6 o6 IJCAI-81, August, 1981.
- E. Shortliffe, Compute!t Ba;..ed Medic.a.l Con6U-Ua tion6: MYCIN, American Elsevier, New York, New York, 1976.
- B. Chandrasekaran and S. Mittal, "Deep versus compiled knowledge approaches to diagnostic problem-solving," PJtoc.eeding.6 o6 the Sec.ond AAAI Confie!tenc.e, August, 1982.
- H. Wertz, "Understanding and improving LISP programs," I JCAI -77 Pl!oc.eed.ing-6.
- R. Ruth, "Intelligent program analysis," Altti6ic.ia.l Intettigenc.e, Vol. 7, No. 1, 1976
- C. Adam and M. "LAURA, a sys tern to debug student programs," Altti6ic.ia..e Intettigenc.e, November, 1980.
- F. "Understanding and debugging computer programs," Inte!tnationa.l JouJtn.al. o~ Man-Mac.hine Studie-6, Vol . 12, 1980, pp. 1S9=202;
- [12]G. Sussman, A Compu;ta;ti.ona.l Model o6 S/U.U Ac.qui'->ition, American Elsevier, New York, 1975.
- [13]Mil1er, "A structured planning and debugging environment," InteJr.nationa.l JouJtna.l o6 Man Mac.hine Studie-6, Vol. 11. 1978.
- [14]D. Shapiro, "Sniffer: a system that understands bug," MIT-AI Memo 638, June, 1981
- [15]M. Weiser, "Program slices: formal, psychologi cal, and practical investigations of an automatic program abstraction method," University of Michigan Ph .D. Thesis, 1979.
- [16]B. Dwyer, "One more time - How to update a master file," Communic.ation6 o6 -the ACM, Vol. 24, No. 1, January 1981.
@inproceedings{ijcai1983p6,
title = {Diagnostic Reasoning in Software Fault Localization},
author = {Sedlmeyer, Robert L. and Thompson, William B. and Johnson, Paul E.},
booktitle = {Proceedings of the Eighth International Joint Conference on
Artificial Intelligence, {IJCAI-83}},
publisher = {International Joint Conferences on Artificial Intelligence},
editor = {Alan Bundy},
pages = {29--30},
year = {1983},
note = {Automatic Programming},
url = {https://ijcai.org/proceedings/1983/6},
}
TY - CPAPER TI - Diagnostic Reasoning in Software Fault Localization AU - Sedlmeyer, Robert L. AU - Thompson, William B. AU - Johnson, Paul E. T2 - Proceedings of the Eighth International Joint Conference on Artificial Intelligence, IJCAI-83 PB - International Joint Conferences on Artificial Intelligence PY - 1983 SP - 29 EP - 30 UR - https://ijcai.org/proceedings/1983/6 ER -Copied
Machine-readable versions of this paper, for tools and AI agents: