11

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?

1

2 Answers 2

21

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.

7
  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

2
  • 2
    This seems like a very brittle thing to do. Not least because the IDE provides a first class way to do what you want without messing with the installation. Jan 1, 2014 at 20:47
  • 3
    Since you are posting QA style article, you could generalize it for any unit to be excluded from Trace In command. For example, not using debug info in System and SysInit will enable single stepping from the very beginning of debugging session instead of lengthy RTL init. Jan 1, 2014 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.