Analyzing Source Code Across Static Conditionals
Analyzing Source Code Across Static Conditionals
复制标题
跨静态条件分析源代码
DOI:
--
复制
发表时间:
2015
期刊:
影响因子:
--
通讯作者:
Paul Gazzillo
中科院分区:
文献类型:
--
作者:
Paul Gazzillo
We need better tools for C, such as source browsers, bug finders, and automated refactorings. The problem is that large C systems such as Linux are software product lines, containing thousands of configuration variables controlling every aspect of the software from architecture features to file systems and drivers. The challenge of such configurability is how do software tools accurately analyze all configurations of the source without the exponential explosion of trying them all separately. To this end, we focus on two key subproblems, parsing and the build system. The contributions of this thesis are the following: (1) a configuration-preserving preprocessor and parser called SuperC that preserves configurations in its output syntax tree; (2) a configuration-preserving Makefile evaluator called Kmax that collects Linux’s compilation units and their configurations; and (3) a framework for configuration-aware analyses of source code using these tools. C tools need to process two languages: C itself and the preprocessor. The latter improves expressivity through file includes, macros, and static conditionals. But it operates only on tokens, making it hard to even parse both languages. SuperC is a complete, performant solution to parsing all of C. First, a configuration-preserving preprocessor resolves includes and macros yet leaves static conditionals intact, thus preserving a program’s variability. To ensure completeness, we analyze all interactions between preprocessor features and identify techniques for correctly handling them. Second, a configurationpreserving parser generates a well-formed AST with static choice nodes for conditionals. It forks new subparsers when encountering static conditionals and merges them again after the conditionals. To ensure performance, we present a simple algorithm for table-driven Fork-Merge LR parsing and four novel optimizations. We demonstrate SuperC’s effectiveness on the x86 Linux kernel. Large-scale C codebases like Linux are software product families, with complex build systems that
影响因子:
16.6
作者:
Thuem, Thomas;Apel, Sven;Saake, Gunter
通讯作者:
Saake, Gunter
DOI:
10.1145/2491411.2491437
发表时间:
2013-08
期刊:
--
影响因子:
--
作者:
Jörg Liebig;Alexander von Rhein;Christian Kästner;S. Apel;Jens Dörre;C. Lengauer
通讯作者:
Jörg Liebig;Alexander von Rhein;Christian Kästner;S. Apel;Jens Dörre;C. Lengauer