You can set debug options at two levels: Engineering and environment. The project-level debugging options are explained in the previous tutorial through the main Menu "project | Options ... "Opens the following dialog box:
You can set global-level debugging options in the Debugger Options dialog box. From the main Menu "Tools | Debugger Options menu item to bring up the Debugger Options dialog box.
At the bottom of the Debugger Options dialog box, there is a check box labeled Integrated Debugging , which controls whether the IDE debugger is used to debug the program. If the Integrated debugging check box is selected, the IDE debugger is used, and if this option is not selected, the IDE debugger is not used, which means that when the user taps the Run button, the program executes, but the debugger fails, so all breakpoints do not work.
The Debugger Options dialog box has four pages: General,event Log, Language exceptions,os Exceptions. The following will be described separately:
1. General Page
The General page is where the user sets common debugging options, such as:
The "Map TD32 keystrokes on Run option" tells code Editor to use the keystroke mapping used in the Turbo Debugger (Turbo Debugger is a separate debugger for Borland company). This option is a good tool if the user is using the Turbo Debugger for a long time and is familiar with its key mapping.
When the program is running under the debugger, the "Mark buffers read-only on Run option" sets the code editor buffer to read-only buffer. This way, after you start the program under the debugger, you can no longer edit the source code until the program stops running. If you want to modify the source code during the debugger, turn this option off.
The Inspector stay on top option controls whether the Debug Inspector window is always on top of code editor. This is a good feature, because most of the time when the user is stepping through the code, you want the Debug inspector window above the Code Editor.
When the program is running under the debugger, the rearrange editor local menu on Run option changes the appearance of the Code Editor shortcut menu. With this option selected, the Debug Special menu item in the Code editor menu moves to the top of the menu for easy user selection.
Do not select the Status menu
Menu of selected state
2. Event Log page
The Event Log page is used to set the event Log option. You can select a number to limit the number of message bars that can appear in the event log at the same time, or you can make no restrictions. You can also select the type of message you want to see in the event log.
3. Language exception (Language Exceptions) page
This page is used to control the type of VCL exception encountered by the debugger. The most important option on this page is "Stop on Delphi exceptions option". When this option is selected, the debugger pauses program execution if an exception occurs. When this option is turned off, the debugger handles the VCL exception in a normal manner, which pops up a message box to notify the user of the error that the program has encountered.
Note
When "Stop on Delphi exceptions option" is selected, the debugger pauses when it encounters an exception, regardless of whether the exception has been handled in the user program. If you do not want the debugger to stop every encounter with an exception, turn this option off. This option is equivalent to the "Break on Exception option" in the old version of Delphi.
The Exception Types to ignore option specifies the type of exception event that is ignored by the debugger. All exception event types listed in this table are ignored by the debugger and are handled by default. This is the same effect as turning off the Stop on Delphi exceptions option.
To add an exception event type to the table, click Add ... button and enter the exception event type name. For example, to tell the debugger to ignore the "divide by 0" exception event, you can click the Add button and enter Edivbyzero in the Exception type field. Such as:
The exception event types that are added to the list apply to all projects.
4. OS (operating System) exception page
This page controls whether the debugger or user program handles operating system exception events. Such as:
When the Handled by option is set to User program, the debugger interrupts execution when an exception event is encountered. When this option is set to debugger, the VCL exception is handled in a normal manner, which pops up a message box to notify the user of the error that occurred in the program.
Note
When the Handled by option is set to debugger, the debugger interrupts the program when it encounters an exception, regardless of whether the user program has handled the exception event. If you do not want the debugger to break every encounter with an exception event, set this option to user program. This option is equivalent to the "Break on Exception option" in the old version of Delphi.
The On Resume option determines how exception events are handled when the recovery program executes.
The possible operating system exception events are listed in the Exceptions list box. To set options for a type, click the Exception event type in the Exceptions list and set the handled by and on resume options as required. The symbol for the left edge of the Exceptions list box indicates exception handling and recovery execution settings. Such as:
Summary
Debugging a program is an endless task. The debug program is not just about checking for faults in the program. Savvy programmers start learning to use the debugger when they start to create new projects. The debugger is both a development tool and a tool to find faults. It takes a lot more time to actually use the debugger before you can master it. Let's start from now on.
Debugging of the Delphi Application (10) Debugger options