Compiler Hacking for Source Code Analysis

  • Authors:
  • G. Antoniol;M. Di Penta;G. Masone;U. Villano

  • Affiliations:
  • RCOST – Research Centre on Software Technology, University of Sannio, Department of Engineering, Palazzo ex Poste, Via Traiano, 82100 Benevento, Italy antoniol@ieee.org;RCOST – Research Centre on Software Technology, University of Sannio, Department of Engineering, Palazzo ex Poste, Via Traiano, 82100 Benevento, Italy dipenta@unisannio.it;Telsey Telecommunications S.p.A., Viale Mellusi 68, 82100 Benevento, Italy gianluca.masone@telsey.it;Department of Engineering, University of Sannio, Palazzo Bosco Lucarelli, Piazza Roma, 82100 Benevento, Italy villano@unisannio.it

  • Venue:
  • Software Quality Control
  • Year:
  • 2004

Quantified Score

Hi-index 0.00

Visualization

Abstract

Many activities related to software quality assessment and improvement, such as empirical model construction, data flow analysis, testing or reengineering, rely on static source code analysis as the first and fundamental step for gathering the necessary input information. In the past, two different strategies have been adopted to develop tool suites. There are tools encompassing or implementing the source parse step, where the parser is internal to the toolkit, and is developed and maintained with it. A different approach builds tools on the top of external already-available components such as compilers that output the program abstract syntax tree, or that make it available via an API.This paper discusses techniques, issues and challenges linked to compiler patching or wrapping for analysis purposes. In particular, different approaches for accessing the compiler parsing information are compared, and the techniques used to decouple the parsing front end from the analysis modules are discussed.Moreover, the paper presents an approach and a tool, XOgastan, developed exploiting the gcc/g++ ability to save a representation of the intermediate abstract syntax tree. XOgastan translates the gcc/g++ dumped abstract syntax tree format into a Graph eXchange Language representation, which makes it possible to take advantage of currently available XML tools for any subsequent analysis step. The tool is illustrated and its design discussed, showing its architecture and the main implementation choices made.