![Eclipse suspended at breakpoint](https://upload.wikimedia.org/wikipedia/commons/d/d3/Eclipse_suspended_at_breakpoint.png)
In
software development
Software development is the process of conceiving, specifying, designing, programming, documenting, testing, and bug fixing involved in creating and maintaining applications, frameworks, or other software components. Software development inv ...
, a breakpoint is an intentional stopping or pausing place in a
program, put in place for
debugging
In computer programming and software development, debugging is the process of finding and resolving ''bugs'' (defects or problems that prevent correct operation) within computer programs, software, or systems.
Debugging tactics can involve in ...
purposes. It is also sometimes simply referred to as a pause.
More generally, a breakpoint is a means of acquiring knowledge about a program during its execution. During the
interruption, the
programmer
A computer programmer, sometimes referred to as a software developer, a software engineer, a programmer or a coder, is a person who creates computer programs — often for larger computer software.
A programmer is someone who writes/creates ...
inspects the test
environment
Environment most often refers to:
__NOTOC__
* Natural environment, all living and non-living things occurring naturally
* Biophysical environment, the physical and biological factors along with their chemical interactions that affect an organism or ...
(
general purpose register
A processor register is a quickly accessible location available to a computer's processor. Registers usually consist of a small amount of fast storage, although some registers have specific hardware functions, and may be read-only or write-only. ...
s,
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 remembered ...
, logs,
files
File or filing may refer to:
Mechanical tools and processes
* File (tool), a tool used to ''remove'' fine amounts of material from a workpiece
**Filing (metalworking), a material removal process in manufacturing
** Nail file, a tool used to gent ...
, etc.) to find out whether the program is functioning as expected. In practice, a breakpoint consists of one or more conditions that determine when a program's execution should be interrupted.
Breakpoints were invented for
ENIAC
ENIAC (; Electronic Numerical Integrator and Computer) was the first programmable, electronic, general-purpose digital computer, completed in 1945. There were other computers that had these features, but the ENIAC had all of them in one pac ...
, one of the earliest digital computers, by programmer
Betty Holberton
Frances Elizabeth Holberton (March 7, 1917 – December 8, 2001) was an American computer scientist who was one of the six original programmers of the first general-purpose electronic digital computer, ENIAC. The other five ENIAC programmers wer ...
. In the initial design of ENIAC, program flow was set by plugging cables from one unit to another. To make the program stop at a certain point, a cable was removed, called a ''breakpoint''.
Machine breakpoints
Early mainframe computers, such as the
IBM/360
The IBM System/360 (S/360) is a family of mainframe computer systems that was announced by IBM on April 7, 1964, and delivered between 1965 and 1978. It was the first family of computers designed to cover both commercial and scientific applica ...
, had console switches/dials that allowed breakpoints at specific instruction storage addresses and provided "single cycle" operation, permitting the contents of registers and memory to be observed directly on console lights. The advent of multitasking limited the use of this option since the entire machine was halted.
Non-interactive breakpoints
Programmers have used machine code patches to implement single destructive breakpoints to cause a
core dump
In computing, a core dump, memory dump, crash dump, storage dump, system dump, or ABEND dump consists of the recorded state of the working Computer storage, memory of a computer program at a specific time, generally when the program has crash (comp ...
since the early days of computers. The core dump provided the state of the registers and memory at the exact moment of the deliberate "crash".
Interactive breakpoints
The advent of
teletypewriter consoles in the 1960s allowed more interactive
command line
A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
debugging capabilities but it was not until the early 1970s and the arrival of ubiquitous
video monitors connected to
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 ...
s that fully interactive, full screen debugging in multitasking environments became a reality. This also permitted step-by-step program execution in a true
program animation manner with optional register and memory alterations simultaneously displayed. Initially this type of animation was at the level of
disassembled or
decompiled machine code, but later advanced to
HLL source level animation.
Breakpoint conditions
Breakpoints are most commonly used to interrupt a running program immediately before the execution of a programmer-specified
instruction. This is often referred to as an ''instruction breakpoint''.
Other kinds of conditions can also be used, such as the reading, writing, or modification of a specific location in an area of memory. This is often referred to as a ''conditional breakpoint'', a ''data breakpoint'', or a ''watchpoint''. On the other hand, ''non-breaking breakpoints'', sometimes called ''logpoints'', can show the full state of a piece of code at the breakpoint without stopping its execution.
Breakpoints can also be used to interrupt execution at a particular time, upon a keystroke etc.
Inspection tools
When a breakpoint is hit, various tools are used to inspect the state of the program or alter it.
Stack trace
In computing, a stack trace (also called stack backtrace or stack traceback) is a report of the active stack frames at a certain point in time during the execution of a program. When a program is run, memory is often dynamically allocated in two ...
of each
thread
Thread may refer to:
Objects
* Thread (yarn), a kind of thin yarn used for sewing
** Thread (unit of measurement), a cotton yarn measure
* Screw thread, a helical ridge on a cylindrical fastener
Arts and entertainment
* ''Thread'' (film), 2016 ...
may be used to see the chain of
function calls that led to the paused instruction. A list of ''watches'' allows one to view the values of selected
variables and
expressions. There may also be tools to show the contents of
registers, loaded program
modules and other information.
Implementations
Hardware
Many
processors
A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, an ...
include
hardware support for breakpoints (typically instruction and data breakpoints). As an example, the x86 instruction set architecture provides hardware support for breakpoints with its
x86 debug registers. Such hardware may include limitations, for example not allowing breakpoints on instructions located in
branch delay slot
In computer architecture, a delay slot is an instruction slot being executed without the effects of a preceding instruction. The most common form is a single arbitrary instruction located immediately after a branch instruction on a RISC or DSP ...
s. This kind of limitation is imposed by the
microarchitecture
In computer engineering, microarchitecture, also called computer organization and sometimes abbreviated as µarch or uarch, is the way a given instruction set architecture (ISA) is implemented in a particular processor. A given ISA may be imp ...
of the processor and varies from processor to processor.
Software
Without hardware support (and in multitasking environments),
debugger
A debugger or debugging tool is a computer program used to test and debug other programs (the "target" program). The main use of a debugger is to run the target program under controlled conditions that permit the programmer to track its execut ...
s have to implement breakpoints in software. For instruction breakpoints, this is a comparatively simple task of replacing the instruction at the location of the breakpoint by either:
* an instruction that calls the debugger directly (e.g. a
system call
In computing, a system call (commonly abbreviated to syscall) is the programmatic way in which a computer program requests a service from the operating system on which it is executed. This may include hardware-related services (for example, acc ...
) or
* an invalid instruction that causes a deliberate program interrupt (that is then intercepted/handled by the debugger)
This technique may be more difficult to implement in multitasking systems using shared program storage (the interrupt may occur on a different thread, requiring resurrection of the original instruction for that thread). Also, if the program resides in protected memory, overwriting of instructions may be prevented.
Alternatively,
* an
instruction set simulator can implement unconditional or conditional breakpoints, by simply embedding the appropriate condition tests within its own normal
program cycle – that also naturally allows non-invasive breakpoints (on
read-only programs for instance).
*
Interpreted language
In computer science, an interpreter is a computer program that directly executes instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program. An interpre ...
s can effectively use the same concept as above in their program cycle.
*
"Instrumenting" all the source code with additional source statements that issue a
function that invokes an internal or external debug subroutine, is yet another common approach. This method increases the
binary size and might adversely affect normal memory allocation and
exception handlers. "Debug" options exist on some compilers to implement this technique semi-transparently.
Some debuggers allow registers or program variables in memory to be modified before resuming, effectively allowing the introduction of "hand-coded" temporary assignments for test purposes. Similarly, program instructions can often be skipped to determine the effect of changes to the program logic – enabling questions about program execution to be answered in a direct way (i.e. without assumptions or guesswork). In many cases it may be the only practical method of testing obscure "event-driven" error subroutines that rarely, if ever, get executed – without the added risk of leaving temporary source changes. Manually changing the resume location within a paused program can be used to enter an otherwise rarely executed section of code (such as a specific hardware condition handler).
Implementing data breakpoints in software however, can greatly reduce the performance of the application being debugged – since it is using additional resources on the same processor. However, this is normally acceptable during testing and the amount of information available from the debugger is not restricted by limitations of debug data known to the hardware. For instance, a software implementation can collect logical path data at program/subroutine/instruction level to considerably augment what might be stored by the particular hardware platform for inspection. The instruction set simulation method considerably reduces the overhead, compared to the (repeated) instruction replacement method, also reducing
cache miss
In computing, a cache ( ) is a hardware or software component that stores data so that future requests for that data can be served faster; the data stored in a cache might be the result of an earlier computation or a copy of data stored elsewhe ...
es.
Some programming language implementations
expose
Expose, exposé, or exposed may refer to:
News sources
* Exposé (journalism), a form of investigative journalism
* '' The Exposé'', a British conspiracist website
Film and TV Film
* ''Exposé'' (film), a 1976 thriller film
* ''Exposed'' (1932 ...
their debugging functions for use by other programs.
For example, some
FORTRAN dialects have an
AT
statement, which was originally intended to act as an instruction breakpoint.
Python implements a debugger accessible from a Python program.
These facilities can be and are
entrian.com – goto and comefrom for Python
/ref> abused to act like the COMEFROM statement.
See also
* COMEFROM
* Program animation (Stepping)
* SIMMON
References
{{reflist
Debugging