Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to enable Debug DCUs without including the System unit?

Tags:

delphi

Using the debug DCUs in Delphi is really nice, except for the fact that the System unit adds a lot of overhead around method initialization/cleanup (releasing interfaces, clearing arrays, walking exception frames, etc).

Is there a way to run Delphi with debug DCUs, but without the System unit?

like image 467
Jeroen Wiert Pluimers Avatar asked Jan 01 '14 20:01

Jeroen Wiert Pluimers


2 Answers

When you enable Debug DCUs, all you are really doing is changing the DCU search path. Specifically that the paths specified by the Debug DCU Path option are used when searching for .dcu files.

So, you could create a new directory and add it to the front of the list of paths in the Debug DCU Path option. Into that directory place the standard System.dcu that does not contain debug symbols.

like image 173
David Heffernan Avatar answered Oct 26 '22 05:10

David Heffernan


  1. Backup ...\Embarcadero\RAD Studio\10.0\lib\win32\debug\System.dcu
  2. Copy ...\Embarcadero\RAD Studio\10.0\lib\win32\release\System.dcu to ...\Embarcadero\RAD Studio\10.0\lib\win32\debug\System.dcu
  3. Before applying a patch or update to Delphi, restore the original System.dcu file.

Repeat for the other plaforms: replace win32 with any of these, depending on the Delphi version you are running.

  • android
  • iosDevice
  • iossimulator
  • osx32
  • win64

Edit 2:

Repeat for the other supported languages than English: replace debug and release with debug\## and release\## for each of the languages ## you want to use.

Currently supported languages I know of:

  • de (German)
  • fr (French)
  • jp (Japanese)

Edit:

This way works well, even if an installation sequence messes up your search paths like that happened to me more than once in the Delphi XE / XE2 era.

It works fine for any unit in the release versus debug branch of the platforms.

Edit 3:

If your Delphi version does not suffer from Library path overwrites, then you can use Davids suggestion with these steps:

  1. Prepend the paths like $(BDSLIB)\$(Platform)\nodebug;$(BDSLIB)\$(Platform)\debug\$(LANGDIR); to the Delphi Debug DCU Path.
  2. Copy any English language unit you do not want to debug from $(BDSLIB)\$(Platform)\release to $(BDSLIB)\$(Platform)\nodebug for all the above mentioned platforms.
  3. Copy any non-English language unit you do not want to debug from $(BDSLIB)\$(Platform)\release\$(LANGDIR); to $(BDSLIB)\$(Platform)\nodebug\$(LANGDIR); for all the above mentioned platforms.

The nodebug directories do not have to be in the $(BDSLIB) realm, but it is really convenient to keep the $(Platform) as it is easier to support other platforms than Win32.

I've tested this with Delphi XE3 and XE5 on all supported platforms and it works. In XE and XE2, I sometimes hat parts of the search paths overwritten with wrong values, so I prefer the first method there.

The picture below is for Delphi XE3 and the OSX.

It supports the English debugging DCUs and the translated debugging DCUS.

enter image description here

like image 43
Jeroen Wiert Pluimers Avatar answered Oct 26 '22 05:10

Jeroen Wiert Pluimers