Recently I noticed that Delphi was not stopping on exceptions. I was having nil pointer exceptions because a variable hadn’t been initialized. Then I was checking a different thing and put in a breakpoint, but Delphi ignored the breakpoint entirely. I got it working briefly by deleting all the breakpoints for that project. That only worked a few times, then the breakpoint I wanted was being ignored again.
I tried another project: opened it, put in a breakpoint and it worked once, then it started getting ignored.
I am using Delphi 10.4 Version 27.0.40680.4203 in windows 10.
Does anyone have any ideas what might have happened?
I don’t really think you can rely on 10.4 in production. 11.3 is still buggy enough, the 10.4 line was a disaster. Sounds like a bug to me.
I doubt anyone is going to be able to give you a magic bullet fix on this one but here’s a few facepalmers just in case you’ve missed something.
- Double check you’re running a debug build
- Project Manager | Right Click on your project | Clean
- What happens when you start your project with F7 or F8 rather than F9? You should be able to step through it from the very beginning.
- Project Manager | Your Project | Build Configurations | Debug | Edit | Delphi Compiler | Compiling | Debugging | Turn most of them on
- Project Manager | Your Project | Build Configurations | Debug | Edit | Delphi Compiler | Linking | Debug information
- Tools | Options | Debugger Options | General | Integrated Debugging
- Tools | Options | Debugger Options | Embarcadero Debuggers | Language Exceptions | Exception types to ignore
- Tools | Options | Debugger Options | Embarcadero Debuggers | Language Exceptions | Notify on language exceptions (should be checked - help entry is a bit confusing)
Have I missed any?
I have found closing the project (group), and deleting the dsk file sometimes helps.
Also, (more in a project group with shared files) the file you are looking at may not be the file
for the project you are building, it may be the same physical file, but the compiler thinks it is one associated with another project.
Add the file to the project if it isn’t already, then double click on that one in the project list.
(Maybe close all other files first)
Another thing to check for is your librarary path and or project search path. Make sure there are not duplicate dcu files laying about. I have experienced this before where I had changed the project output path but the previously compiled dcu was still on the library path - very confusing as the compiler seemed to randomly choose which one to compile.
It seems to be a fragile thing. I have just got it going again by doing Project manager | Clean. After that running from f7 and hitting a breakpoint in the code did invoke the debugger.
I hope my firm can upgrade.
Project Manager | Your Project | Build Configurations | Debug | Edit | Delphi Compiler | Compiling | Debugging | Turn most of them on
The one to avoid is Debug .dcus. That has you single stepping through system.pas, and even assembler code.
Project Manager | Your Project | Build Configurations | Debug | Edit | Delphi Compiler | Linking | Debug information
I had debug information off, dunno how or why. I turned it on.
Tools | Options | Debugger Options | General | Integrated Debugging
Integrated deugging was already on
Tools | Options | Debugger Options | Embarcadero Debuggers | Language Exceptions | Exception types to ignore
I haven’t changed that in ages. So it is probably about right
And yet, the break points are not breaking
Just don’t stake your reputation at work on an upgrade fixing this issue. I use Delphi 10.4 a lot and I don’t experience this issue.
I do all my development in VMs with snapshots which helps me maintain very clean Delphi environments as I periodically revert my VMs back to known good states. I think that’s a big reason why I don’t encounter many of these deterioration over time type issues, while others do.
Unless you conclusively find evidence that this a known issue with the debugger explicitly resolved by Delphi 11, then an upgrade will perhaps only coincidentally resolve this issue for you.
By coincidentally fix it I mean installing Delphi 11 would give you a clean slate install without whatever project/environment detritus is causing the issue. In that case a clean slate Delphi 10.4 installation is probably just as likely to fix it as well.
Of course getting a clean slate Delphi 10.4 install back up to speed is rarely a quick and easy operation (why I like my VMs so much).
I think I may have solved the problem.
Somehow the normal run button got replaced with the Run without debugging button. So far the best explanation is that when I had the problem was when I ran the program by hitting the Run button, and when it ran fine it was because I hit F9. I don’t remember changing it, and I don’t remember whether I hit F9 or the button each time I had breakpoints or not, But, now I am back in happy land.