Instruction step
# Instruction step

An instruction step is a method of executing a computer program one step at a time to determine how it is functioning. This might be to determine if the correct program flow is being followed in the program during the execution or to see if variables are set to their correct values after a single step has completed.

## Hardware instruction step

On earlier computers, a knob on the computer console may have enabled step-by-step execution mode to be selected and execution would then proceed by pressing a "single step" or "single cycle" button. Program status word / Memory or general purpose register read-out could then be accomplished by observing and noting the console lights.

## Software instruction step

On later platforms with multiple users, this method was impractical and so single step execution had to be performed using software techniques.

### Software techniques

* Instrumentation - requiring code to be added during compile or assembly to achieve statement stepping. Code can be added manually to achieve similar results in interpretive languages such as JavaScript.
* instruction set simulation - requiring no code modifications for instruction or statement stepping

In some software products which facilitate debugging of High level languages, it is possible to execute an entire HLL statement at a time. This frequently involves many machine instructions and execution pauses after the last instruction in the sequence, ready for the next 'instruction' step. This requires integration with the compilation output to determine the scope of each statement.

Full Instruction set simulators however could provide instruction stepping with or without any source, since they operate at machine code level, optionally providing full trace and debugging information to whatever higher level was available through such integration. In addition they may also optionally allow stepping through each assembly (machine) instruction generated by a HLL statement.

Programs composed of multiple 'modules' compiled from a mixture of compiled languages, and even instructions created "on-the-fly" in dynamically allocated memory, could be accommodated using this technique.

### Examples of programs providing 'Software' instruction step

* SIMMON an IBM internal test system which provided instruction stepping
