最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

debugging - Some breakpoints are disabled (gray-crossed) in Delphi debugger – why? How to enable all of them? - Stack Overflow

programmeradmin6浏览0评论

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:

  1. What causes a breakpoint to be marked with a gray cross and ignored by the debugger?
  2. Is Delphi performing some kind of decision to determine which breakpoints to honor?
  3. 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 .dcus 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:

  1. What causes a breakpoint to be marked with a gray cross and ignored by the debugger?
  2. Is Delphi performing some kind of decision to determine which breakpoints to honor?
  3. 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 .dcus 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.

Share Improve this question edited Mar 27 at 17:46 AmigoJack 6,1852 gold badges19 silver badges34 bronze badges asked Mar 27 at 8:42 TomRTomR 3,2366 gold badges43 silver badges108 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 5

Answers to your questions:

  1. Breakpoints are grayed out when breakpoint information is not available. The compiler must generate the necessary information for the debugger. For this:

    1. It is necessary to enable the generation of this debugging information in the project settings:
      Project options/Building/Delphi Compiler/Linking/Debug information.

    2. Enable Projects/Your Project/Build Configurations/Debug.

    3. Conditional compilation directives should be checked - they can disable part or all of the file from generating information for the {$D-} debugger.

    4. It is necessary to rebuild the project: Projects/Your Project/Build. The \*.rsm files will be created.

    5. Now you can debug.

  2. The procedure is simple: if there is no debug information, there is no breakpoint.

  3. 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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论