ABSTRACT
The C language does not provide any abstractions for exception handling or other forms of error handling, leaving programmers to devise their own conventions for detecting and handling errors. The Linux coding style guidelines suggest placing error handling code at the end of each function, where it can be reached by gotos whenever an error is detected. This coding style has the advantage of putting all of the error-handling code in one place, which eases understanding and maintenance, and reduces code duplication. Nevertheless, this coding style is not always applied. In this paper, we propose an automatic program transformation that transforms error-handling code into this style. We have applied our transformation to the Linux 2.6.34 kernel source code, on which it reorganizes the error handling code of over 1800 functions, in about 25 minutes.
- M. Bruntink. Reengineering idiomatic exception handling in legacy C code. In 12th European Conference on Software Maintenance and Reengineering (CSMR), pages 133--142, Athens, Greece, Apr. 2008. Google ScholarDigital Library
- Bruntink:ICSE06M. Bruntink, A. van Deursen, and T. Tourwé. Discovering faults in idiom-based exception handling. In 28th International Conference on Software Engineering (ICSE), pages 242--251, Shanghai, China, May 2006. Google ScholarDigital Library
- P. A. Buhr and W. Y. R. Mok. Advanced exception handling mechanisms. IEEE Trans. Software Eng., 26 (9): 820--836, 2000. Google ScholarDigital Library
- CDT. CDT/User/FAQ -- Eclipsepedia, 2010. \newline\fnamehttp://wiki.eclipse.org/CDT/User/FAQ.Google Scholar
- Ferreira, and Garcia}Filho:06F. C. Filho, C. M. F. Rubira, R. de A. Maranhão Ferreira, and A. Garcia. Aspectizing exception handling: A quantitative study. In Advanced Topics in Exception Handling Techniques, volume 4119 of Lecture Notes in Computer Science, pages 255--274. Springer, 2006. Google ScholarDigital Library
- M. Fowler. Refactoring: Improving the Design of Existing Code. Addison Wesley, 1999. Google ScholarDigital Library
- A. F. Garcia, C. M. F. Rubira, A. B. Romanovsky, and J. Xu. A comparative study of exception handling mechanisms for building dependable object-oriented software. Journal of Systems and Software, 59 (2): 197--222, 2001. Google ScholarDigital Library
- J. B. Goodenough. Exception handling: Issues and a proposed notation. Commun. ACM, 18 (12): 683--696, 1975. Google ScholarDigital Library
- B. McCloskey and E. Brewer. ASTEC: a new approach to refactoring C. In ESEC/FSE-13, pages 21--30, Lisbon, Portugal, 2005. Google ScholarDigital Library
- M. Mortensen and S. Ghosh. Refactoring idiomatic exception handling in CGoogle Scholar
- : Throwing and catching exceptions with aspects. In Industry Track of the International Conference on Aspect-Oriented Software Development (AOSD), Vancouver, Canada, Mar. 2007.Google Scholar
- Y. Padioleau. Parsing C/CGoogle Scholar
- code without pre-processing. In Compiler Construction (CC'09), pages 109--125, York, UK, Mar. 2009. Google ScholarDigital Library
- Y. Padioleau, J. Lawall, R. R. Hansen, and G. Muller. Documenting and automating collateral evolutions in Linux device drivers. In EuroSys 2008, pages 247--260, Glasgow, Scotland, Mar. 2008. Google ScholarDigital Library
- N. Palix, G. Thomas, S. Saha, C. Calvès, J. Lawall, and G. Muller. Faults in Linux: Ten years later. In Sixteenth International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), Newport Beach, CA, USA, Mar. 2011. Google ScholarDigital Library
- W. Weimer and G. C. Necula. Exceptional situations and program reliability. ACM Transactions on Programming Languages and Systems, 30 (2), 2008. Google ScholarDigital Library
- D. A. Wheeler. SLOCCount. \newline \fnamehttp://www.dwheeler.com/sloccount/.Google Scholar
Index Terms
- An approach to improving the structure of error-handling code in the linux kernel
Recommendations
An approach to improving the structure of error-handling code in the linux kernel
LCTES '10The C language does not provide any abstractions for exception handling or other forms of error handling, leaving programmers to devise their own conventions for detecting and handling errors. The Linux coding style guidelines suggest placing error ...
Error handling as an aspect
BPAOSD '07: Proceedings of the 2nd workshop on Best practices in applying aspect-oriented software developmentOne of the fundamental motivations for employing exception handling in the development of robust applications is to lexically separate error handling code from the normal code so that they can be independently modified. However, experience has shown ...
Code recommendation for exception handling
ESEC/FSE 2020: Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software EngineeringException handling is an effective mechanism to avoid unexpected runtime errors. However, novice programmers might fail to handle exceptions properly, causing serious errors like system crashing or resource leaking. In this paper, we introduce ...
Comments