I’m working with Delphi and placing breakpoints (red circles on the left side of the editor near the line numbers). When I start debugging (e.g., using F4 or Run > Run to Cursor), some of the breakpoints remain active and stop the debugger (indicated by a red circle with a green check mark), but some breakpoints are shown with a gray cross, and the debugger does not stop at them.
What do these gray-crossed breakpoints mean?
Here’s what I’ve observed:
- The breakpoints with a gray cross are located in a
.pas
file that defines a component. - I’ve added this
.pas
file to my project manually from the component’s source code. - I expected the debugger to stop at all breakpoints, but it seems to ignore some of them.
My questions:
- What causes a breakpoint to be marked with a gray cross and ignored by the debugger?
- Is Delphi performing some kind of decision to determine which breakpoints to honor?
- How can I ensure all my breakpoints are respected, including those in manually added component source files?
Additional information: all my units (.dcu
files) are stored what I have indicated in Unit output directory of the project options. And, of course, the units from the component source, create .dcu
s here and alse recreates (at lest judging by last modified time) units here. Also: if I add some code to this component file (e.g. MessageDlg
call) then this code works normal in the final .exe
- I just have a problem with breakpoints: they are crossed and ignored.
I’m working with Delphi and placing breakpoints (red circles on the left side of the editor near the line numbers). When I start debugging (e.g., using F4 or Run > Run to Cursor), some of the breakpoints remain active and stop the debugger (indicated by a red circle with a green check mark), but some breakpoints are shown with a gray cross, and the debugger does not stop at them.
What do these gray-crossed breakpoints mean?
Here’s what I’ve observed:
- The breakpoints with a gray cross are located in a
.pas
file that defines a component. - I’ve added this
.pas
file to my project manually from the component’s source code. - I expected the debugger to stop at all breakpoints, but it seems to ignore some of them.
My questions:
- What causes a breakpoint to be marked with a gray cross and ignored by the debugger?
- Is Delphi performing some kind of decision to determine which breakpoints to honor?
- How can I ensure all my breakpoints are respected, including those in manually added component source files?
Additional information: all my units (.dcu
files) are stored what I have indicated in Unit output directory of the project options. And, of course, the units from the component source, create .dcu
s here and alse recreates (at lest judging by last modified time) units here. Also: if I add some code to this component file (e.g. MessageDlg
call) then this code works normal in the final .exe
- I just have a problem with breakpoints: they are crossed and ignored.
2 Answers
Reset to default 5Answers to your questions:
Breakpoints are grayed out when breakpoint information is not available. The compiler must generate the necessary information for the debugger. For this:
It is necessary to enable the generation of this debugging information in the project settings:
Project options/Building/Delphi Compiler/Linking/Debug information.Enable Projects/Your Project/Build Configurations/Debug.
Conditional compilation directives should be checked - they can disable part or all of the file from generating information for the
{$D-}
debugger.It is necessary to rebuild the project: Projects/Your Project/Build. The
\*.rsm
files will be created.Now you can debug.
The procedure is simple: if there is no debug information, there is no breakpoint.
You won't have any breakpoints in gray.
PS: It is necessary to build a project with the option of adding debugging information enabled. It won't add itself! Only then the project will be fully ready for debugging.
When creating a finished project, debugging information is deleted from it (Release mode).
The .pas
file from my component included this code:
{$D-}
interface
And this directive, of course, prevents to include the debugger info into the .dcu
file. So: commenting out this directive enabled breakpoints.