Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Breakpoint
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Software=== Without hardware support (and in multitasking environments), [[debugger]]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]], or [[INT_(x86_instruction)#INT3|int3]] in case of [[x86]]) 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 [[Main loop|program cycle]] β that also naturally allows non-invasive breakpoints (on [[Read-only memory|read-only]] programs for instance). * [[Interpreted language]]s can effectively use the same concept as above in their program cycle. * [[Instrumentation (computer programming)|"Instrumenting"]] all the source code with additional source statements that issue a [[Function (computer science)|function]] that invokes an internal or external debug subroutine, is yet another common approach. This method increases the [[binary file|binary]] size and might adversely affect normal memory allocation and [[exception handler]]s. "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.<ref>[http://sources.redhat.com/gdb/onlinedocs/gdbint.html#GDB-Observers GDB Internals] {{webarchive |url=https://web.archive.org/web/20111129041954/http://sources.redhat.com/gdb/onlinedocs/gdbint.html#GDB-Observers |date=November 29, 2011 }}</ref> 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]]es. Some programming language implementations [[Reflection (computer science)|expose]] their debugging functions for use by other programs. For example, some [[FORTRAN]] dialects have an <code>AT</code> statement, which was originally intended to act as an instruction breakpoint. [[Python (programming language)|Python]] implements a debugger accessible from a Python program.<ref>[https://docs.python.org/lib/module-pdb.html Python Library Reference: The Python Debugger] {{webarchive |url=https://web.archive.org/web/20080913202136/https://docs.python.org/lib/module-pdb.html |date=September 13, 2008 }}</ref> These facilities can be and are<ref>[http://entrian.com/goto/ entrian.com β goto and comefrom for Python]</ref> abused to act like the [[COMEFROM]] statement.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)