Communicating Using Program Traces
Total Page:16
File Type:pdf, Size:1020Kb
Communicating using Program Traces Chris McDonald Matthew Heinsen Egan Computer Science and Software Engineering Australian Centre for Geomechanics University of Western Australia University of Western Australia Crawley, WA 6009, Australia Crawley, WA 6009, Australia [email protected] [email protected] ABSTRACT niques, but they are typically only supported by tools de- Supported by the growth of embedded devices, the IoT, and signed for expert programmers, rather than for novices. The modern standardization, C remains an important language complexity of these tools, and the time required to learn for undergraduate students. However, when presented to their use, at even a modest level, are often insurmount- relatively inexperienced programmers, its very limited run- able hurdles for novice students. Furthermore, while these time support is a source of frustration for both students and tools can be used to locate runtime errors, they do not as- educators, alike. sist novice programmers to understand those errors, or more SeeC is a novice-focused tool for the C programming lan- generally to understand the behaviour of their programs. guage that displays and records the execution of programs, Several novice-focused tools have implemented graphical detects runtime errors, and enables students to review their program visualizations and automatically generated expla- programs' data and execution history. Students can deter- nations of program behaviour. These features have been ministically replay a program, and reason backwards from shown to assist novice programmers with constructing knowl- a runtime error to determine its true cause. The approach edge and debugging programs in numerous evaluations, such can lead to students' reduced frustration and greater under- as those described by [1], [9], [2], and [5]. However, few of standing of program behaviour. these tools have supported the C programming language, This presentation provides a brief overview of SeeC and and those that do are typically incomplete or unmaintained. a discussion on how its program traces provide an opportu- SeeC introduced a novice-focused systems for creating graph- nity for students to communicate their questions and mis- ical visualizations of the runtime memory state of C lan- understandings with educators, and for educators to provide guage programs, and for generating natural language expla- examples and debugging challenges to students. nations of C program fragments. It is built upon a previously developed novice-focused debugging system for the C pro- gramming language, augmenting the existing runtime error Categories and Subject Descriptors detection and execution tracing with program visualizations D.2.5 [Software Engineering]: Testing and Debugging; and natural language explanations. SeeC runs on each of K.3.2 [Computers and Education]: Computer and In- Linux, macOS, and Windows. formation Science Education II. THE DESIGN OF SEEC Keywords The SeeC project provides a novice-focused system for Novice programmers, debuggers the standard C programming language supporting execution tracing and runtime error detection. SeeC itself is built upon I. MOTIVATION the Clang and LLVM projects [8]. This provides SeeC with robust support for the C programming language while avoid- The standard C programming language can be especially ing the unsustainable maintenance requirements inflicted by difficult for newcomers. In particular, pointers and manual bespoke implementations of parsing, compiling, or interpret- memory management can present difficulties both in under- ing. For a detailed explanation of the SeeC system, see the standing at a conceptual level, and in debugging the la- discussion in [4, 6, 3]. conically described runtime errors which result from their SeeC uses a modified version of the Clang front-end to per- misuse. Most newly developed novice-focused debugging form compile-time instrumentation of students' programs. systems are designed for object-oriented programming lan- The produced executables contain additional code that both guages, as introductory teaching has focused on these lan- checks for runtime errors and creates a trace of the execu- guages, and the most notable tools developed to assist novice tion. The trace can be used to recreate the visible state of C programmers are predominantly unmaintained. the program at any point of time in the recorded execution. Research from the fields of programming languages and Clang's parsing and semantic analysis libraries are used compilers has developed many advanced debugging tech- to create an Abstract Syntax Tree (AST) from a program's source code. Each node in the AST represents a declaration or statement in the program and provides rich semantic in- SPLICE Spring 2019 Workshop, CS Education Infrastructure for All II: En- abling the Change in conjunction with ACM-SIGCSE 2019, Minneapolis, formation { the same information that is used during com- 27th Feb 2019. pilation. When an execution trace is loaded the program's AST is reconstructed, allowing us to link runtime states to to portable USB drives, and to communicate them via email. relevant AST nodes. This provides a mapping between the We are currently developing a cloud-based version of SeeC program's static source code and its dynamic state. which will address these current challenges. Cloud-based storage has rapidly dropped in price, and holding the pro- gram traces for even several hundred students has become a III. USING SEEC IN TEACHING reality. Students will be able to communicate within groups, SeeC has been used in our second year undergraduate unit to enqueue their (synchronous or asynchronous) questions CITS200 Systems Programming, recently presented to 280- for teaching assistants, and to undertake longer dialogs about 320 students. After recent changes in our university's degree a single programming problem. Moreover, retaining stu- structures, the unit resulted after a merging of a first year dents' program traces (with permission), provides a rich introductory C programming unit and a second year operat- opportunity to investigate how students are actually ap- ing systems unit. The unit provides an introduction to the C proching the development and debugging of their programs. programming language operating system fundamentals (op- erating system structure, processes, memory management, and file-systems), and the use of C as a vehicle to access and V. REFERENCES control operating system services. [1] P. Brusilovsky. Program visualization as a debugging The unit is core for students taking Software Engineering, tool for novices. In INTERACT '93 and CHI '93 Computer Science, or Data Science majors. Most students conference companion on Human factors in computing have completed at least one of the core units introducing the systems, CHI '93, pages 29{30, New York, NY, USA, Java or Python programming languages. Another quarter of 1993. ACM. the unit's cohort are specialising in Electronic Engineering, [2] J. H. Cross, II, T. D. Hendrix, D. A. Umphress, L. A. and are undertaking Systems Programming as prior study Barowski, J. Jain, and L. N. Montgomery. Robust for a later units. Unfortunately, Systems Programming is generation of dynamic data structure visualizations usually their first programming focused unit in their degree. with multiple interaction approaches. Trans. Comput. We have employed SeeC in recorded lectures to introduce Educ., 9:13:1{13:32, June 2009. general programming concepts, such as loops, function calls, [3] M. H. Egan and C. McDonald. Runtime error checking and simple data structures, and the more challenging as- for novice c programmers. In 4th Annual International pects of C, such as its use of pointers and dynamic memory Conference on Computer Science Education: allocation. Students have commented on ease of use, as a Innovation and Technology (CSEIT'13), pages 1{9, \drop-in" replacement for their system-provided compiler, 2013. and SeeC's clarity of error reporting, particularly its ability [4] M. H. Egan and C. McDonald. Program visualization to describe runtime errors in English, with reference to their and explanation for novice c programmers. In source code. Proceedings of the Sixteenth Australasian Computing Education Conference - Volume 148, ACE '14, pages IV. OPPORTUNITIES 51{57, Darlinghurst, Australia, Australia, 2014. Australian Computer Society, Inc. Through the dramatic growth in our class sizes, and the [5] P. J. Guo. Online python tutor: Embeddable web-based increased interest in our teaching of C to students not plan- program visualization for cs education. In Proceeding of ning to graduate in Computer Science, we are currently re- the 44th ACM Technical Symposium on Computer focusing the design and use of SeeC. Historically, while SeeC Science Education, SIGCSE '13, pages 579{584, New was still under continued development, it was only installed York, NY, USA, 2013. ACM. on our department's laboratory computers, and was mostly [6] M. Heinsen Egan and C. McDonald. Reducing novice c used by students in their closed laboratory sessions. Over programmers' frustration through improved runtime time, we have made SeeC available to our students to in- error checking. In Proceedings of the 18th ACM stall on their own laptop or home computers, but this has Conference on Innovation and Technology in Computer proved a challenge for many students because it required the Science Education, ITiCSE '13, pages 322{322, New (well documented) installation of several software packages, York,