Affiliation:
1. Sun Microsystems, Inc., Santa Clara, CA
Abstract
In re-implementing fast breakpoints for stock hardware, I discovered the joys of putting self-modifying code to good use.By "fast breakpoints" I mean inserting transfers of control to change the behavior of a running program. I don't claim to have invented fast breakpoints: I have traced their use back to 1951 [1]. I didn't even put these breakpoints to novel uses. All I did was rediscover how easy it is to take statically compiled code and modify it at runtime to alter the semantics of programs. The most obvious application is to evaluate predicates and expressions for debugging, but other uses are possible.We have designed and implemented a fast breakpoint facility. Breakpoints are usually thought of as a feature of an interactive debugger, in which case the breakpoints need not be particularly fast. In our environment breakpoints are often used for non-interactive information gathering; for example, procedure call count and statement execution count profiling [Swinehart, et al.]. When used non-interactively, breakpoints should be as fast as possible, so as to perturb the execution of the program as little as possible. Even in interactive debuggers, a conditional breakpoint facility would benefit from breakpoints that could transfer to the evaluation of the condition rapidly, and continue expeditiously if the condition were not satisfied. Such conditional breakpoints could be used to check assertions,
etc.
Program advising could also make use of fast breakpoints [Teitelman]. Examples of advising include tracing, timing, and even animation, all of which should be part of an advanced programming environment.We have ported the Cedar environment from a machine with microcode support for breakpoints [Lampson and Pier] to commercial platforms running C code [Atkinson, et al.]. Most of our ports run under the Unix* operating system, so one choice for implementing breakpoints for Cedar was to use the breakpoint facility provided by that system. The breakpoints provided by the Unix operating system are several orders of magnitude too slow (and also several process switches too complicated) for the applications we have in mind. So we designed a breakpoint system that was fast enough for our purposes.Breakpoints for uni-processors running single threads of control used to be fast and simple to implement. This paper shows that breakpoints can still be fast, even with multiple threads of control on multi-processors. This paper describes problems in the design of a breakpoint package for modern computer architectures and programming styles, and our solutions to them for a particular architecture.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Reference27 articles.
1. The Diagnosis of Mistakes in Programmes on the EDSAC;Gill S.;Proceedings of the Royal Society, Series A
2. A structural view of the Cedar programming environment
3. A processor for a high-performance personal computer
4. Sun Microsystems Inc. The SPARC Architecture Manual Part number 800-1399-03 June 1987.]] Sun Microsystems Inc. The SPARC Architecture Manual Part number 800-1399-03 June 1987.]]
5. Sun Microsystems Inc. Debugging Tools Part number 800-1775-10 May 1988.]] Sun Microsystems Inc. Debugging Tools Part number 800-1775-10 May 1988.]]