Cannot debug application in Delphi 12

Hi All

I have a project group containing 10-15 applications or packages.

When I try to debug one of my applications the IDE is not detecting that I am wanted to run in debug mode as the debug breakpoints are disabled and hence, I assume, no debug window is shown.

The default configuration is the Debug configuration and the Debug configuration in the project options has the DEBUG option included in the conditional defines.

I am at a loss as to why I cannot debug my code and am wondering if anyone in ADUG-Delphi land can assist me.

The problem does not occur for all projects as any new project can be debugged.

I just tried an earlier program in the project group and when I started to debug this program I got a dialog with ā€˜Updating Configurationā€™ in the caption and nothing else and the debug window opened.

I then tried my problem program again but still got no debug window.

I have also reinstalled Delphi 12 from scratch again and the problem disappeared (that is I could debug my app) but now I am back to being unable to debug my app.

I am running Delphi 12 Version 29.0.53982.0329 with update 2 on Windows 12 version 22H2 64 bit.

Does anyone have any ideas?
Is there anyone who could assist?

Regards
Graeme

When you say default configuration ā€¦ Do you mean this part?
Is a rebuild any help?

Hi

The reference to the ā€˜Updating Configurationā€™ screen was a furfee.

The program too does not debug.

Regards
Graeme

Hi Paul

Yes that is the configuration mentioned.

The reference to ā€˜Updating Configurationā€™ has nothing to do with the problem tho.

By a rebuild I assume that you mean a re-installation.

If so I have reinstalled Delphi after clearing all references.

BTW my machine has Delphi 11 installed on it - could this be the cause of the problem. I donā€™t think so but who knows ā€¦

Any other ideas gratefully accepted.

Regards
Graeme

Just tried a

asm
int 3; // Enter CPU Debugger
end;

The program stopped but there were no debug details, only the cpu details

Regards
Graeme

This could be because of the current .dproj file, created with an older Delphi version, conflicts with Delphi 12.
=> I would suggest you to delete your current .dproj file (make a copy first), open the project in the IDE, and see if the Debug build configuration behaves correctly.
If it does, you can then manually add steps by steps all the necessary settings from your old .dproj

By ā€˜buildā€™ I meant as opposed to ā€˜compileā€™ ā€¦

If you are hitting breakpoints, but itā€™s bringing up the cpu/assembly window, I think people here have had that battle before.
(was it possibly associated with the option to trace into the RTL?)

Hi Didier

Thank you for your response.

I believe I did this when I reinstalled Delphi but will give your suggestion a try tomorrow morning (Itā€™s getting late here in Melbourne).

Come to think of it I could debug for a short time after I installed Delphi. You may be correct about the fix.

If you are then my only concern is why is my dproj file getting corrupted.

Anyway, Iā€™ll give it a try tomorrow.

Thanks for you assistance.

Regards
Graeme

1 Like

Hi Didier

No luck.

Still cannot debug.

I deleted all my dprog files and hence the project group was empty.

So I added them one at a time, setup configuration info (dcu path, search path etc) and recompiled.

Still no breakpoint.

By the way, my project group consists of both applications and projects. Could this cause a problem?

Regards
Graeme

1 Like

Please forget your project group, and try to focus on the behaviour when opening a Delphi project using only the Delphi project file (.dpr):

  1. Delete the .dproj file
  2. Drag & drop your .dpr file in the Delphi IDE
  3. Activate the Debug build configuration.
  4. Build the project.

Is the debugger still disabled?

Is the project an application (.exe) or a DLL? I get the same thing when debugging a DLL when the registered DLL isnā€™t in the same place as expected, the host application runs the wrong DLLā€¦ Also try deleting all DCU filesā€¦

Regards,

Hi Graeme,

Is the unit with the breakpoint part of a package or exe project?

Most likely causes are:

  • One or more projects in the group are set to Release instead of Debug (or were at some point). Use the ā€œset active configurationā€ drop down at the top of the project manager and select Debug to make sure all are debug
  • There is a stale DCU that was compiled in release mode. Could just be that the project(s) it is in needs to be built again, or there are old DCUs lying around in other folders in the path. Do a ā€œbuild allā€ after the prev check
  • Inconsistent paths across projects, related to prev possibility (check output paths are what you expect)
  • Edit: two other possible causes:
  • A second copy of the source file floating around and the one open in the IDE with breakpoints is not the one that gets compiled
  • Hard to tell based on the symptoms you described but sometimes the editor thinks that the source lines are offset and the breakpoint is actually on a non-code line such as a comment/blank line. This tends to happen with some use of anonymous methods. Probably a mismatch between the editor line numbers and the line numbers the compiler outputs. Check the alignment of the gutter dots and executable code lines. Litter the method with breakpoints on other lines (blank/comment) to see if those work

Cheers

Hi Jarod, Didier and Paul

I have managed to resolve my problem.

The cause was an incorrectly specified environment variable. I use this variable in the path names for the dcp folder, the pkg folder the dcu folder and the search folders.

The value I wanted was ā€˜R:ā€™ (without the quotes).

I believed that I had used the ā€¦ button when specifying the variableā€™s value without really looking at what was returned. The string being returned was 'R:' and all my folder names had double 's. For example my dcu folder was R:\dcu instead of R:\dcu.

Hope you can understand my response.

Anyway thank you for all your assistance - I did lean a lot from your comments.

Regards
Graeme

1 Like

Iā€™m guessing you were trying to say R:\\dcu vs R:\dcu ?

(Discourse uses '\ ā€™ as an escape character, so single = '\ ', double = '\ ', triple = '\\ ')

Thanks Paul

1 Like