Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi: why breakpoints from time to time are not usable (green highlighted line on IDE)?

From time to time I lose breakpoint functionality in Delphi.

I thought this to be a Delphi 2009 issue but now I have also it in Delphi XE.

In Delphi 2009 by deleting .dproj file I made the breakpoints work again.

In Delphi XE I am not able to make breakopints appear. I have update 1 with all hotfixes applied.

Does anyone have a solution?

like image 680
LaBracca Avatar asked Apr 15 '11 16:04

LaBracca


People also ask

Why breakpoints are not working?

If a source file has changed and the source no longer matches the code you're debugging, the debugger won't set breakpoints in the code by default. Normally, this problem happens when a source file is changed, but the source code wasn't rebuilt. To fix this issue, rebuild the project.

What are breakpoints used for in an IDE?

A breakpoint is a marker that you can set to specify where execution should pause when you are running your application in the IDE's debugger. Breakpoints are stored in the IDE (not in your application's code) and persist between debugging sessions and IDE sessions.

How do you use breakpoints in Delphi?

Using of Breakpoints We can put break point by pressing the F5 button or clicking on the left bar in your code editor, it will put a red point to your source code line. When running the program, the execution will stop when it passes the source line.

Why breakpoints are not working in Eclipse?

The debugger stops at main because a temporary breakpoint was set there. You don't see it because it evaporates as soon as it is hit. So, Eclipse IS setting breakpoints that work.


2 Answers

Debug info isn't present in the file.

Make sure that you're using the Debug configuration. (Project Manager tree, expand Build Configurations, make sure Debug is bold. If it's not, right click Debug and choose Activate from the context menu.) Make sure you then do a Build of your project, not just a Compile.

If that still doesn't work, go to Project->Options from the IDE's main menu, click on Compiling under Delphi Compiler, and check the Debugging section on the right half of the window. Make sure that Debug Information and Local Symbols are both checked. If you're trying to trace into the VCL's own source, also check Use debug .dcus (you'll want to turn this off and do a full build of your project as soon as you're done, as it gets annoying when you're debugging normally). Again, you'll want to build and not compile.

If all of the above fails, another possibility is that the code unit you have open in the Code Editor isn't the same one being seen by the compiler. Make sure you don't have multiple copies of the file on your computer in a location that the compiler might find first. If you're not sure, delete the .dcu files with that unit name and then do a build of your project, and see if the newly created .dcu is in the location you'd expect.

like image 145
Ken White Avatar answered Sep 28 '22 00:09

Ken White


I found a better way.

From the Project Manager tree, right click on the project and choose "Clean" from the popupmenu.

The breakpoints reappear magically and it is a very fast method.

like image 24
LaBracca Avatar answered Sep 28 '22 02:09

LaBracca