"Search for Usages" Delphi 7?

"Search for Usages" for Delphi 7?

Delphi XE+ 有一个 "Search for Usages" 选项。 Delphi 7 中是否有类似的选项来查找 function/procedure 来电者?我要么进行纯文本搜索,要么放置一个断点,看看在 运行 时间内调用堆栈中的调用者是谁。两者都非常耗时且效率低下。

在 Delphi XE 中打开应用程序并使用 "Search for Usages" 不起作用。该应用程序无法编译。

在 Delphi 7 中没有与 Search for Usages 等效的功能。该功能最初是在 XE 中引入的。

甚至 Find References 功能直到 Delphi 2005 年才引入(当 Delphi 切换到 Galileo IDE 时)。

还有一种查找来电者的替代方法:

使用可以显示调用堆栈的调试器(如 MadExcept)并在您的函数中创建一个 "fake" 异常,如下所示:

function WhereDoYouCallMe;
  begin
    raise Exception.Create('Called');
    ...
    ...
  end;

现在每次调用该函数时,您都会看到一个错误框,您可以在其中查看 Stack 并了解它的调用位置。您可以继续程序,也可以设置断点等等。

不理想,但您也可以

  • 重命名方法
  • 编译
  • 检查编译器错误以找到所有调用者(那些可以在编译时解决的)

dummzeug

所述

Renaming the method is the simplest way to find all uses. Unfortunately you have to rename all uses in turn to find the next use. And afterwards revert the changes.

您也可以标记方法'deprecated',您将在编译器警告中获得用法列表。