What are debuggers

W

Debuggers are sophisticated programs that allow the execution of other applications in a controlled manner; they allow the execution, observation and modification of another program. Debuggers use a variety of techniques related to fault isolation software, and tool support that generates programs and operating system. Debuggers behave against the debugging program similar to some interpreters, executing the instructions one by one.

Because writing an interpreter (machine-code interpreters are called “emulators“) is a very complicated task, the debuggers use certain services provided by the operating system.
The operating system is itself a huge tool that makes software fault isolation: it allows for parallel execution of several programs, but prevents their interference by clamping each person’s access to their own memory area with virtual memory and controlling the interaction between processes and resources through system calls.

We will discuss here only the debuggers that allow debugging a program in the language in which it was written (source language); machine debugger debuggers are substantially simpler and less useful. A debugger interacts with the operating system to control the debugging program with the executable file to extract debugging information and source files to converse with the user.
A debugger gives the most important support from the compiler that translates the source file into machine language.

The compiler may be asked to submit information about the program structure in the executable file. This information is what is called the ‘symbol table’. The information associates each instruction in the resulting machine code with its source code line indicates the addresses of all variables in the source program, their types, address of the procedures, and their types, etc.
Often more than 60% of the size of an executable file consists only of such information. On Unix systems there is a utility called strip which erases such information; it can be used to save space on the disk. However, without debugging information, the debugger can not match the object code to the source files.

There are a number of deployment reporting standards that are designed to make it possible to debug a program generated by any compiler with any debugger. To be effective, a debugger also uses hardware support. This support allows you to execute debug programs at maximum speed, intervening only when needed instead of tracking their execution step by step, emulating each instruction separately. Here’s how these mechanisms work: modern microprocessors have special registers, where they can write different addresses. Processors promise that when these addresses appear in the program, the hardware generates an exception, which can then be handled by the software. A breakpoint is a value that is compared to the current address of the code in the PC (Program Counter): in other words, when the program reaches the address indicated by a breakpoint, an interrupt is automatically generated.

Alternatively, a breakpoint may be an instruction that generates an interruption itself when executed, called a breakpoint instruction. Debuggers can use both types of badges.

A breakpoint is a conditional one: it stops execution only if a given expression has a certain value; otherwise, it continues.
A watchpoint (supervisor) is a value that is compared to the data address; if a program wants to read or write to a specific address, an interruption is generated.
The debugger is a program, and the debugger is another program. The operating system provides a special interface, through which a program can observe the behavior of another. The operating system also complies with security rules: only the user who has started a process has the right to debug it; otherwise, debuggers could be used to extract unauthorized information.
If the libraries with which the program is linked come with debugging information, the debugger can be used to troubleshoot them. The debugger captures calls by which processes link dynamic libraries at runtime, and reads them as soon as they are loaded.

About the author

Ilias spiros
By Ilias spiros

Recent Posts

Archives

Categories