Breakpoint (other)
   HOME

TheInfoList



OR:

In
software development Software development is the process of designing and Implementation, implementing a software solution to Computer user satisfaction, satisfy a User (computing), user. The process is more encompassing than Computer programming, programming, wri ...
, a breakpoint is an intentional stopping or pausing place in a
program Program (American English; also Commonwealth English in terms of computer programming and related activities) or programme (Commonwealth English in all other meanings), programmer, or programming may refer to: Business and management * Program m ...
, put in place for
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 ...
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 programmer, computer programmer or coder is an author of computer source code someone with skill in computer programming. The professional titles Software development, ''software developer'' and Software engineering, ''software engineer' ...
inspects the test environment (
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-onl ...
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 remembe ...
, 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 gentl ...
, 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.


History

Breakpoints were invented for
ENIAC ENIAC (; Electronic Numerical Integrator and Computer) was the first Computer programming, programmable, Electronics, electronic, general-purpose digital computer, completed in 1945. Other computers had some of these features, but ENIAC was ...
, 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 (Electronic Numerical Integrator And ...
. 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''.


Types of breakpoints


Machine breakpoints

Early mainframe computers, such as the
IBM/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 ...
, 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 (com ...
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 A teleprinter (teletypewriter, teletype or TTY) is an electromechanical device that can be used to send and receive typed messages through various communications channels, in both point-to-point and point-to-multipoint configurations. Init ...
consoles in the 1960s allowed more interactive
command line A command-line interface (CLI) is a means of interacting with software via command (computing), commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user ...
debugging capabilities but it was not until the early 1970s and the arrival of ubiquitous
video monitor A display device is an output device for presentation of information in visual or tactile form (the latter used for example in tactile electronic displays for blind people). When the input information that is supplied has an electrical signa ...
s 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 Program animation or stepping refers to the debugging method of executing Source code, code one instruction or line at a time. The programmer may examine the State (computer science), state of the program, machine, and related data before and after ...
manner with optional register and memory alterations simultaneously displayed. Initially this type of animation was at the level of
disassembled "Avengers Disassembled" is a 2004 crossover storyline published by Marvel Comics involving the Avengers, Fantastic Four, Captain America, Spider-Man and Thor. The beginning of Brian Michael Bendis's ''Avengers'' run, it depicts the destruction o ...
or
decompiled A decompiler is a computer program that translates an executable file back into high-level source code. Unlike a compiler, which converts high-level code into machine code, a decompiler performs the reverse process. While disassemblers translate ex ...
machine code, but later advanced to HLL source level animation.


Conditional breakpoints

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 ''data breakpoint'', or a ''watchpoint''. Many systems also support breakpoints that are only active if a condition is met (such as a variable having a certain value), usually referred to as ''conditional breakpoint''.


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 tw ...
of each thread may be used to see the chain of
function Function or functionality may refer to: Computing * Function key, a type of key on computer keyboards * Function model, a structured representation of processes in a system * Function object or functor or functionoid, a concept of object-orie ...
calls that led to the paused instruction. A list of ''watches'' allows one to view the values of selected
variables Variable may refer to: Computer science * Variable (computer science), a symbolic name associated with a value and whose associated value may be changed Mathematics * Variable (mathematics), a symbol that represents a quantity in a mathemat ...
and expressions. There may also be tools to show the contents of registers, loaded program modules and other information.


Logpoints

A ''logpoint'' is a type of breakpoint that only prints (or "logs") information instead of interrupting execution. Usually the developer can specify a message and/or values of variables to print when execution reaches a specific point. Logpoints are an alternative to putting logging statements into the program being debugged (sometimes called ''printf debugging''), and particularly helpful when changing the program is not practical (for example when debugging an external library called by the program).


Implementations


Hardware

Many
processors Processor may refer to: Computing Hardware * Processor (computing) ** Central processing unit (CPU), the hardware within a computer that executes a program *** Microprocessor, a central processing unit contained on a single integrated circuit ( ...
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 register On the x86 architecture, a debug register is a register used by a processor for program debugging. There are six debug registers, named DR0...DR7, with DR4 and DR5 as obsolete synonyms for DR6 and DR7. The debug registers allow programmers to sele ...
s. 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 DS ...
s. This kind of limitation is imposed by the
microarchitecture In electronics, computer science and 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 ...
of the processor and varies from processor to processor.


Software

Without hardware support (and in multitasking environments),
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 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 (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, accessing a hard disk drive ...
, or
int3 INT is an assembly language instruction for x86 processors that generates a software interrupt. It takes the interrupt number formatted as a byte value. When written in assembly language, the instruction is written like this: :INT ''X'' where ...
in case of
x86 x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel, based on the 8086 microprocessor and its 8-bit-external-bus variant, the 8088. Th ...
) 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 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 ...
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 inter ...
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 Function or functionality may refer to: Computing * Function key, a type of key on computer keyboards * Function model, a structured representation of processes in a system * Function object or functor or functionoid, a concept of object-orie ...
that invokes an internal or external debug subroutine, is yet another common approach. This method increases the
binary Binary may refer to: Science and technology Mathematics * Binary number, a representation of numbers using only two values (0 and 1) for each digit * Binary function, a function that takes two arguments * Binary operation, a mathematical op ...
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 elsew ...
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 * '' Exeposé'', a student-run newspaper of the University of Exeter Film and TV ...
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 Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (prog ...
implements a debugger accessible from a Python program. These facilities can be and areentrian.com – goto and comefrom for Python
/ref> abused to act like the
COMEFROM In computer programming, COMEFROM (or COME FROM) is an obscure control flow structure used in some programming languages, originally as a joke. COMEFROM is the inverse of GOTO in that it can take the execution state from any arbitrary point in cod ...
statement.


See also

*
COMEFROM In computer programming, COMEFROM (or COME FROM) is an obscure control flow structure used in some programming languages, originally as a joke. COMEFROM is the inverse of GOTO in that it can take the execution state from any arbitrary point in cod ...
*
Program animation Program animation or stepping refers to the debugging method of executing Source code, code one instruction or line at a time. The programmer may examine the State (computer science), state of the program, machine, and related data before and after ...
(Stepping) * SIMMON


References

{{reflist Debugging