gpt4 book ai didi

delphi - 在 Delphi 中调试 OutputDebugString 调用

转载 作者:行者123 更新时间:2023-12-03 15:03:30 27 4
gpt4 key购买 nike

我的应用程序中有一些“流氓”OutputDebugString 调用,它打印出“T”,但我无法找到它。

是否可以以某种方式在 OutputDebugString 函数上设置断点并查看它是从哪里调用的?

我使用的是 Delphi 2009。

最佳答案

您的项目中有多少次对 OutputDebugString 的调用?您可以使用“在文件中查找”对话框来查找所有这些文件,如果它们不是太多,应该不会有问题。

否则,您当然可以使用搜索并替换所有 OutputDebugString(raise Exception.Create(.

你也可以写一个函数

procedure OutputDebugString(const Str: string);
begin
raise Exception.Create(Str);
end;

在项目中所有其他单元使用的单元中。如果仅在 uses 列表中的 Windows.pas 之后声明此新单元,则将使用此新函数而不是 Windows.pas 函数。

更新

是的,您可以在 Windows.pas 中放置断点。首先,在您的项目中,转到“项目选项”,然后在“调试”下选择“使用调试 DCU”。然后你可以进入Windows.pas并在第30769行放置一个断点:

procedure OutputDebugString; external kernel32 name 'OutputDebugStringW';

关于delphi - 在 Delphi 中调试 OutputDebugString 调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4258848/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com