HOME

TheInfoList



OR:

Program animation or stepping refers to the
debugging In engineering, debugging is the process of finding the Root cause analysis, root cause, workarounds, and possible fixes for bug (engineering), bugs. For software, debugging tactics can involve interactive debugging, control flow analysis, Logf ...
method of executing
code In communications and information processing, code is a system of rules to convert information—such as a letter, word, sound, image, or gesture—into another form, sometimes shortened or secret, for communication through a communicati ...
one instruction or line at a time. The programmer may examine the state of the program, machine, and related data before and after execution of a particular line of code. This allows the programmer to evaluate the
effects Effect may refer to: * A result or change of something ** List of effects ** Cause and effect, an idiom describing causality Pharmacy and pharmacology * Drug effect, a change resulting from the administration of a drug ** Therapeutic effect, ...
of each statement or instruction in isolation, and thereby gain insight into the behavior (or misbehavior) of the executing program. Nearly all modern IDEs and
debugger A debugger is a computer program used to test and debug other programs (the "target" programs). Common features of debuggers include the ability to run or halt the target program using breakpoints, step through code line by line, and display ...
s support this mode of execution.


History

Instruction stepping or single cycle originally referred to the technique of stopping the processor
clock A clock or chronometer is a device that measures and displays time. The clock is one of the oldest Invention, human inventions, meeting the need to measure intervals of time shorter than the natural units such as the day, the lunar month, a ...
and manually advancing it one cycle at a time. For this to be possible, three things are required: * A control that allows the clock to be stopped (e.g. a "Stop" button). * A second control that allows the stopped clock to be manually advanced by one cycle (e.g. An "instruction step" switch and a "Start" button). * Some means of recording the state of the processor after each cycle (e.g. register and memory displays). On the
IBM International Business Machines Corporation (using the trademark IBM), nicknamed Big Blue, is an American Multinational corporation, multinational technology company headquartered in Armonk, New York, and present in over 175 countries. It is ...
System 360 The IBM System/360 (S/360) is a family of mainframe computer systems announced by IBM on April 7, 1964, and delivered between 1965 and 1978. System/360 was the first family of computers designed to cover both commercial and scientific applicati ...
processor range announced in 1964, these facilities were provided by front panel switches, buttons and banks of neon lights. Other systems, such as the
PDP-11 The PDP–11 is a series of 16-bit minicomputers originally sold by Digital Equipment Corporation (DEC) from 1970 into the late 1990s, one of a set of products in the Programmed Data Processor (PDP) series. In total, around 600,000 PDP-11s of a ...
, provided similar facilities. On newer processors, which may not support physically stopping the clock and have too much internal state to reasonably display on a panel, similar functionality may be provided via a
trap flag A trap flag permits operation of a processor in single- step mode. If such a flag is available, debuggers can use it to step through the execution of a computer program. Single-step interrupt When a system is instructed to single-step, it will ex ...
, which when enabled instructs the processor to stop after each instruction in a similar manner to a
breakpoint In software development, a breakpoint is an intentional stopping or pausing place in a computer program, program, put in place for debugging purposes. It is also sometimes simply referred to as a pause. More generally, a breakpoint is a means o ...
. As
multiprocessing Multiprocessing (MP) is the use of two or more central processing units (CPUs) within a single computer system. The term also refers to the ability of a system to support more than one processor or the ability to allocate tasks between them. The ...
became more commonplace, such techniques would have limited practicality, since many independent processes would be stopped simultaneously. This led to the development of proprietary software from several independent vendors that provided similar features but deliberately restricted breakpoints and instruction stepping to particular application programs in particular address spaces and threads. The program state (as applicable to the chosen application/thread) was saved for examination at each step and restored before resumption, giving the impression of a single user environment. This is normally sufficient for diagnosing problems at the application layer. Instead of using a physical stop button to suspend execution - to then begin stepping through the application program, a
breakpoint In software development, a breakpoint is an intentional stopping or pausing place in a computer program, program, put in place for debugging purposes. It is also sometimes simply referred to as a pause. More generally, a breakpoint is a means o ...
or "Pause" request must usually be set beforehand, usually at a particular statement/instruction in the program (chosen beforehand or alternatively, by default, at the first instruction). To provide for full screen "animation" of a program, a suitable I/O device such as a video monitor is normally required that can display a reasonable section of the code (e.g. in dis-assembled machine code or
source code In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer. Since a computer, at base, only ...
format) and provide a pointer (e.g. <

) to the current instruction or line of source code. For this reason, the widespread use of these full screen animators in the
mainframe A mainframe computer, informally called a mainframe or big iron, is a computer used primarily by large organizations for critical applications like bulk data processing for tasks such as censuses, industry and consumer statistics, enterpris ...
world had to await the arrival of
transaction processing In computer science, transaction processing is information processing that is divided into individual, indivisible operations called ''transactions''. Each transaction must succeed or fail as a complete unit; it can never be only partially c ...
systems - such as
CICS IBM CICS (Customer Information Control System) is a family of mixed-language application servers that provide online business transaction management, transaction management and connectivity for applications on IBM mainframe systems under z/OS ...
in the early 1970s and were initially limited to debugging application programs operating within that environment. Later versions of the same products provided cross region monitoring/debugging of batch programs and other operating systems and platforms. With the much later introduction of
Personal computers A personal computer, commonly referred to as PC or computer, is a computer designed for individual use. It is typically used for tasks such as Word processor, word processing, web browser, internet browsing, email, multimedia playback, and PC ...
from around 1980 onwards, integrated debuggers were able to be incorporated more widely into this single user domain and provided similar animation by splitting the user screen and adding a debugging "console" to provide programmer interaction.
Borland Turbo Debugger Turbo Debugger (TD) is a machine-level debugger for DOS executables, intended mainly for debugging Borland Turbo Pascal, and later Turbo C programs, sold by Borland. It is a full-screen debugger displaying both Turbo Pascal or Turbo C source and c ...
was a stand-alone product introduced in 1989 that provided full-screen program animation for PC's. Later versions added support for combining the animation with actual source lines extracted at compilation time.


Techniques for program animation

There are at least three distinct software techniques for creating 'animation' during a program's execution. *
Instrumentation Instrumentation is a collective term for measuring instruments, used for indicating, measuring, and recording physical quantities. It is also a field of study about the art and science about making measurement instruments, involving the related ...
involves adding additional source code to the program at
compile In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
time to call the animator before or after each statement to halt normal execution. This functionality may be part of the
runtime library A runtime library is a library that provides access to the runtime environment that is available to a computer program tailored to the host platform. A runtime environment implements the execution model as required for a development environme ...
, as in Python'
pdb module
or it may take the form of inserting a breakpoint instruction that triggers an external debugger if one is attached. * Induced interrupt This technique involves forcing a breakpoint at certain points in a program at execution time, usually by altering the machine code instruction at that point (this might be an inserted system call or deliberate invalid operation) and waiting for an interrupt. When the interrupt occurs, it is handled by the testing tool to report the status back to the programmer. This method allows program execution at full speed (until the interrupt occurs) but suffers from the disadvantage that most of the instructions leading up to the interrupt are not monitored by the tool. *
Instruction set simulator An instruction set simulator (ISS) is a simulation model (abstract), model, usually coded in a high-level programming language, which mimics the behavior of a mainframe or microprocessor by "reading" instructions and maintaining internal variables ...
This technique treats the compiled program's
machine code In computer programming, machine code is computer code consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). For conventional binary computers, machine code is the binaryOn nonb ...
as its input 'data' and fully simulates the host machine instructions, monitors the code for conditional or unconditional
breakpoint In software development, a breakpoint is an intentional stopping or pausing place in a computer program, program, put in place for debugging purposes. It is also sometimes simply referred to as a pause. More generally, a breakpoint is a means o ...
s or programmer requested "single cycle" animation requests between every step.


Comparison of methods

The advantage of the last method is that no changes are made to the compiled program to provide the diagnostic and there is almost unlimited scope for extensive diagnostics since the tool can augment the host system diagnostics with additional software tracing features. It is also possible to diagnose (and prevent) many program errors automatically using this technique, including
storage violation In computing a storage violation is a hardware or software fault that occurs when a task attempts to access an area of computer storage which it is not permitted to access. Types of storage violation Storage violation can, for instance, consist ...
s and buffer overflows. Loop detection is also possible using automatic instruction trace together with instruction count thresholds (e.g. pause after 10,000 instructions; display last n instructions) The second method only alters the instruction that will halt before it is executed and may also then restore it before optional resumption by the programmer. Some animators optionally allow the use of more than one method depending on requirements. For example, using method 2 to execute to a particular point at full speed and then using instruction set simulation thereafter.


Additional features

The animator may, or may not, combine other test/debugging features within it such as program trace, dump, conditional
breakpoint In software development, a breakpoint is an intentional stopping or pausing place in a computer program, program, put in place for debugging purposes. It is also sometimes simply referred to as a pause. More generally, a breakpoint is a means o ...
and
memory Memory is the faculty of the mind by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remembe ...
alteration,
program flow In computer science, control flow (or flow of control) is the order in which individual Statement (computer science), statements, Instruction (computer science), instructions or function calls of an imperative programming, imperative computer pro ...
alteration,
code coverage In software engineering, code coverage, also called test coverage, is a percentage measure of the degree to which the source code of a program is executed when a particular test suite is run. A program with high code coverage has more of its ...
analysis, "hot spot" detection, loop detection or similar.


References

{{reflist


External links


Stepping (Visual Studio)
Overview of stepping support in Microsoft Corporation's IDE,
Visual Studio Visual Studio is an integrated development environment (IDE) developed by Microsoft. It is used to develop computer programs including web site, websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development ...

Tarraingim - A Program Animation Environment


* [https://web.archive.org/web/20110111014109/http://www.testingreferences.com/about.php Structured information on software testing (such as the History of Software Testing) published by Testing references] Debugging Software testing