Architectural support for software debugging
Authors: Yuanyuan Zhou
Venue:  (2006)

As Moore's law has been continuously improving the microprocessor's speed, performance is no longer the only focus. Software robustness has become one of the increasingly important issues. However, recent impressive advances in computer architecture have not led to significant improvement in software robustness. Since software robustness is mainly affected by software bugs, the focuses of this research are to provide efficient and simple architectural support to improve dynamic monitoring for detecting memory-related bugs, and to propose a new bug detection method and an incremental consistency check framework that both leverage the proposed architectural support.In this dissertation, we propose the Intelligent Watcher (iWatcher) , a novel architectural scheme to monitor dynamic execution automatically, flexibly and with minimal overhead. iWatcher associates program-specified monitoring functions with memory locations. When any such location is accessed, the monitoring function is automatically triggered with low overhead. To further reduce overhead and support rollback, iWatcher can optionally leverage Thread-Level Speculation (TLS). The experimental results with seven buggy applications (with various bugs) show that iWatcher detects all the bugs evaluated in our experiments with only a 0.1-179% execution overhead.We also propose a new statistics-based method, called program counter (PC)-based invariance, to detect memory-related bugs on the fly, and a simple architectural extension, called the Check Look-aside Buffer (CLB), that takes advantage of the bloom filter and the temporal object access locality to reduce the monitoring overhead in iWatcher. The PC-based invariance idea captures the invariant of the set of PCs that normally access a given key variable, and detects accesses by outlier instructions that are often caused by memory corruption, buffer overflow, stack smashing or other memory-related bugs. We build an automatic, low-overhead, low-false-alarm, PC-based invariant detection tool called AccMon (Access Monitor, pronounced as "A-k-Mon") that uses a combination of architectural, run-time system, and compiler support to catch hard-to-find memory-related bugs. AccMon leverages the iWatcher framework with the CLB extension to monitor accesses to key variables. Our experimental results with seven buggy applications (with a total of ten bugs) show that AccMon can detect all ten bugs with few false alarms (0 for five applications and 2-8 for two applications), whereas several tested existing tools fail to detect some bugs. AccMon also has low overhead (0.24-2.88 times), which is an order of magnitude lower than Purify. We also use the binary instrumentation tool PIN to build a pure software implementation of PC-based invariant detection called AccMon-S. AccMon-S does not require hardware support, but has much higher execution overheads (10.4-57.8 times), so it can only be used for in-house bug detection instead of bug detection during production runs. Besides detecting all ten bugs tested in AccMon, AccMon-S also detected two real bugs in two large real-word server applications, Apache and Squid, with few false alarms (0-4).We also present an incremental checking framework, called iChecker, that leverages iWatcher to provide an iChecker library for efficient, incremental, run-time consistency checks of mutable data structures in C programs. The basic idea of iChecker is to perform a consistency check with a local check (on the parts that need to be checked due to the modifications since the last consistency check) instead of with a global check. The evaluation using four case studies shows that iChecker reduces the checking overhead by 1.1-155 times (23.3 on average) over global checks for large data structures. The required code modifications for iChecker are25-108 lines (including the global checkers), which are 10-56 lines more than the modifications for traditional global checks.