Abstract
API error-handling specifications are often not documented, necessitating automated specification mining. Automated mining of error-handling specifications is challenging for procedural languages such as C, which lack explicit exception-handling mechanisms. Due to the lack of explicit exception handling, error-handling code is often scattered across different procedures and files making it difficult to mine error-handling specifications through manual inspection of source code. In this paper, we present a novel framework for mining API error-handling specifications automatically from API client code, without any user input. In our framework, we adapt a trace generation technique to distinguish and generate static traces representing different API run-time behaviors. We apply data mining techniques on the static traces to mine specifications that define correct handling of API errors. We then use the mined specifications to detect API error-handling violations. Our framework mines 62 error-handling specifications and detects 264 real error-handling defects from the analyzed open source packages.
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
IEEE Computer Society. IEEE Standard for Information Technology - Portable Operating System Interface POSIX - Part I: System Application Program Interface API, IEEE Std 1003.1b-1993 (1994)
Acharya, M., Xie, T., Pei, J., Xu, J.: Mining API patterns as partial orders from source code: From usage scenarios to specifications. In: Proc. ESEC/FSE, pp. 25–34 (2007)
Ammons, G., Bodik, R., Larus, J.: Mining specifications. In: Proc. POPL, pp. 4–16 (2002)
Bruntink, M., Deursen, A.V., Tourwe, T.: Discovering faults in idiom-based exception handling. In: Proc. ICSE, pp. 242–251 (2006)
Chang, R.Y., Podgurski, A.: Finding what’s not there: A new approach to revealing neglected conditions in software. In: Proc. ISSTA, pp. 163–173 (2007)
Chen, H., Wagner, D.: MOPS: an infrastructure for examining security properties of software. In: Proc. CCS, pp. 235–244 (2002)
Cristian, F.: Exception Handling and Tolerance of Software Faults. In Software Fault Tolerance, ch. 5. John Wiley and Sons, Chichester (1995)
Engler, D., Chen, D.Y., Hallem, S., Chou, A., Chelf, B.: Bugs as deviant behavior: A general approach to inferring errors in systems code. In: Proc. SOSP, pp. 57–72 (2001)
Gehani, N.H.: Exceptional C for C with exceptions. Software Practices and Experiences 22(10), 827–848 (1992)
Gunawi, H., Rubio-Gonzalez, C., Arpaci-Dusseau, A., Arpaci-Dusseau, R., Liblit, B.: EIO: Error handling is occasionally correct. In: Proc. USENIX FAST, pp. 242–251 (2006)
Li, Z., Zhou, Y.: PR-Miner: automatically extracting implicit programming rules and detecting violations in large software code. In: Proc. ESEC/FSE, pp. 306–315 (2005)
Ramanathan, M.K., Grama, A., Jagannathan, S.: Static specification inference using predicate mining. In: Proc. PLDI, pp. 123–134 (2007)
Rosenthal, D.: Inter-client communication Conventions Manual (ICCCM), Version 2.0. X Consortium, Inc. (1994)
Toy, W.: Fault-tolerant design of local ESS processors. In: The Theory and Practice of Reliable System Design. Digital Press (1982)
Wang, J., Han, J.: BIDE: Efficient mining of frequent closed sequences. In: Proc. ICDE, pp. 79–90 (2004)
Weimer, W., Necula, G.C.: Finding and preventing run-time error handling mistakes. In: Proc. OOPSLA, pp. 419–431 (2004)
Weimer, W., Necula, G.C.: Mining temporal specifications for error detection. In: Halbwachs, N., Zuck, L.D. (eds.) TACAS 2005. LNCS, vol. 3440, pp. 461–476. Springer, Heidelberg (2005)
Yang, J., Evans, D., Bhardwaj, D., Bhat, T., Das, M.: Perracotta: Mining temporal API rules from imperfect traces. In: Proc. ICSE, pp. 282–291 (2006)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2009 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Acharya, M., Xie, T. (2009). Mining API Error-Handling Specifications from Source Code. In: Chechik, M., Wirsing, M. (eds) Fundamental Approaches to Software Engineering. FASE 2009. Lecture Notes in Computer Science, vol 5503. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-00593-0_25
Download citation
DOI: https://doi.org/10.1007/978-3-642-00593-0_25
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-00592-3
Online ISBN: 978-3-642-00593-0
eBook Packages: Computer ScienceComputer Science (R0)