Extracting variability from C and lifting it to mbeddr

Information about variability is expressed in C through the usage of preprocessor directives which interact in multiple ways with proper C code, leading to systems difficult to understand and analyze. Lifting the variability information into a DSL to explicitly capture the features, relations among them and to the code, would substantially improve today’s state of practice. In this paper we present a study which we performed on 5 large projects (including the Linux kernel) and almost 30M lines of code on extracting variability information from C files. Our main result is that by using simple heuristics, it is possible to interpret a large portion of the variability information present in large systems. Furthermore, we show how we extracted variability information from ChibiOS, a realtime OS available on 14 different core architectures, and how we lifted that information in mbeddr, a DSL-based technology stack for embedded programing with explicit support for variability. Keywords-software product lines; abstraction lifting; embedded software; projectional editors; reverse engineering.

[1]  Michael D. Ernst,et al.  An Empirical Analysis of C Preprocessor Use , 2002, IEEE Trans. Software Eng..

[2]  Bjarne Stroustrup,et al.  Rejuvenating C++ programs through demacrofication , 2012, 2012 28th IEEE International Conference on Software Maintenance (ICSM).

[3]  Eric A. Brewer,et al.  ASTEC: a new approach to refactoring C , 2005, ESEC/FSE-13.

[4]  Thomas Leich,et al.  TypeChef: toward type checking #ifdef variability in C , 2010, FOSD '10.

[5]  Henry Spencer,et al.  #ifdef Considered Harmful, or Portability Experience with C News , 1992, USENIX Summer.

[6]  Eelco Visser,et al.  Product Line Engineering Using Domain-Specific Languages , 2011, 2011 15th International Software Product Line Conference.

[7]  Bernhard Schätz,et al.  Language engineering as an enabler for incrementally defined formal analyses , 2012, 2012 First International Workshop on Formal Methods in Software Engineering: Rigorous and Agile Approaches (FormSERA).

[8]  Gunter Saake,et al.  Program Comprehension in Preprocessor-Based Software , 2012, SAFECOMP Workshops.

[9]  Bernhard Schätz,et al.  mbeddr: an extensible C-based programming language and IDE for embedded systems , 2012, SPLASH '12.

[10]  Li Zhang,et al.  On the Relationship between Preprocessor-Based Software Variability and Software Defects , 2011, 2011 IEEE 13th International Symposium on High-Assurance Systems Engineering.