问题描述
我的应用程序中有一些流氓的OutputDebugString调用,打印出T,但是我找不到它。在OutputDebugString -function上设置断点,看看它从哪里调用?
我使用的是Delphi 2009。
您的项目中有多少个调用$ code OutputDebugString ?您可以使用查找文件对话框找到它们,如果它们不是太多,则不应该有问题。
否则,您当然可以使用搜索并替换所有 OutputDebugString(
与 raise Exception.Create(
。
您还可以写一个函数
procedure OutputDebugString(const Str:string );
begin
raise Exception.Create(Str);
end;
在项目中每个其他单位使用的单位中,如果在中使用
Windows.pas
后声明此新单位, / code>列表,这个新功能将被使用而不是Windows.pas。
更新
是的,您可以在Windows.pas中放置断点,首先在项目中,转到项目选项,在调试中选择使用调试DCU,然后可以进入Windows.pas并将断点放在一行30769:
程序OutputDebugString;外部kernel32名称'OutputDebugStringW';
I've some "rogue" OutputDebugString call in my application which prints out "T", but I can't just locate it.
Is it possible somehow to set breakpoint on OutputDebugString -function and see where it is called from?
I'm using Delphi 2009.
How many calls to OutputDebugString
are there in your project? You can use the "Find in Files" dialog to find them all, and if they aren't too many, there shouldn't be a problem.
Otherwise, you could - of course - use a search and replace and replace all OutputDebugString(
with raise Exception.Create(
.
You could also write a function
procedure OutputDebugString(const Str: string);
begin
raise Exception.Create(Str);
end;
in a unit used by every other unit in the project. If only this new unit is declared after Windows.pas
in the uses
list, this new function will be used instead of the Windows.pas one.
Update
Yes, you can place breakpoints inside Windows.pas. First, in your project, go to Project Options, and under Debugging, select "Use debug DCUs". Then you can go to Windows.pas and place a breakpoint at line 30769:
procedure OutputDebugString; external kernel32 name 'OutputDebugStringW';
这篇关于调试在Delphi中的OutputDebugString调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!