简体   繁体   English

有没有办法在不包含系统单元的情况下启用调试DCU?

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

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). 在Delphi中使用调试DCU非常好,除了系统单元在方法初始化/清理(释放接口,清除数组,行走异常帧等)时增加了很多开销。

Is there a way to run Delphi with debug DCUs, but without the System unit? 有没有办法用调试DCU运行Delphi,但没有系统单元?

When you enable Debug DCUs, all you are really doing is changing the DCU search path. 启用调试DCU时,您所做的只是更改DCU搜索路径。 Specifically that the paths specified by the Debug DCU Path option are used when searching for .dcu files. 特别是在搜索.dcu文件时使用Debug DCU Path选项指定的路径

So, you could create a new directory and add it to the front of the list of paths in the Debug DCU Path option. 因此,您可以创建一个新目录并将其添加到“调试DCU路径”选项中的路径列表的前面。 Into that directory place the standard System.dcu that does not contain debug symbols. 在该目录中放置不包含调试符号的标准System.dcu。

  1. Backup ...\\Embarcadero\\RAD Studio\\10.0\\lib\\win32\\debug\\System.dcu 备份...\\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 复制...\\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. 在将修补程序或更新应用于Delphi之前,请还原原始System.dcu文件。

Repeat for the other plaforms: replace win32 with any of these, depending on the Delphi version you are running. 重复其他平台:将win32替换为其中任何一个,具体取决于您运行的Delphi版本。

  • android
  • iosDevice
  • iossimulator
  • osx32
  • win64

Edit 2: 编辑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. 重复其他支持的语言而不是英语:用debug\\##替换debugrelease ,并为你想要使用的每种语言## release\\##

Currently supported languages I know of: 目前支持的语言我知道:

  • de (German) de (德国)
  • fr (French) fr (法文)
  • jp (Japanese) jp (日文)

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. 这种方式运行良好,即使安装顺序混淆了您在Delphi XE / XE2时代不止一次发生的搜索路径。

It works fine for any unit in the release versus debug branch of the platforms. 它适用于平台的releasedebug分支中的任何单元。

Edit 3: 编辑3:

If your Delphi version does not suffer from Library path overwrites, then you can use Davids suggestion with these steps: 如果您的Delphi版本没有遭受库路径覆盖,那么您可以使用Davids建议执行以下步骤:

  1. Prepend the paths like $(BDSLIB)\\$(Platform)\\nodebug;$(BDSLIB)\\$(Platform)\\debug\\$(LANGDIR); 前面的路径如$(BDSLIB)\\$(Platform)\\nodebug;$(BDSLIB)\\$(Platform)\\debug\\$(LANGDIR); to the Delphi Debug DCU Path. 到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. 将您不想调试的任何英语单元从$(BDSLIB)\\$(Platform)\\release $(BDSLIB)\\$(Platform)\\nodebug$(BDSLIB)\\$(Platform)\\nodebug用于所有上述平台。
  3. Copy any non-English language unit you do not want to debug from $(BDSLIB)\\$(Platform)\\release\\$(LANGDIR); $(BDSLIB)\\$(Platform)\\release\\$(LANGDIR);复制您不想调试的任何非英语语言单元$(BDSLIB)\\$(Platform)\\release\\$(LANGDIR); to $(BDSLIB)\\$(Platform)\\nodebug\\$(LANGDIR); $(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 . nodebug目录不必位于$(BDSLIB)领域,但保留$(Platform)非常方便,因为它比Win32更容易支持其他平台。

I've tested this with Delphi XE3 and XE5 on all supported platforms and it works. 我已经在所有支持的平台上使用Delphi XE3和XE5进行了测试,并且它可以工作。 In XE and XE2, I sometimes hat parts of the search paths overwritten with wrong values, so I prefer the first method there. 在XE和XE2中,我有时会用错误的值覆盖搜索路径的某些部分,因此我更喜欢第一种方法。

The picture below is for Delphi XE3 and the OSX. 下图是针对Delphi XE3和OSX的。

It supports the English debugging DCUs and the translated debugging DCUS . 它支持英语调试DCU翻译后的调试DCUS

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有没有办法避免将 DCU 链接到 BPL? - Is there a way to avoid linking DCUs to a BPL? 在Delphi 2009中使用debug dcus选项? - Use debug dcus option in Delphi 2009? 是否可以从DCU中剥离调试信息? - Is it possible to strip Debug Information from DCUs? 在Lazarus中是否有类似于Delphi“Use debug DCU”的选项 - Is there an option analogous to Delphi “Use debug DCUs” in Lazarus 如何在 C++ Builder 中禁用“使用 debug.dcus” - How to disable “Use debug .dcus” in C++ Builder Delphi:如果我在我的项目中使用包,为什么“使用调试 DCU”变得无效? - Delphi: Why does “use debug DCUs” become ineffective if I'm using packages in my project? 使用我自己构建的调试库和常规DCU在Delphi中管理非常大的代码库 - Managing very large codebases in Delphi using a Library of Debug and Regular DCUs I built myself 为何编译器将不属于当前软件包的DCU放置在其单元输出目录中? - Why does the compiler place DCUs that do not belong to the current package in its unit output directory? 有没有办法在不包含原始文件的目录结构的情况下创建 TZipfile? - Is there a way to create a TZipfile without including the directory structure of the original files? Delphi调试错误的单元 - Delphi debug a wrong unit
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM