Debugging options can be set at two levels: project-level and environment-level. The project-level debugging options are described in the previous explanation. The main menu is "project | OPTIONS ...] Open the following dialog box:
You canDebugger optionsSet global debugging options in the dialog box. The debugger Options dialog box is displayed from the "Tools | debugger options" menu of the main menu.
The bottom of the debugger Options dialog box is markedIntegrated debuggingCheck box, which controls whether to use the IDE debugger to debug the program. If the check box of Integrated debugging is selected, the IDE debugger is used. If this option is not selected, the IDE debugger is not used. This means that when you click the run button, the program runs but the debugger fails, therefore, all breakpoints do not work.
The debugger option dialog box has four pages: general, Event Log, language exceptions, and OS exceptions. The following sections describe:
1. General page
The general page is where you set general debugging options, for example:
Map td32 keystrokes on run option tells code editor to use the key-strike ing used in Turbo debugger (turbo debugger is a separate debugger of Borland ). If you have been using turbo Debugger for a long time and are familiar with key ing, this option is a good tool.
When the program runs under the debugger, [Mark buffers read-only on run option] sets the code editor buffer to a read-only buffer. In this way, after the program is started under the debugger, you cannot edit the source code until the program stops running. If you want to modify the source code during the debugger, disable this option.
Inspector stay on top option controls whether the debug Inspector window is always on the code editor. This is a good feature, because when users step-by-step debugging code, most of the time they want the debug Inspector window to be on the code editor.
When the program runs under the debugger, [rearrange editor local menu on run option] changes the appearance of the Code Editor Shortcut menu. With this option selected, the debugging special menu item in the Code Editor menu is moved to the top of the menu for your convenience.
Deselected status menu
Menu in the selected status
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 messages that can appear in event logs at the same time. You can also select the type of the message you want to view in event log.
3. Language exceptions page
This page is used to control the type of VCL exceptions encountered by the debugger. The most important option on this page is the stop on Delphi exceptions option ]. When this option is selected, if an exception occurs, the debugger Suspends Program Execution. When this option is disabled, the debugger handles VCL exceptions in a common way, that is, an error message box is displayed to notify the user program.
Note
When the stop on Delphi exceptions option is selected, the debugger will pause when an exception is encountered, regardless of whether the exception is handled in the user program. If you do not want the debugger to stop every exception, disable this option. This option is equivalent to the break on exception option in earlier versions of Delphi ].
[Exception types to ignore option] specifies the type of exception events ignored by the debugger. All exception event types listed in this table are ignored by the debugger and processed by default. This is the same effect as disabling the stop on Delphi exceptions option.
To add the exception event type to the table, click Add... Button and enter the exception event type name. For example, to notify the debugger to ignore the "0 division" exception event, click the Add button and enter edivbyzero in the exception type field. For example:
The exception event type added to this list applies to all projects.
4. OS (operating system) exception page
This page controls whether the debugger or user program handles operating system exception events. For example:
When handled by option is set to user program, the debugger interrupts program execution when an exception occurs. When this option is set to debugger, a message box is displayed to notify the user of errors in the program.
Note
When you set "handled by option" to "Debugger", the debugger will interrupt the program running when an exception event is encountered, regardless of whether the user program processes the exception event. If you do not want the debugger to interrupt every time an exception event occurs, set this option to user program. This option is equivalent to the break on exception option in earlier versions of Delphi ].
[On Resume] determines how to handle abnormal events after the program is re-restored.
Possible operating system exception events are listed in the exceptions list. 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 on the left edge of the exceptions list box indicates Exception Handling and recovery execution settings. For example:
Summary
Debugging programs is an endless task. Debugging is not just about checking program faults. Sophisticated programmers start learning to use debuggers when they start creating new projects. The debugger is both a development tool and a tool for fault locating. You need to spend more time using the debugger to master it. From now on.