Difference between revisions of "Debugger"
(A pretty good start) |
(No difference)
|
Revision as of 22:50, 24 October 2018
A debugger is a program which is used together with another program (the one being 'debugged') to find faults in the other program. They can be used on machines without an operating system, in which case the debugger has to share the machine with the program being debugged; on systems which support processes, generally the debugger is in one process, and the program being debugged is in another.
Simple debuggers only allow the programmer to examine the program after it has failed; look and see what was in the CPU's registers, main memory locations, etc. Use of a symbol table allows memory locations to be selected by their name in the program, instead of the programmer having to work out their numeric addresses.
These debuggers often operate on a core dump, where the operating system stores the contents of a process' address space, etc on secondary storage when the process hits a trap, or at the request of the user.
More powerful debuggers allow the program to be debugged to be started, and as it runs, the capabilities of the debugger are used to watch the program run. Such debuggers contain a number of tools which are used to do this:
- The ability to install breakpoints, which are places in the program which, when execution reaches that instruction, the program stops running, so the debugger can examine registers, memory, etc.
- Single-stepping, where the CPU executes a single instruction of the program, and then returns control to the debugger.
- Stack traces, which show the list of subroutine invocations on the stack.
Originally, debuggers operated at the assembly language level, but debuggers can now operated at the higher-level programming language level.