是否可以编写Delphi调试器的扩展?

时间:2022-05-10 20:43:04

I know there's an API for creating extensions to Delphi. I use the GExperts package and various JVCL experts frequently. But I've never seen any extensions to the debugger. It would be very nice, for example, to be able to register viewers for various objects instead of having to examine them in the Inspector. (A form with an image control that displays a TImage, for example, or a grid that displays the contents of a dataset.)

我知道有一个用于创建Delphi扩展的API。我经常使用GExperts软件包和各种JVCL专家。但我从未见过调试器的任何扩展。例如,能够为各种对象注册查看器而不必在Inspector中检查它们将是非常好的。 (例如,带有显示TImage的图像控件的表单,或显示数据集内容的网格。)

Are there any APIs that allow you to extend Delphi's debugger in this way?

是否有任何API允许您以这种方式扩展Delphi的调试器?

EDIT: This wasn't available back when I wrote the question, but Delphi 2010 provides a way to do it.

编辑:当我写这个问题时,这不可用,但Delphi 2010提供了一种方法。

2 个解决方案

#1


In ToolsAPI.pas source there is some API interfaces for debugging. You can be informed when a debugging event occurred, info about breakpoints, which process is being debugged etc. with this API. But it seems there is no support for variables or values of them. So there is no easy way to implement your requisition without ugly hacks.

在ToolsAPI.pas源代码中,有一些用于调试的API接口。通过此API,可以在发生调试事件时通知您有关断点的信息,正在调试哪个进程等。但似乎没有对它们的变量或值的支持。因此,没有简单的方法来实现你的请求没有丑陋的黑客。

#2


Basic debugger visualizers can be implemented with the Evaluation interfaces exposed by the OTA. (Examples for debugger visualizers can be found here and here.)

可以使用OTA公开的评估界面实现基本调试器可视化工具。 (可在此处和此处找到调试器可视化器的示例。)

A deeper integration into the debugger is possible as well (for example, I wrote a little extension for C++Builder that enables the debugger to evaluate the actual objects behind an interface) - but as Khan pointed out, to achieve such a level of integration, you'll need to resort to quite a few dirty hacks.

可以更深入地集成到调试器中(例如,我为C ++ Builder编写了一个小扩展,使调试器能够评估接口背后的实际对象) - 但正如Khan指出的那样,要达到这样的水平整合,你需要诉诸于一些肮脏的黑客。

#1


In ToolsAPI.pas source there is some API interfaces for debugging. You can be informed when a debugging event occurred, info about breakpoints, which process is being debugged etc. with this API. But it seems there is no support for variables or values of them. So there is no easy way to implement your requisition without ugly hacks.

在ToolsAPI.pas源代码中,有一些用于调试的API接口。通过此API,可以在发生调试事件时通知您有关断点的信息,正在调试哪个进程等。但似乎没有对它们的变量或值的支持。因此,没有简单的方法来实现你的请求没有丑陋的黑客。

#2


Basic debugger visualizers can be implemented with the Evaluation interfaces exposed by the OTA. (Examples for debugger visualizers can be found here and here.)

可以使用OTA公开的评估界面实现基本调试器可视化工具。 (可在此处和此处找到调试器可视化器的示例。)

A deeper integration into the debugger is possible as well (for example, I wrote a little extension for C++Builder that enables the debugger to evaluate the actual objects behind an interface) - but as Khan pointed out, to achieve such a level of integration, you'll need to resort to quite a few dirty hacks.

可以更深入地集成到调试器中(例如,我为C ++ Builder编写了一个小扩展,使调试器能够评估接口背后的实际对象) - 但正如Khan指出的那样,要达到这样的水平整合,你需要诉诸于一些肮脏的黑客。