Developing novice-focused debugging tools for C using LLVM and Clang on OS X

Matthew Heinsen Egan, University of Western Australia

Track: Tools & Tech; Audience: Intermediate

Apple and its primary development environment, XCode, have recently abandoned the long-favoured GCC, replacing it with Clang and LLVM. For most Apple developers, this change has been seamless and invisible, but importantly it affords great opportunities for the teaching of programming languages in universities. Not only have XCode and related tools been significantly improved by this switch, but the design of Clang and LLVM facilitate the development of new teaching tools, not previously possible with GCC.

This presentation will introduce our development of new novice-focused debugging tools for the C programming language on Mac OS X. C remains important for students: it is used to teach operating systems and networking concepts, and is the foundation of other important, widely-used languages (such as Objective C). Novice-focused debugging tools can assist users by detecting and explaining runtime errors, providing explanatory information, automatically visualizing memory, and by using simple, intuitive interfaces.

We are developing novice-focused debugging tools, with high-quality maintainable support for the C language, by leveraging the LLVM and Clang libraries. Previous teaching tools used custom-built parsers, interpreters, and instrumentation methods, which were exceedingly complex and have proven to be unsustainable. Furthermore, their support of the language is often fragile or incomplete. This presentation discusses our use of LLVM for compile-time instrumentation, and our use of Clang for parsing and examining C source code. We will explain our use of advanced techniques, such as automatic detection of runtime errors and reversible debugging, and how they assist our teaching using OS X.